mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-07 20:54:20 +08:00
update 2026-05-12 22:20:49
This commit is contained in:
1 parent
33be405a88
commit
1b6001bfed
1854 files changed
+96
-749039
No files matched your search
@@ -1,49 +0,0 @@
|
||||
-- Copyright 2018-2022 Lienol <lawlienol@gmail.com>
|
||||
module("luci.controller.kodexplorer", package.seeall)
|
||||
|
||||
local http = require "luci.http"
|
||||
local api = require "luci.model.cbi.kodexplorer.api"
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/kodexplorer") then return end
|
||||
|
||||
entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false
|
||||
|
||||
e = entry({"admin", "nas", "kodexplorer"}, cbi("kodexplorer/settings"), _("KodExplorer"), 3)
|
||||
e.dependent = true
|
||||
e.acl_depends = { "luci-app-kodexplorer" }
|
||||
|
||||
entry({"admin", "nas", "kodexplorer", "check"}, call("action_check")).leaf = true
|
||||
entry({"admin", "nas", "kodexplorer", "download"}, call("action_download")).leaf = true
|
||||
entry({"admin", "nas", "kodexplorer", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
local function http_write_json(content)
|
||||
http.prepare_content("application/json")
|
||||
http.write_json(content or {code = 1})
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.nginx_status = luci.sys.call("busybox ps -w | grep nginx | grep kodexplorer | grep -v grep > /dev/null") == 0
|
||||
e.php_status = luci.sys.call("busybox ps -w | grep php | grep kodexplorer | grep -v grep > /dev/null") == 0
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
function action_check()
|
||||
local json = api.to_check()
|
||||
http_write_json(json)
|
||||
end
|
||||
|
||||
function action_download()
|
||||
local json = nil
|
||||
local task = http.formvalue("task")
|
||||
if task == "extract" then
|
||||
json = api.to_extract(http.formvalue("file"))
|
||||
elseif task == "move" then
|
||||
json = api.to_move(http.formvalue("file"))
|
||||
else
|
||||
json = api.to_download(http.formvalue("url"))
|
||||
end
|
||||
http_write_json(json)
|
||||
end
|
||||
Reference in new issue
Block a user