mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-15 04:53:00 +08:00
🦄 Sync 2026-10-17 20:40:04
This commit is contained in:
1 parent
315f273687
commit
c9ccf6f883
37 files changed
+716
-171
No files matched your search
@@ -101,10 +101,11 @@ function index()
|
||||
entry({"admin", "services", appname, "delete_select_shunt_rules"}, call("delete_select_shunt_rules")).leaf = true
|
||||
|
||||
--[[Components update]]
|
||||
entry({"admin", "services", appname, "check_passwall2"}, call("app_check")).leaf = true
|
||||
entry({"admin", "services", appname, "check_" .. appname}, call("app_check")).leaf = true
|
||||
entry({"admin", "services", appname, "update_" .. appname}, call("app_update")).leaf = true
|
||||
local coms = require "luci.passwall2.com"
|
||||
local com
|
||||
for com, _ in pairs(coms) do
|
||||
for _, com in ipairs(coms.order) do
|
||||
entry({"admin", "services", appname, "check_" .. com}, call("com_check", com)).leaf = true
|
||||
entry({"admin", "services", appname, "update_" .. com}, call("com_update", com)).leaf = true
|
||||
entry({"admin", "services", appname, "version_" .. com}, call("com_version", com)).leaf = true
|
||||
@@ -747,6 +748,30 @@ function app_check()
|
||||
http_write_json(json)
|
||||
end
|
||||
|
||||
function app_update()
|
||||
local id = http.formvalue("id")
|
||||
if not id or not id:match("^[%w_-]+$") then
|
||||
http_write_json({code = 1, error = i18n.translate("Invalid download task.")})
|
||||
return
|
||||
end
|
||||
local task = http.formvalue("task")
|
||||
local result
|
||||
if task == "progress" then
|
||||
result = api.to_download_progress(appname, id, http.formvalue("total_size"))
|
||||
elseif task == "install" then
|
||||
if not luci.dispatcher.test_post_security() then return end
|
||||
result = api.to_install_self(id, http.formvalue("force"), http.formvalue("languages"))
|
||||
else
|
||||
local part = tonumber(http.formvalue("part")) or 1
|
||||
if part < 1 or part > 5 or part ~= math.floor(part) then
|
||||
http_write_json({code = 1, error = i18n.translate("Invalid download task.")})
|
||||
return
|
||||
end
|
||||
result = api.to_download(appname, http.formvalue("url"), http.formvalue("size"), id .. part, part > 1)
|
||||
end
|
||||
http_write_json(result)
|
||||
end
|
||||
|
||||
function com_check(comname)
|
||||
local json = api.to_check("", comname)
|
||||
http_write_json(json)
|
||||
|
||||
Reference in new issue
Block a user