mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-08 13:14:12 +08:00
🌴 Sync 2026-10-16 01:08:07
This commit is contained in:
1 parent
f95bba4fb6
commit
16f740db5d
186 files changed
+9575
-5557
No files matched your search
@@ -75,6 +75,7 @@ function index()
|
||||
entry({"admin", "services", appname, "get_redir_log"}, call("get_redir_log")).leaf = true
|
||||
entry({"admin", "services", appname, "get_socks_log"}, call("get_socks_log")).leaf = true
|
||||
entry({"admin", "services", appname, "get_chinadns_log"}, call("get_chinadns_log")).leaf = true
|
||||
entry({"admin", "services", appname, "get_smartdns_log"}, call("get_smartdns_log")).leaf = true
|
||||
entry({"admin", "services", appname, "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "services", appname, "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "services", appname, "index_status"}, call("index_status")).leaf = true
|
||||
@@ -315,6 +316,16 @@ function get_chinadns_log()
|
||||
end
|
||||
end
|
||||
|
||||
function get_smartdns_log()
|
||||
local path = api.TMP_PATH .. "/acl/default/smartdns.log"
|
||||
http.prepare_content("text/plain; charset=utf-8")
|
||||
if fs.access(path) then
|
||||
http.write(luci.sys.exec("tail -n 5000 " .. util.shellquote(path)))
|
||||
else
|
||||
http.write(i18n.translate("Not enabled log"))
|
||||
end
|
||||
end
|
||||
|
||||
function get_log()
|
||||
-- luci.sys.exec("[ -f /tmp/log/passwall.log ] && sed '1!G;h;$!d' /tmp/log/passwall.log > /tmp/log/passwall_show.log")
|
||||
http.write(luci.sys.exec("[ -f '/tmp/log/passwall.log' ] && cat /tmp/log/passwall.log"))
|
||||
@@ -403,8 +414,8 @@ function index_status()
|
||||
local e = {}
|
||||
local dns_shunt = uci_get("@global[0]", "dns_shunt") or "dnsmasq"
|
||||
if dns_shunt == "smartdns" then
|
||||
local port = api.get_cache_var("SMARTDNS_LOCAL_PORT") or 0
|
||||
e.dns_mode_status = (port ~= 0) and luci.sys.call("netstat -apn | grep ':%s ' >/dev/null" % port) == 0 or false
|
||||
local config_file = api.TMP_PATH .. "/acl/default/smartdns.conf"
|
||||
e.dns_mode_status = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep -F %s | grep 'smartdns' >/dev/null" % util.shellquote(config_file)) == 0
|
||||
elseif dns_shunt == "chinadns-ng" then
|
||||
e.dns_mode_status = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep 'default' | grep 'chinadns_ng' >/dev/null" % api.TMP_PATH) == 0
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user