mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-12 07:37:51 +08:00
update 2026-07-28 01:38:11
This commit is contained in:
1 parent
20b786ab77
commit
25d570431d
6243 files changed
+2850542
No files matched your search
@@ -0,0 +1,29 @@
|
||||
local http = require "luci.http"
|
||||
|
||||
module("luci.controller.baidudrive", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/baidudrive") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "baidudrive"}, cbi("baidudrive"), _("BaiduDrive"), 100)
|
||||
page.dependent = true
|
||||
entry({"admin", "services", "baidudrive_status"}, call("baidudrive_status"))
|
||||
end
|
||||
|
||||
function baidudrive_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local port = uci:get_first("baidudrive", "baidudrive", "port") or "10780"
|
||||
local app_running = (sys.call("pidof baidudrive >/dev/null") == 0)
|
||||
local sdk_running = (sys.call("pidof baiduNas >/dev/null") == 0)
|
||||
local status = {
|
||||
running = app_running and sdk_running,
|
||||
app_running = app_running,
|
||||
sdk_running = sdk_running,
|
||||
port = port
|
||||
}
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(status)
|
||||
end
|
||||
Reference in new issue
Block a user