update 2022-05-08 16:49:28

This commit is contained in:
github-actions[bot] 2022-05-08 16:49:28 +08:00
parent 457546db48
commit 171e83e327
3 changed files with 76 additions and 73 deletions

View File

@ -1,20 +1,22 @@
module("luci.controller.filebrowser", package.seeall)
function index()
if not nixio.fs.access("/etc/config/filebrowser") then
return
end
entry({"admin", "nas"}, firstchild(), _("NAS") , 45).dependent = false
local page
page = entry({"admin", "nas", "filebrowser"}, cbi("filebrowser"), _("文件管理器"), 100)
page.dependent = true
page.acl_depends = { "luci-app-filebrowser" }
entry({"admin","nas","filebrowser","status"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep filebrowser >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
module("luci.controller.filebrowser", package.seeall)
function index()
if not nixio.fs.access("/etc/config/filebrowser") then
return
end
entry({"admin", "nas"}, firstchild(), _("NAS"), 45).dependent = false
local page = entry({"admin", "nas", "filebrowser"}, cbi("filebrowser"), _("文件管理器"), 100)
page.dependent = true
page.acl_depends = { "luci-app-filebrowser" }
entry({"admin", "nas", "filebrowser", "status"}, call("act_status")).leaf = true
end
function act_status()
local e = {}
e.running = luci.sys.call("pgrep filebrowser >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -1,42 +1,43 @@
m = Map("filebrowser", translate("文件管理器"), translate("FileBrowser是一个基于Go的在线文件管理器助您方便的管理设备上的文件。"))
m:section(SimpleSection).template = "filebrowser/filebrowser_status"
s = m:section(TypedSection, "filebrowser")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enabled", translate("启用"))
enable.rmempty = false
o = s:option(ListValue, "addr_type", translate("监听地址"))
o:value("local", translate("监听本机地址"))
o:value("lan", translate("监听局域网地址"))
o:value("wan", translate("监听全部地址"))
o.default = "lan"
o.rmempty = false
o = s:option(Value, "port", translate("监听端口"))
o.placeholder = 8989
o.default = 8989
o.datatype = "port"
o.rmempty = false
o = s:option(Value, "root_dir", translate("开放目录"))
o.placeholder = "/"
o.default = "/"
o.rmempty = false
o = s:option(Value, "db_dir", translate("数据库目录"))
o.placeholder = "/etc"
o.default = "/etc"
o.rmempty = false
o.description = translate("普通用户请勿随意更改")
o = s:option(Value, "db_name", translate("数据库名"))
o.placeholder = "filebrowser.db"
o.default = "filebrowser.db"
o.rmempty = false
o.description = translate("普通用户请勿随意更改")
return m
m = Map("filebrowser", translate("文件管理器"))
m.description = translate("FileBrowser是一个基于Go的在线文件管理器助您方便的管理设备上的文件。")
m:section(SimpleSection).template = "filebrowser/filebrowser_status"
s = m:section(TypedSection, "filebrowser")
s.addremove = false
s.anonymous = true
o = s:option(Flag, "enabled", translate("启用"))
o.rmempty = false
o = s:option(ListValue, "addr_type", translate("监听地址"))
o:value("local", translate("监听本机地址"))
o:value("lan", translate("监听局域网地址"))
o:value("wan", translate("监听全部地址"))
o.default = "lan"
o.rmempty = false
o = s:option(Value, "port", translate("监听端口"))
o.placeholder = 8989
o.default = 8989
o.datatype = "port"
o.rmempty = false
o = s:option(Value, "root_dir", translate("开放目录"))
o.placeholder = "/"
o.default = "/"
o.rmempty = false
o = s:option(Value, "db_dir", translate("数据库目录"))
o.description = translate("普通用户请勿随意更改")
o.placeholder = "/etc"
o.default = "/etc"
o.rmempty = false
o = s:option(Value, "db_name", translate("数据库名"))
o.description = translate("普通用户请勿随意更改")
o.placeholder = "filebrowser.db"
o.default = "filebrowser.db"
o.rmempty = false
return m

View File

@ -1,11 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@filebrowser[-1]
add ucitrack filebrowser
set ucitrack.@filebrowser[-1].init=filebrowser
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@filebrowser[-1]
add ucitrack filebrowser
set ucitrack.@filebrowser[-1].init=filebrowser
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0