From 35cddc6a5c06bb60187996af53270e6f4feefb07 Mon Sep 17 00:00:00 2001 From: actions Date: Sun, 19 May 2024 06:03:19 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/c62cdc51e470d3f0db668a2b8a201c7502c192fa Signed-off-by: actions --- .../luasrc/controller/passwall.lua | 15 +++++++++++++++ .../model/cbi/passwall/client/acl_config.lua | 4 +++- .../model/cbi/passwall/client/global.lua | 4 +++- patch-luci-app-passwall.patch | 18 +++++++++--------- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index ba7116caf..9043e61b6 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -250,6 +250,21 @@ function connect_status() local e = {} e.use_time = "" local url = luci.http.formvalue("url") + local is_baidu = string.find(url, "baidu") + local pw_switch = uci:get(appname, "@global[0]", "enabled") + local chn_list = uci:get(appname, "@global[0]", "chn_list") + local socks_port = uci:get(appname, "@global[0]", "tcp_node_socks_port") + if pw_switch ~= 0 then + if chn_list == "proxy" then + if is_baidu ~= nil then + url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url + end + else + if is_baidu == nil then + url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url + end + end + end local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_starttransfer}" ' .. url) local code = tonumber(luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $1}'") or "0") if code ~= 0 then diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua index 96e49cc1f..6b10651fe 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua @@ -316,6 +316,7 @@ o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)") o:value("8.8.4.4", "8.8.4.4 (Google)") o:value("8.8.8.8", "8.8.8.8 (Google)") o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)") +o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)") o:value("208.67.220.220", "208.67.220.220 (OpenDNS)") o:value("208.67.222.222", "208.67.222.222 (OpenDNS)") o:depends({dns_mode = "dns2socks"}) @@ -329,7 +330,8 @@ if has_singbox or has_xray then o:value("https://1.1.1.2/dns-query", "CloudFlare-Security") o:value("https://8.8.4.4/dns-query", "Google 8844") o:value("https://8.8.8.8/dns-query", "Google 8888") - o:value("https://9.9.9.9/dns-query", "Quad9-Recommended") + o:value("https://9.9.9.9/dns-query", "Quad9-Recommended 9.9.9.9") + o:value("https://149.112.112.112/dns-query", "Quad9-Recommended 149.112.112.112") o:value("https://208.67.222.222/dns-query", "OpenDNS") o:value("https://dns.adguard.com/dns-query,176.103.130.130", "AdGuard") o:value("https://doh.libredns.gr/dns-query,116.202.176.26", "LibreDNS") 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 f95454d51..1204cbe83 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -329,6 +329,7 @@ o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)") o:value("8.8.4.4", "8.8.4.4 (Google)") o:value("8.8.8.8", "8.8.8.8 (Google)") o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)") +o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)") o:value("208.67.220.220", "208.67.220.220 (OpenDNS)") o:value("208.67.222.222", "208.67.222.222 (OpenDNS)") if nixio.fs.access("/usr/share/mosdns/mosdns.sh") then @@ -351,7 +352,8 @@ o:value("https://1.1.1.1/dns-query", "CloudFlare") o:value("https://1.1.1.2/dns-query", "CloudFlare-Security") o:value("https://8.8.4.4/dns-query", "Google 8844") o:value("https://8.8.8.8/dns-query", "Google 8888") -o:value("https://9.9.9.9/dns-query", "Quad9-Recommended") +o:value("https://9.9.9.9/dns-query", "Quad9-Recommended 9.9.9.9") +o:value("https://149.112.112.112/dns-query", "Quad9-Recommended 149.112.112.112") o:value("https://208.67.222.222/dns-query", "OpenDNS") o:value("https://dns.adguard.com/dns-query,176.103.130.130", "AdGuard") o:value("https://doh.libredns.gr/dns-query,116.202.176.26", "LibreDNS") diff --git a/patch-luci-app-passwall.patch b/patch-luci-app-passwall.patch index c259e3ec2..e5c2559cf 100644 --- a/patch-luci-app-passwall.patch +++ b/patch-luci-app-passwall.patch @@ -11,13 +11,13 @@ index 1fb70f5..e1a5538 100644 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua -index 1920a9c..ba7116c 100644 +index 8c8be28..9043e61 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua -@@ -250,7 +250,7 @@ function connect_status() - local e = {} - e.use_time = "" - local url = luci.http.formvalue("url") +@@ -265,7 +265,7 @@ function connect_status() + end + end + end - local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_appconnect}" ' .. url) + local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_starttransfer}" ' .. url) local code = tonumber(luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $1}'") or "0") @@ -36,7 +36,7 @@ index c303efe..6b4319e 100644 s = m:section(TypedSection, "global", translate("ACLs"), "" .. translate("ACLs is a tools which used to designate specific IP proxy mode.") .. "") s.anonymous = true diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua -index e355bc9..96e49cc 100644 +index 22a76c6..6b10651 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua @@ -13,7 +13,6 @@ local port_validate = function(self, value, t) @@ -60,7 +60,7 @@ index 8a59a43..9d47562 100644 -- [[ App Settings ]]-- s = m:section(TypedSection, "global_app", translate("App Update"), 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 f830888..f95454d 100644 +index d2b8593..1204cbe 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -9,7 +9,6 @@ local has_chnlist = api.fs.access("/usr/share/passwall/rules/chnlist") @@ -71,8 +71,8 @@ index f830888..f95454d 100644 local nodes_table = {} for k, e in ipairs(api.get_valid_nodes()) do -@@ -332,6 +331,12 @@ o:value("8.8.8.8", "8.8.8.8 (Google)") - o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)") +@@ -333,6 +332,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)") + o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)") o:value("208.67.220.220", "208.67.220.220 (OpenDNS)") o:value("208.67.222.222", "208.67.222.222 (OpenDNS)") +if nixio.fs.access("/usr/share/mosdns/mosdns.sh") then