update 2026-08-14 04:36:07

This commit is contained in:
action committed 2026-08-14 04:36:07 +08:00
1 parent e716bb6996
commit 5ce413d3a3
74 files changed
+693 -819

No files matched your search

@@ -1,6 +1,6 @@
local api = require "luci.passwall2.api"
local appname = api.appname
local uci = api.uci
api.set_default_cbi()
local has_ss_rust = api.is_finded("sslocal")
local has_singbox = api.finded_com("sing-box")
local has_xray = api.finded_com("xray")
@@ -38,20 +38,16 @@ if has_hysteria2 then
table.insert(hysteria2_type, s)
end
api.set_default_cbi()
m = Map(appname)
api.set_apply_on_parse(m)
m = Map()
function m.on_before_save(self)
self.uci:foreach(appname, "subscribe_list", function(e)
self:foreach("subscribe_list", function(e)
self:del(e[".name"], "md5")
end)
end
-- [[ Subscribe Settings ]]--
s = m:section(TypedSection, "global_subscribe", "")
s.anonymous = true
s = m:section(NamedSection, "@global_subscribe[0]", "global_subscribe")
o = s:option(ListValue, "filter_keyword_mode", translate("Filter keyword Mode"))
o:value("0", translate("Close"))
@@ -126,8 +122,7 @@ o.cfgvalue = function(self, section)
translate("Manual subscription All"))
end
local cfgname = "subscribe_list"
s = m:section(TypedSection, cfgname, "", "<font color='red'>" .. translate("When adding a new subscription, please save and apply before manually subscribing. If you only change the subscription URL, you can subscribe manually, and the system will save it automatically.") .. "</font>")
s = m:section(TypedSection, "subscribe_list", "", "<font color='red'>" .. translate("When adding a new subscription, please save and apply before manually subscribing. If you only change the subscription URL, you can subscribe manually, and the system will save it automatically.") .. "</font>")
s.addremove = true
s.anonymous = true
s.sortable = true
@@ -150,7 +145,7 @@ o.validate = function(self, value, section)
return nil, translate("Remark cannot be empty.")
end
local duplicate = false
m.uci:foreach(appname, cfgname, function(e)
m:foreach(s.sectiontype, function(e)
if e[".name"] ~= section and e["remark"] and e["remark"]:lower() == value:lower() then
duplicate = true
return false
@@ -164,9 +159,9 @@ end
o.write = function(self, section, value)
local old = m:get(section, self.option) or ""
if old ~= value then
m.uci:foreach(appname, "nodes", function(e)
m:foreach("nodes", function(e)
if e["group"] and e["group"]:lower() == old:lower() then
m.uci:set(appname, e[".name"], "group", value)
m:set(e[".name"], "group", value)
end
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
local gs = ""
@@ -178,7 +173,7 @@ o.write = function(self, section, value)
end
end
gs = api.trim(gs)
m.uci:set(appname, e[".name"], "node_group", gs)
m:set(e[".name"], "node_group", gs)
end
end)
end
@@ -196,7 +191,7 @@ o.cfgvalue = function(t, n)
end
str = str ~= "" and "<br>" .. str or ""
local num = 0
m.uci:foreach(appname, "nodes", function(s)
m:foreach("nodes", function(s)
if s["group"] and s["group"]:lower() == remark:lower() then
num = num + 1
end
@@ -225,11 +220,8 @@ o.cfgvalue = function(self, section)
section, translate("Manual subscription"))
end
local sortable = Template(appname .. "/cbi/sortable")
sortable.api = api
sortable.target_cfgname = cfgname
m:append(sortable)
m:appendTemplate("/cbi/sortable", {sectiontype = s.sectiontype})
m:append(Template(appname .. "/node_subscribe/js"))
m:appendTemplate("/node_subscribe/js")
return api.return_map(m)