From 9f37de0b086595562b256eebdabec5106c7d7d2d Mon Sep 17 00:00:00 2001 From: gitea-action Date: Fri, 20 Dec 2024 00:00:30 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall2/commit/0f50b7c337650c55c35755e784662c3be67fce8b --- luci-app-passwall2/Makefile | 2 +- .../luasrc/model/cbi/passwall2/client/global.lua | 11 +++++++++-- luci-app-passwall2/luasrc/passwall2/util_sing-box.lua | 2 +- luci-app-passwall2/luasrc/passwall2/util_xray.lua | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index 2892f69f3..2ec6533cf 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 PKG_VERSION:=24.12.19 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua index 3b266a42c..bf77992e9 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua @@ -94,6 +94,11 @@ if (has_singbox or has_xray) and #nodes_table > 0 then m:set(shunt_node_id, option, value) end end + local function get_remove(shunt_node_id, option) + return function(self, section) + m:del(shunt_node_id, option) + end + end if #normal_list > 0 then for k, v in pairs(shunt_list) do local vid = v.id @@ -148,8 +153,8 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, node_option, string.format('* %s', api.url("shunt_rules", id), e.remarks)) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("node", v.id) - o.default = "" o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) @@ -158,7 +163,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag") pt.write = get_write(v.id, id .. "_proxy_tag") - pt.default = "" + pt.remove = get_remove(v.id, id .. "_proxy_tag") pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) for k1, v1 in pairs(socks_list) do @@ -181,6 +186,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default"))) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("node", v.id) o.default = "_direct" o:value("_direct", translate("Direct Connection")) @@ -202,6 +208,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:value("", translate("Close")) o:value("main", translate("Preproxy Node")) for k1, v1 in pairs(normal_list) do diff --git a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 95c1851c9..2fbdd6880 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -950,7 +950,7 @@ function gen_config(var) rule_outboundTag = "block" elseif _node_id == "_default" and rule_name ~= "default" then rule_outboundTag = "default" - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil if socks_node then diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 5f94df042..981998fa9 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -848,7 +848,7 @@ function gen_config(var) return "blackhole", nil elseif _node_id == "_default" then return "default", nil - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil local socks_tag