瀏覽代碼

precise running test

rufengsuixing 5 年之前
父節點
當前提交
9274f619f2
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      luasrc/controller/AdGuardHome.lua

+ 3 - 4
luasrc/controller/AdGuardHome.lua

@@ -1,9 +1,7 @@
 module("luci.controller.AdGuardHome",package.seeall)
 module("luci.controller.AdGuardHome",package.seeall)
 nixio=require"nixio"
 nixio=require"nixio"
+local uci=require"luci.model.uci".cursor()
 function index()
 function index()
-if not nixio.fs.access("/etc/config/AdGuardHome")then
-return
-end
 	entry({"admin","services","AdGuardHome"},firstchild(),_("AdGuard Home"),30).dependent=true
 	entry({"admin","services","AdGuardHome"},firstchild(),_("AdGuard Home"),30).dependent=true
 	entry({"admin","services","AdGuardHome","general"},cbi("AdGuardHome"),_("Base Setting"),1)
 	entry({"admin","services","AdGuardHome","general"},cbi("AdGuardHome"),_("Base Setting"),1)
     entry({"admin","services","AdGuardHome","log"},form("AdGuardHomelog"),_("Log"),2)
     entry({"admin","services","AdGuardHome","log"},form("AdGuardHomelog"),_("Log"),2)
@@ -14,7 +12,8 @@ end
 
 
 function act_status()
 function act_status()
   local e={}
   local e={}
-  e.running=luci.sys.call("pgrep -f AdGuardHome >/dev/null")==0
+  binpath=uci:get("AdGuardHome","AdGuardHome","binpath")
+  e.running=luci.sys.call("pgrep "..binpath.." >/dev/null")==0
   luci.http.prepare_content("application/json")
   luci.http.prepare_content("application/json")
   luci.http.write_json(e)
   luci.http.write_json(e)
 end
 end