mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 22:12:51 +08:00
26 lines
655 B
Lua
26 lines
655 B
Lua
local http = require "luci.http"
|
|
|
|
module("luci.controller.aihelper", package.seeall)
|
|
|
|
function index()
|
|
if not nixio.fs.access("/etc/config/aihelper") then
|
|
return
|
|
end
|
|
local page
|
|
page = entry({"admin", "services","aihelper"}, cbi("aihelper"), _("AiHelper"), 100)
|
|
page.dependent = true
|
|
entry({"admin", "services", "aihelper_status"}, call("aihelper_status"))
|
|
|
|
end
|
|
|
|
function aihelper_status()
|
|
local sys = require "luci.sys"
|
|
local uci = require "luci.model.uci".cursor()
|
|
local status = {
|
|
running = (sys.call("pidof aihelper >/dev/null") == 0),
|
|
port = 9310
|
|
}
|
|
luci.http.prepare_content("application/json")
|
|
luci.http.write_json(status)
|
|
end
|