mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-29 19:35:13 +08:00
update 2026-09-20 16:59:13
This commit is contained in:
1 parent
4dd6850a75
commit
735d247cbe
23 files changed
+237
-115
No files matched your search
@@ -99,6 +99,7 @@ if load_urltest_options then -- [[ URLTest Start ]]
|
||||
o = s:option(MultiValue, "urltest_node", translate("URLTest node list"), translate("List of nodes to test, <a target='_blank' href='https://sing-box.sagernet.org/configuration/outbound/urltest'>document</a>"))
|
||||
o:depends({ node_add_mode = "manual" })
|
||||
o.widget = "checkbox"
|
||||
o.cast = "table"
|
||||
o.template = m:template_path("/cbi/nodes_multivalue")
|
||||
o.group = {}
|
||||
for k1, v1 in pairs(node_list) do
|
||||
@@ -109,28 +110,6 @@ if load_urltest_options then -- [[ URLTest Start ]]
|
||||
end
|
||||
end
|
||||
end
|
||||
function o.cfgvalue(self, section)
|
||||
return table.concat(m:get(section, "urltest_node") or {}, " ")
|
||||
end
|
||||
function o.write(self, section, value)
|
||||
local old = m:get(section, "urltest_node") or {}
|
||||
local new, set = {}, {}
|
||||
for v in value:gmatch("%S+") do
|
||||
new[#new + 1] = v
|
||||
set[v] = 1
|
||||
end
|
||||
for _, v in ipairs(old) do
|
||||
if not set[v] then
|
||||
m:set(section, "urltest_node", new)
|
||||
return
|
||||
end
|
||||
set[v] = nil
|
||||
end
|
||||
for _ in pairs(set) do
|
||||
m:set(section, "urltest_node", new)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(MultiValue, "node_group", translate("Select Group"))
|
||||
o:depends({ node_add_mode = "batch" })
|
||||
|
||||
@@ -91,6 +91,7 @@ if load_balancing_options then -- [[ Load balancing Start ]]
|
||||
o = s:option(MultiValue, "balancing_node", translate("Load balancing node list"), translate("Load balancing node list, <a target='_blank' href='https://xtls.github.io/config/routing.html#balancerobject'>document</a>"))
|
||||
o:depends({ node_add_mode = "manual" })
|
||||
o.widget = "checkbox"
|
||||
o.cast = "table"
|
||||
o.template = m:template_path("/cbi/nodes_multivalue")
|
||||
o.group = {}
|
||||
for k1, v1 in pairs(node_list) do
|
||||
@@ -101,28 +102,6 @@ if load_balancing_options then -- [[ Load balancing Start ]]
|
||||
end
|
||||
end
|
||||
end
|
||||
function o.cfgvalue(self, section)
|
||||
return table.concat(m:get(section, "balancing_node") or {}, " ")
|
||||
end
|
||||
function o.write(self, section, value)
|
||||
local old = m:get(section, "balancing_node") or {}
|
||||
local new, set = {}, {}
|
||||
for v in value:gmatch("%S+") do
|
||||
new[#new + 1] = v
|
||||
set[v] = 1
|
||||
end
|
||||
for _, v in ipairs(old) do
|
||||
if not set[v] then
|
||||
m:set(section, "balancing_node", new)
|
||||
return
|
||||
end
|
||||
set[v] = nil
|
||||
end
|
||||
for _ in pairs(set) do
|
||||
m:set(section, "balancing_node", new)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(MultiValue, "node_group", translate("Select Group"))
|
||||
o:depends({ node_add_mode = "batch" })
|
||||
|
||||
Reference in new issue
Block a user