luci-app-passwall: sync upstream

last commit: 75d154dfc4
This commit is contained in:
actions 2024-05-27 12:00:05 +08:00
parent ef07b93463
commit 5ef797d8f7
2 changed files with 12 additions and 14 deletions

View File

@ -250,21 +250,19 @@ 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
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
end
else
if is_baidu == nil then
elseif 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

View File

@ -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)