From 5ef797d8f79bd26228b847b5186845355555818c Mon Sep 17 00:00:00 2001 From: actions Date: Mon, 27 May 2024 12:00:05 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/75d154dfc4fc120a4ab41ff8ac76dc7825ca5bd6 --- .../luasrc/controller/passwall.lua | 20 +++++++++---------- patch-luci-app-passwall.patch | 6 +++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index 9043e61b6..7c71fff41 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -250,19 +250,17 @@ 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 baidu = string.find(url, "baidu") + local enabled = uci:get(appname, "@global[0]", "enabled") local chn_list = uci:get(appname, "@global[0]", "chn_list") + local gfw_list = uci:get(appname, "@global[0]", "use_gfw_list") or "1" + local proxy_mode = uci:get(appname, "@global[0]", "tcp_proxy_mode") 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 + if enabled ~= 0 then + if (chn_list == "proxy" and gfw_list == 0 and proxy_mode ~= "proxy" and baidu ~= nil) or (chn_list == 0 and gfw_list == 0 and proxy_mode == "proxy") then + url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url + elseif baidu == nil then + url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url end end local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_starttransfer}" ' .. url) diff --git a/patch-luci-app-passwall.patch b/patch-luci-app-passwall.patch index 7d14184e0..7c6de78cd 100644 --- a/patch-luci-app-passwall.patch +++ b/patch-luci-app-passwall.patch @@ -11,11 +11,11 @@ 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 8c8be28..9043e61 100644 +index e52338c..7c71fff 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua -@@ -265,7 +265,7 @@ function connect_status() - end +@@ -263,7 +263,7 @@ function connect_status() + url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url end end - local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_appconnect}" ' .. url)