update 2026-08-14 20:53:13

This commit is contained in:
action committed 2026-08-14 20:53:13 +08:00
1 parent bbea37a7c8
commit 58e04d6ceb
1972 files changed
+1523368 -299

No files matched your search

+88 -9
View File
@@ -17,9 +17,10 @@ command_timeout = 300
OPENWRT_ARCH = nil
DISTRIB_ARCH = nil
LOCK_PREFIX = "/tmp/lock/passwall2"
LOG_FILE = "/tmp/log/passwall2.log"
CACHE_PATH = "/tmp/etc/passwall2_tmp"
TMP_PATH = "/tmp/etc/" .. appname
TMP_PATH = "/tmp/etc/passwall2"
CACHE_PATH = TMP_PATH .. "_tmp"
TMP_IFACE_PATH = TMP_PATH .. "/iface"
local lang = uci:get("luci", "main", "lang") or "auto"
@@ -62,7 +63,85 @@ function is_old_uci()
return sys.call("grep -E 'require[ \t]*\"uci\"' /usr/lib/lua/luci/model/uci.lua >/dev/null 2>&1") == 0
end
function uci_del(config, section, option)
if option then
return uci:delete(config, section, option)
else
return uci:delete(config, section)
end
end
function uci_get(config, section, option)
if not section then
return uci:get_all(config)
elseif option then
return uci:get(config, section, option) or nil
else
return uci:get_all(config, section)
end
end
function uci_set(config, section, option, value)
if type(value) == "number" then
value = value .. ""
end
if #value > 0 then
if option then
if type(value) == "table" then
return uci:set_list(config, section, option, value)
else
return uci:set(config, section, option, value)
end
else
return uci:set(config, section, value)
end
else
return uci_del(config, section, option)
end
end
function uci_del_c(section, option)
return uci_del(c_config, section, option)
end
function uci_foreach_c(stype, func)
uci:foreach(c_config, stype, func)
end
function uci_get_c(section, option)
return uci_get(c_config, section, option)
end
function uci_set_c(section, option, value)
return uci_set(c_config, section, option, value)
end
function uci_save_c(commit, apply)
return uci_save(uci, c_config, commit, apply)
end
function uci_del_s(section, option)
return uci_del(s_config, section, option)
end
function uci_foreach_s(stype, func)
uci:foreach(s_config, stype, func)
end
function uci_get_s(section, option)
return uci_get(s_config, section, option)
end
function uci_set_s(section, option, value)
return uci_set(s_config, section, option, value)
end
function uci_save_s(commit, apply)
return uci_save(uci, s_config, commit, apply)
end
function uci_save(cursor, config, commit, apply)
if not cursor then cursor = uci end
if is_old_uci() then
cursor:save(config)
if commit then
@@ -236,7 +315,7 @@ function curl_direct(url, file, args)
end
function curl_auto(url, file, args)
local localhost_proxy = uci:get(c_config, "@global[0]", "localhost_proxy") or "1"
local localhost_proxy = uci_get_c("@global[0]", "localhost_proxy") or "1"
if localhost_proxy == "1" then
return curl_base(url, file, args)
else
@@ -495,7 +574,7 @@ function get_node_name(node_id)
if type(node_id) == "table" then
e = node_id
else
e = uci:get_all(c_config, node_id)
e = uci_get_c(node_id)
end
if e then
if e.type and e.remarks then
@@ -511,7 +590,7 @@ function get_node_name(node_id)
end
function get_valid_nodes()
local show_node_info = uci:get(c_config, "@global_other[0]", "show_node_info") or "0"
local show_node_info = uci_get_c("@global_other[0]", "show_node_info") or "0"
local nodes = {}
local default_nodes = {}
local other_nodes = {}
@@ -696,7 +775,7 @@ function chmod_755(file)
end
function get_customed_path(e)
return uci:get(c_config, "@global_app[0]", e .. "_file")
return uci_get_c("@global_app[0]", e .. "_file")
end
function finded_com(e)
@@ -755,7 +834,7 @@ end
function get_app_path(app_name)
if com[app_name] then
local def_path = com[app_name].default_path
local path = uci:get(c_config, "@global_app[0]", app_name:gsub("%-","_") .. "_file")
local path = uci_get_c("@global_app[0]", app_name:gsub("%-","_") .. "_file")
path = path and (#path>0 and path or def_path) or def_path
return path
end
@@ -1714,7 +1793,7 @@ end
function get_socks_backup_nodes(id)
id = trim(id)
if id == "" then return "" end
local socks = uci:get_all(c_config, id)
local socks = uci_get_c(id)
local nodes
if socks.backup_node_add_mode and socks.backup_node_add_mode == "batch" then
local node = {}
@@ -1735,7 +1814,7 @@ function get_socks_backup_nodes(id)
end
function get_core(field, candidates)
local v = uci:get(c_config, "@global_subscribe[0]", field)
local v = uci_get_c("@global_subscribe[0]", field)
if v and v ~= "" then
for _, c in ipairs(candidates) do
if c[2] == v and c[1] then