From 226736e6bfb577feb46358f79fade3d0c79c2893 Mon Sep 17 00:00:00 2001 From: Tianhe Y Date: Sat, 1 Apr 2023 12:52:05 +0800 Subject: [PATCH] luci: fix #2434 (#2438) --- .../model/cbi/passwall/client/global.lua | 2 ++ .../luasrc/passwall/util_xray.lua | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index e820cc902..9e51d8127 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -141,6 +141,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then o.write = get_write(v.id, "main_node") local dialerProxy = s:taboption("Main", Flag, vid .. "-dialerProxy", translate("dialerProxy")) + dialerProxy.default = "0" if v.type == "Xray" then dialerProxy:depends("tcp_node", v.id) else --主设置界面没有type判断,只能判断本分流节点类型是Xray就添加对本分流节点的依赖,但不是的话就没有依赖,会全部显示,所以添加一个不存在的依赖以达到隐藏的目的 @@ -148,6 +149,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then end dialerProxy.cfgvalue = get_cfgvalue(v.id, "dialerProxy") dialerProxy.write = get_write(v.id, "dialerProxy") + dialerProxy.rmempty = false uci:foreach(appname, "shunt_rules", function(e) local id = e[".name"] diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index f54feb248..4379f2b8c 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -809,6 +809,7 @@ function gen_config(var) table.insert(protocols, w) end) end + --[[ local _domain = nil if e.domain_list then _domain = {} @@ -831,6 +832,38 @@ function gen_config(var) ip = _ip, protocol = protocols }) + --]] + if e.domain_list then + local _domain = {} + string.gsub(e.domain_list, '[^' .. "\r\n" .. ']+', function(w) + table.insert(_domain, w) + end) + table.insert(rules, { + type = "field", + outboundTag = outboundTag, + domain = _domain, + protocol = protocols + }) + end + if e.ip_list then + local _ip = {} + string.gsub(e.ip_list, '[^' .. "\r\n" .. ']+', function(w) + table.insert(_ip, w) + end) + table.insert(rules, { + type = "field", + outboundTag = outboundTag, + ip = _ip, + protocol = protocols + }) + end + if not e.domain_list and not e.ip_list and protocols then + table.insert(rules, { + type = "field", + outboundTag = outboundTag, + protocol = protocols + }) + end end end)