From cba4222c572f421dd0ee31a1622351569f542edc Mon Sep 17 00:00:00 2001 From: actions-user Date: Wed, 23 Jul 2025 09:39:23 +0800 Subject: [PATCH] update 2025-07-23 09:39:23 --- .../luasrc/model/cbi/passwall/client/acl.lua | 2 - .../cbi/passwall/client/node_subscribe.lua | 11 +- .../passwall/client/node_subscribe_config.lua | 5 + .../model/cbi/passwall/client/other.lua | 2 - luci-app-passwall/luasrc/passwall/api.lua | 24 ++++ .../luasrc/view/passwall/acl/js.htm | 15 --- .../luasrc/view/passwall/haproxy/js.htm | 12 -- .../view/passwall/node_list/node_list.htm | 6 - .../view/passwall/node_subscribe/js.htm | 12 -- .../luasrc/view/passwall/other/js.htm | 15 --- .../view/passwall/rule/rule_version.htm | 12 -- .../passwall/server/users_list_status.htm | 5 - .../root/usr/share/passwall/rule_update.lua | 2 +- .../root/usr/share/passwall/rules/direct_host | 17 --- .../root/usr/share/passwall/subscribe.lua | 108 +++++++++++------- 15 files changed, 103 insertions(+), 145 deletions(-) delete mode 100644 luci-app-passwall/luasrc/view/passwall/acl/js.htm delete mode 100644 luci-app-passwall/luasrc/view/passwall/other/js.htm diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua index 0ed57d6..d825e87 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua @@ -100,6 +100,4 @@ o:value("1:65535", translate("All")) o:value("53", "53") ]]-- -m:append(Template(appname .. "/acl/js")) - return m diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua index 57e5949..9baef0d 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua @@ -59,6 +59,11 @@ function m.commit_handler(self) end) end +m.render = function(self, ...) + Map.render(self, ...) + api.optimize_cbi_ui() +end + o = s:option(ListValue, "filter_keyword_mode", translate("Filter keyword Mode")) o:value("0", translate("Close")) o:value("1", translate("Discard List")) @@ -134,8 +139,7 @@ end o = s:option(Button, "_update", translate("Manual subscription All")) o.inputstyle = "apply" function o.write(t, n) - luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start > /dev/null 2>&1 &") - m.no_commit = true + luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start all manual > /dev/null 2>&1 &") luci.http.redirect(api.url("log")) end @@ -203,8 +207,7 @@ end o = s:option(Button, "_update", translate("Manual subscription")) o.inputstyle = "apply" function o.write(t, n) - luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start " .. n .. " > /dev/null 2>&1 &") - m.no_commit = true + luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start " .. n .. " manual > /dev/null 2>&1 &") luci.http.redirect(api.url("log")) end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua index 2f5c9c7..67e8456 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua @@ -9,6 +9,11 @@ if not arg[1] or not m:get(arg[1]) then luci.http.redirect(m.redirect) end +m.render = function(self, ...) + Map.render(self, ...) + api.optimize_cbi_ui() +end + local has_ss = api.is_finded("ss-redir") local has_ss_rust = api.is_finded("sslocal") local has_trojan_plus = api.is_finded("trojan-plus") diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 8f556e6..85608a8 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -250,6 +250,4 @@ if has_singbox then o.description = translate("Override the connection destination address with the sniffed domain.
When enabled, traffic will match only by domain, ignoring IP rules.
If using shunt nodes, configure the domain shunt rules correctly.") end -m:append(Template(appname .. "/other/js")) - return m diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 3bc978d..772d881 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -1290,3 +1290,27 @@ function format_go_time(input) if s > 0 or result == "" then result = result .. s .. "s" end return result end + +function optimize_cbi_ui() + luci.http.write([[ + + ]]) +end diff --git a/luci-app-passwall/luasrc/view/passwall/acl/js.htm b/luci-app-passwall/luasrc/view/passwall/acl/js.htm deleted file mode 100644 index 0ff1a39..0000000 --- a/luci-app-passwall/luasrc/view/passwall/acl/js.htm +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm b/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm index 63011f4..9049096 100644 --- a/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm +++ b/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm @@ -45,17 +45,5 @@ } }, 300); }); - - //修正上移、下移按钮名称 - window.onload = function() { - var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up"); - var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down"); - for (var i = 0; i < ups.length; i++) { - ups[i].value = "<%:Move up%>"; - } - for (var i = 0; i < downs.length; i++) { - downs[i].value = "<%:Move down%>"; - } - } //]]> diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm index 2ffdc53..ef64aba 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm @@ -421,12 +421,6 @@ table td, .table .td { obj.port = port_dom.value; } - //修正上移、下移按钮名称 - var up = td.querySelector(".cbi-button-up"); - var down = td.querySelector(".cbi-button-down"); - if (up) up.value = "<%:Move up%>"; - if (down) down.value = "<%:Move down%>"; - node_count++; var add_from = document.getElementById("cbid.passwall." + id + ".add_from").value; if (node_list[add_from]) diff --git a/luci-app-passwall/luasrc/view/passwall/node_subscribe/js.htm b/luci-app-passwall/luasrc/view/passwall/node_subscribe/js.htm index d70e4ba..1dc361c 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_subscribe/js.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_subscribe/js.htm @@ -34,17 +34,5 @@ local api = require "luci.passwall.api" }); return false; } - - //修正上移、下移按钮名称 - window.onload = function() { - var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up"); - var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down"); - for (var i = 0; i < ups.length; i++) { - ups[i].value = "<%:Move up%>"; - } - for (var i = 0; i < downs.length; i++) { - downs[i].value = "<%:Move down%>"; - } - } //]]> diff --git a/luci-app-passwall/luasrc/view/passwall/other/js.htm b/luci-app-passwall/luasrc/view/passwall/other/js.htm deleted file mode 100644 index 0ff1a39..0000000 --- a/luci-app-passwall/luasrc/view/passwall/other/js.htm +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm b/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm index ac0b42f..e6fbe02 100644 --- a/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm +++ b/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm @@ -38,18 +38,6 @@ local geosite_update = api.uci_get_type("@global_rules[0]", "geosite_update", "1 } ); } - - //修正上移、下移按钮名称 - window.onload = function() { - var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up"); - var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down"); - for (var i = 0; i < ups.length; i++) { - ups[i].value = "<%:Move up%>"; - } - for (var i = 0; i < downs.length; i++) { - downs[i].value = "<%:Move down%>"; - } - } //]]>
diff --git a/luci-app-passwall/luasrc/view/passwall/server/users_list_status.htm b/luci-app-passwall/luasrc/view/passwall/server/users_list_status.htm index 69d37ab..8ba385a 100644 --- a/luci-app-passwall/luasrc/view/passwall/server/users_list_status.htm +++ b/luci-app-passwall/luasrc/view/passwall/server/users_list_status.htm @@ -29,11 +29,6 @@ local api = require "luci.passwall.api" //添加"日志"按钮 new_div += '' + '?id=' + id + '\', \'_blank\')"/>  '; td.innerHTML = new_div + td.innerHTML; - //修正上移、下移按钮名称 - var up = td.querySelector(".cbi-button-up"); - var down = td.querySelector(".cbi-button-down"); - if (up) up.value = "<%:Move up%>"; - if (down) down.value = "<%:Move down%>"; } catch(err) { console.error(err); diff --git a/luci-app-passwall/root/usr/share/passwall/rule_update.lua b/luci-app-passwall/root/usr/share/passwall/rule_update.lua index 1c2a0e7..0a85ebc 100755 --- a/luci-app-passwall/root/usr/share/passwall/rule_update.lua +++ b/luci-app-passwall/root/usr/share/passwall/rule_update.lua @@ -465,4 +465,4 @@ if reboot == 1 then uci:set(name, "@global[0]", "flush_set", "1") api.uci_save(uci, name, true, true) end -log("规则更新完毕...") +log("规则更新完毕...\n") diff --git a/luci-app-passwall/root/usr/share/passwall/rules/direct_host b/luci-app-passwall/root/usr/share/passwall/rules/direct_host index d45d9c7..0d7c701 100644 --- a/luci-app-passwall/root/usr/share/passwall/rules/direct_host +++ b/luci-app-passwall/root/usr/share/passwall/rules/direct_host @@ -43,20 +43,3 @@ gh-proxy.com gitmirror.com ghfast.top -# Synology ddns -account.synology.com -checkip.dyndns.org -checkip.synology.com -checkipv6.dyndns.org -checkipv6.synology.com -checkport.synology.com -ddns.synology.com - -# google -dl.google.com - -# github proxy -gh-proxy.com -gitmirror.com -ghfast.top - diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 8535476..4ab75a1 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -23,6 +23,7 @@ uci:revert(appname) local has_ss = api.is_finded("ss-redir") local has_ss_rust = api.is_finded("sslocal") +local has_ssr = api.is_finded("ssr-local") and api.is_finded("ssr-redir") local has_trojan_plus = api.is_finded("trojan-plus") local has_singbox = api.finded_com("sing-box") local has_xray = api.finded_com("xray") @@ -446,6 +447,10 @@ local function processData(szType, content, add_mode, add_from) } --ssr://base64(host:port:protocol:method:obfs:base64pass/?obfsparam=base64param&protoparam=base64param&remarks=base64remarks&group=base64group&udpport=0&uot=0) if szType == 'ssr' then + if not has_ssr then + log("跳过 SSR 节点,因未安装 SSR 核心程序 shadowsocksr-libev。") + return nil + end result.type = "SSR" local dat = split(content, "/%?") @@ -472,17 +477,13 @@ local function processData(szType, content, add_mode, add_from) result.remarks = base64Decode(params.remarks) elseif szType == 'vmess' then local info = jsonParse(content) - if has_singbox then - result.type = 'sing-box' - end - if has_xray then - result.type = 'Xray' - end if vmess_type_default == "sing-box" and has_singbox then result.type = 'sing-box' - end - if vmess_type_default == "xray" and has_xray then + elseif vmess_type_default == "xray" and has_xray then result.type = "Xray" + else + log("跳过 VMess 节点,因未适配到 VMess 核心程序,或未正确设置节点使用类型。") + return nil end result.alter_id = info.aid result.address = info.add @@ -590,7 +591,21 @@ local function processData(szType, content, add_mode, add_from) return nil end elseif szType == "ss" then - result.type = "SS" + if ss_type_default == "shadowsocks-libev" and has_ss then + result.type = "SS" + elseif ss_type_default == "shadowsocks-rust" and has_ss_rust then + result.type = 'SS-Rust' + elseif ss_type_default == "xray" and has_xray then + result.type = 'Xray' + result.protocol = 'shadowsocks' + result.transport = 'raw' + elseif ss_type_default == "sing-box" and has_singbox then + result.type = 'sing-box' + result.protocol = 'shadowsocks' + else + log("跳过 SS 节点,因未适配到 SS 核心程序,或未正确设置节点使用类型。") + return nil + end --SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" plugin ] [ "#" tag ] --userinfo = websafe-base64-encode-utf8(method ":" password) @@ -678,19 +693,6 @@ local function processData(szType, content, add_mode, add_from) result.method = method result.password = password - if ss_type_default == "shadowsocks-rust" and has_ss_rust then - result.type = 'SS-Rust' - end - if ss_type_default == "xray" and has_xray then - result.type = 'Xray' - result.protocol = 'shadowsocks' - result.transport = 'raw' - end - if ss_type_default == "sing-box" and has_singbox then - result.type = 'sing-box' - result.protocol = 'shadowsocks' - end - if result.type ~= "Xray" then result.method = (method:lower() == "chacha20-poly1305" and "chacha20-ietf-poly1305") or (method:lower() == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or method @@ -884,10 +886,15 @@ local function processData(szType, content, add_mode, add_from) result.type = "Trojan-Plus" elseif trojan_type_default == "sing-box" and has_singbox then result.type = 'sing-box' + result.protocol = 'trojan' elseif trojan_type_default == "xray" and has_xray then result.type = 'Xray' + result.protocol = 'trojan' + else + log("跳过 Trojan 节点,因未适配到 Trojan 核心程序,或未正确设置节点使用类型。") + return nil end - result.protocol = 'trojan' + local alias = "" if content:find("#") then local idx_sp = content:find("#") @@ -1043,17 +1050,13 @@ local function processData(szType, content, add_mode, add_from) result.group = content.airport result.remarks = content.remarks elseif szType == "vless" then - if has_singbox then - result.type = 'sing-box' - end - if has_xray then - result.type = 'Xray' - end if vless_type_default == "sing-box" and has_singbox then result.type = 'sing-box' - end - if vless_type_default == "xray" and has_xray then + elseif vless_type_default == "xray" and has_xray then result.type = "Xray" + else + log("跳过 VLESS 节点,因未适配到 VLESS 核心程序,或未正确设置节点使用类型。") + return nil end result.protocol = "vless" local alias = "" @@ -1216,6 +1219,14 @@ local function processData(szType, content, add_mode, add_from) end end elseif szType == 'hysteria' then + if has_singbox then + result.type = 'sing-box' + result.protocol = "hysteria" + else + log("跳过 Hysteria 节点,因未安装 Hysteria 核心程序 Sing-box。") + return nil + end + local alias = "" if content:find("#") then local idx_sp = content:find("#") @@ -1263,10 +1274,6 @@ local function processData(szType, content, add_mode, add_from) result.hysteria_down_mbps = params.downmbps result.hysteria_hop = params.mport - if has_singbox then - result.type = 'sing-box' - result.protocol = "hysteria" - end elseif szType == 'hysteria2' or szType == 'hy2' then local alias = "" if content:find("#") then @@ -1326,8 +1333,19 @@ local function processData(szType, content, add_mode, add_from) if params["obfs-password"] or params["obfs_password"] then result.hysteria2_obfs = params["obfs-password"] or params["obfs_password"] end + else + log("跳过 Hysteria2 节点,因未适配到 Hysteria2 核心程序,或未正确设置节点使用类型。") + return nil end elseif szType == 'tuic' then + if has_singbox then + result.type = 'sing-box' + result.protocol = "tuic" + else + log("跳过 Tuic 节点,因未安装 Tuic 核心程序 Sing-box。") + return nil + end + local alias = "" if content:find("#") then local idx_sp = content:find("#") @@ -1380,11 +1398,15 @@ local function processData(szType, content, add_mode, add_from) else result.tls_allowInsecure = allowInsecure_default and "1" or "0" end - result.type = 'sing-box' - result.protocol = "tuic" elseif szType == "anytls" then - result.type = 'sing-box' - result.protocol = "anytls" + if has_singbox then + result.type = 'sing-box' + result.protocol = "anytls" + else + log("跳过 AnyTLS 节点,因未安装 AnyTLS 核心程序 Sing-box 1.12。") + return nil + end + local alias = "" if content:find("#") then local idx_sp = content:find("#") @@ -1812,7 +1834,7 @@ local execute = function() do local subscribe_list = {} local fail_list = {} - if arg[2] then + if arg[2] ~= "all" then string.gsub(arg[2], '[^' .. "," .. ']+', function(w) subscribe_list[#subscribe_list + 1] = uci:get_all(appname, w) or {} end) @@ -1822,6 +1844,8 @@ local execute = function() end) end + local manual_sub = arg[3] == "manual" + for index, value in ipairs(subscribe_list) do local cfgid = value[".name"] local remark = value.remark @@ -1890,7 +1914,7 @@ local execute = function() local old_md5 = value.md5 or "" local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "") os.remove(tmp_file) - if old_md5 == new_md5 then + if not manual_sub and old_md5 == new_md5 then log('订阅:【' .. remark .. '】没有变化,无需更新。') else parse_link(raw_data, "2", remark, cfgid) @@ -1930,7 +1954,7 @@ if arg[1] then end log('发生错误, 正在恢复服务') end) - log('订阅完毕...') + log('订阅完毕...\n') elseif arg[1] == "add" then local f = assert(io.open("/tmp/links.conf", 'r')) local raw = f:read('*all')