Skip to content

Commit 90243b1

Browse files
committed
luci: optimize balancing/urltest batch adding node related
1 parent 0169bc4 commit 90243b1

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,18 @@ o.write = function(self, section, value)
188188
if e["group"] and e["group"]:lower() == old:lower() then
189189
m.uci:set(appname, e[".name"], "group", value)
190190
end
191+
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
192+
local gs = ""
193+
for g in e["node_group"]:gmatch("%S+") do
194+
if api.UrlEncode(old) == g then
195+
gs = gs .. " " .. api.UrlEncode(value)
196+
else
197+
gs = gs .. " " .. g
198+
end
199+
end
200+
gs = api.trim(gs)
201+
m.uci:set(appname, e[".name"], "node_group", gs)
202+
end
191203
end)
192204
end
193205
return Value.write(self, section, value)

luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ o.write = function(self, section, value)
106106
if e["group"] and e["group"]:lower() == old:lower() then
107107
m.uci:set(appname, e[".name"], "group", value)
108108
end
109+
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
110+
local gs = ""
111+
for g in e["node_group"]:gmatch("%S+") do
112+
if api.UrlEncode(old) == g then
113+
gs = gs .. " " .. api.UrlEncode(value)
114+
else
115+
gs = gs .. " " .. g
116+
end
117+
end
118+
gs = api.trim(gs)
119+
m.uci:set(appname, e[".name"], "node_group", gs)
120+
end
109121
end)
110122
end
111123
return Value.write(self, section, value)

luci-app-passwall/luasrc/passwall/util_sing-box.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ function gen_config(var)
11271127
g = api.UrlDecode(g)
11281128
for k, v in pairs(nodes_list) do
11291129
local gn = (v.group and v.group ~= "") and v.group or "default"
1130-
if gn == g and api.match_node_rule(v.remarks, _node.node_match_rule) then
1130+
if gn:lower() == g:lower() and api.match_node_rule(v.remarks, _node.node_match_rule) then
11311131
nodes[#nodes + 1] = v.id
11321132
end
11331133
end

luci-app-passwall/luasrc/passwall/util_xray.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ function gen_config(var)
827827
g = api.UrlDecode(g)
828828
for k, v in pairs(nodes_list) do
829829
local gn = (v.group and v.group ~= "") and v.group or "default"
830-
if gn == g and api.match_node_rule(v.remarks, _node.node_match_rule) then
830+
if gn:lower() == g:lower() and api.match_node_rule(v.remarks, _node.node_match_rule) then
831831
nodes[#nodes + 1] = v.id
832832
end
833833
end

0 commit comments

Comments
 (0)