@@ -19,6 +19,12 @@ function act_status()
local e={}
binpath=uci:get("AdGuardHome","AdGuardHome","binpath")
e.running=luci.sys.call("pgrep "..binpath.." >/dev/null")==0
+ st=nixio.fs.readfile("/var/run/AdGredir")
+ if (st=="0") then
+ e.redirect=false
+ else
+ e.redirect=true
+ end
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
@@ -4,11 +4,16 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[status]])%>', nu
var tb = document.getElementById('AdGuardHome_status');
if (data && tb) {
if (data.running) {
- var links = '<em><b><font color=green>AdGuardHome <%:RUNNING%></font></b></em>';
- tb.innerHTML = links;
+ tb.innerHTML = '<em><b><font color=green>AdGuardHome <%:RUNNING%></font></b></em>';
} else {
tb.innerHTML = '<em><b><font color=red>AdGuardHome <%:NOT RUNNING%></font></b></em>';
}
+ if (data.redirect)
+ {
+ tb.innerHTML+='<em><b><font color=green><%:Redirected%></font></b></em>'
+ } else {
+ tb.innerHTML+='<em><b><font color=red><%:Not redirect%></font></b></em>'
+ }
);
@@ -181,6 +181,11 @@ do_redirect()
ipv6_server=1
tcp_server=0
enabled=$1
+ if [ "$enabled" == "1" ]; then
+ echo -n "1">/var/run/AdGredir
+ echo -n "0">/var/run/AdGredir
+ fi
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
AdGuardHome_PORT=$(awk '/ port:/{printf($2)}' $configpath)
if [ -z "$AdGuardHome_PORT" ]; then