mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 02:51:50 +00:00
Fix status display and check multi vpn
This commit is contained in:
parent
5542785a71
commit
6c73959f41
2 changed files with 31 additions and 4 deletions
|
@ -177,7 +177,8 @@
|
|||
{
|
||||
statusMessageClass = "error";
|
||||
statusIcon = "<%=resource%>/openmptcprouter/images/statusError.png";
|
||||
} else {
|
||||
} else if (mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.socks_service_enabled == false)
|
||||
{
|
||||
statusMessage += _('ShadowSocks is DISABLED') + '<br/>';
|
||||
|
|
|
@ -775,12 +775,18 @@ function interfaces_status()
|
|||
end
|
||||
else
|
||||
mArray.openmptcprouter["vps_admin"] = false
|
||||
mArray.openmptcprouter["vps_admin_error_msg"] = "No answer"
|
||||
mArray.openmptcprouter["vps_admin_error_msg"] = "No result"
|
||||
end
|
||||
else
|
||||
mArray.openmptcprouter["vps_admin"] = false
|
||||
mArray.openmptcprouter["vps_admin_error_msg"] = "No token yet available"
|
||||
end
|
||||
if mArray.openmptcprouter["vps_admin"] == false then
|
||||
local vpstest = sys.exec('curl -4 --max-time ' .. timeout .. ' -s -k https://' .. serverip .. ':' .. adminport .. '/')
|
||||
if vpstest == "" then
|
||||
mArray.openmptcprouter["vps_admin_error_msg"] = mArray.openmptcprouter["vps_admin_error_msg"] .. " - No API script answer"
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -790,8 +796,8 @@ function interfaces_status()
|
|||
end
|
||||
-- Check openmptcprouter service are running
|
||||
mArray.openmptcprouter["tun_service"] = false
|
||||
mArray.openmptcprouter["tun_state"] = ""
|
||||
mArray.openmptcprouter["tun6_state"] = ""
|
||||
mArray.openmptcprouter["tun_state"] = "DOWN"
|
||||
mArray.openmptcprouter["tun6_state"] = "DOWN"
|
||||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
||||
mArray.openmptcprouter["tun_service"] = true
|
||||
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
||||
|
@ -831,6 +837,26 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["tun_service"] = true
|
||||
end
|
||||
|
||||
mArray.openmptcprouter["multi_vpn"] = false
|
||||
if uci:get("openmptcprouter","settings","vpn") ~= "none" then
|
||||
current_vpn = uci:get("openmptcprouter","settings","vpn")
|
||||
if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "tcp" and current_vpn ~= "glorytun_tcp" then
|
||||
mArray.openmptcprouter["multi_vpn"] = true
|
||||
end
|
||||
if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "udp" and current_vpn ~= "glorytun_udp" then
|
||||
mArray.openmptcprouter["multi_vpn"] = true
|
||||
end
|
||||
if uci:get("dsvpn","vpn","enable") == "1" and current_vpn ~= "dsvpn" then
|
||||
mArray.openmptcprouter["multi_vpn"] = true
|
||||
end
|
||||
if uci:get("mlvpn","general","enable") == "1" and current_vpn ~= "mlvpn" then
|
||||
mArray.openmptcprouter["multi_vpn"] = true
|
||||
end
|
||||
if uci:get("openvpn","omr","enabled") == "1" and current_vpn ~= "openvpn" then
|
||||
mArray.openmptcprouter["multi_vpn"] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- check Shadowsocks is running
|
||||
mArray.openmptcprouter["socks_service"] = false
|
||||
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then
|
||||
|
|
Loading…
Reference in a new issue