luci: fix maybe wrong issue
This commit is contained in:
parent
dc8eb4f957
commit
aa62fdcc18
@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=4.64-1
|
||||
PKG_VERSION:=4.64-4
|
||||
PKG_RELEASE:=
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
@ -85,36 +85,39 @@ o = s:taboption("Main", Flag, "enabled", translate("Main switch"))
|
||||
o.rmempty = false
|
||||
|
||||
local auto_switch_tip
|
||||
local auto_switch_flag
|
||||
local shunt_remark
|
||||
local current_tcp_node = luci.sys.exec(string.format("[ -f '/tmp/etc/%s/id/TCP' ] && echo -n $(cat /tmp/etc/%s/id/TCP)", appname, appname))
|
||||
if current_tcp_node and current_tcp_node ~= "" and current_tcp_node ~= "nil" then
|
||||
local n = uci:get_all(appname, current_tcp_node)
|
||||
if n then
|
||||
if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then
|
||||
auto_switch_flag = ""
|
||||
if n.protocol == "_shunt" then
|
||||
local shunt_logic = tonumber(m:get("@auto_switch[0]", "shunt_logic"))
|
||||
if shunt_logic == 1 or shunt_logic == 2 then
|
||||
if shunt_logic == 1 then
|
||||
auto_switch_flag = "default"
|
||||
shunt_remark = "default"
|
||||
elseif shunt_logic == 2 then
|
||||
auto_switch_flag = "main"
|
||||
shunt_remark = "main"
|
||||
end
|
||||
current_tcp_node = luci.sys.exec(string.format("[ -f '/tmp/etc/%s/id/TCP_%s' ] && echo -n $(cat /tmp/etc/%s/id/TCP_%s)", appname, auto_switch_flag, appname, auto_switch_flag))
|
||||
current_tcp_node = luci.sys.exec(string.format("[ -f '/tmp/etc/%s/id/TCP_%s' ] && echo -n $(cat /tmp/etc/%s/id/TCP_%s)", appname, shunt_remark, appname, shunt_remark))
|
||||
if current_tcp_node and current_tcp_node ~= "" and current_tcp_node ~= "nil" then
|
||||
n = uci:get_all(appname, current_tcp_node)
|
||||
end
|
||||
end
|
||||
end
|
||||
if n then
|
||||
local remarks = api.get_node_remarks(n)
|
||||
local url = api.url("node_config", n[".name"])
|
||||
auto_switch_tip = translatef("Current node: %s", string.format('<a href="%s">%s</a>', url, remarks)) .. "<br />"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---- TCP Node
|
||||
tcp_node = s:taboption("Main", ListValue, "tcp_node", "<a style='color: red'>" .. translate("TCP Node") .. "</a>")
|
||||
tcp_node:value("nil", translate("Close"))
|
||||
if auto_switch_flag == "" and auto_switch_tip then
|
||||
if not shunt_remark and auto_switch_tip then
|
||||
tcp_node.description = auto_switch_tip
|
||||
end
|
||||
|
||||
@ -181,7 +184,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then
|
||||
end
|
||||
o.cfgvalue = get_cfgvalue(v.id, "main_node")
|
||||
o.write = get_write(v.id, "main_node")
|
||||
if auto_switch_flag == "main" and auto_switch_tip then
|
||||
if shunt_remark == "main" and auto_switch_tip then
|
||||
o.description = auto_switch_tip
|
||||
end
|
||||
|
||||
@ -233,7 +236,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then
|
||||
for k1, v1 in pairs(normal_list) do
|
||||
o:value(v1.id, v1.remark)
|
||||
end
|
||||
if auto_switch_flag == "default" and auto_switch_tip then
|
||||
if shunt_remark == "default" and auto_switch_tip then
|
||||
o.description = auto_switch_tip
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user