update 2024-05-27 12:21:29

This commit is contained in:
kenzok8 2024-05-27 12:21:29 +08:00
parent ee1d7ef1f1
commit c8f008857a
1 changed files with 9 additions and 11 deletions

View File

@ -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_appconnect}" ' .. url)