mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
luci-app-go-aliyundrive-webdav: sync upstream (#8228)
This commit is contained in:
parent
7addb7e937
commit
2d8602fd87
@ -7,11 +7,12 @@ function index()
|
|||||||
if not nixio.fs.access("/etc/config/go-aliyundrive-webdav") then
|
if not nixio.fs.access("/etc/config/go-aliyundrive-webdav") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
entry({"admin", "services", "go-aliyundrive-webdav"}, alias("admin", "services", "go-aliyundrive-webdav", "client"),_("Go AliyunDrive WebDAV"), 10).dependent = true -- 首页
|
entry({"admin", "services", "go-aliyundrive-webdav"}, alias("admin", "services", "go-aliyundrive-webdav", "client"), _("Go AliyunDrive WebDAV"), 10).dependent = true -- 首页
|
||||||
entry({"admin", "services", "go-aliyundrive-webdav", "client"}, cbi("go-aliyundrive-webdav/client"),_("Settings"), 1).leaf = true -- 客户端配置
|
entry({"admin", "services", "go-aliyundrive-webdav", "client"}, cbi("go-aliyundrive-webdav/client"), _("Settings"), 1).leaf = true -- 客户端配置
|
||||||
entry({"admin", "services", "go-aliyundrive-webdav", "log"}, cbi("go-aliyundrive-webdav/log"),_("Log"), 2).leaf = true -- 日志页面
|
entry({"admin", "services", "go-aliyundrive-webdav", "log"}, cbi("go-aliyundrive-webdav/log"), _("Log"), 2).leaf = true -- 日志页面
|
||||||
|
|
||||||
entry({"admin", "services", "go-aliyundrive-webdav", "status"}, call("action_status")).leaf = true
|
entry({"admin", "services", "go-aliyundrive-webdav", "status"}, call("action_status")).leaf = true
|
||||||
|
entry({"admin", "services", "go-aliyundrive-webdav", "logtail"}, call("action_logtail")).leaf = true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -21,3 +22,17 @@ function action_status()
|
|||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function action_logtail()
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
local log_path = "/var/log/go-aliyundrive-webdav.log"
|
||||||
|
local e = {}
|
||||||
|
e.running = luci.sys.call("pidof go-aliyundrive-webdav >/dev/null") == 0
|
||||||
|
if fs.access(log_path) then
|
||||||
|
e.log = luci.sys.exec("tail -n 100 %s | sed 's/\\x1b\\[[0-9;]*m//g'" % log_path)
|
||||||
|
else
|
||||||
|
e.log = ""
|
||||||
|
end
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(e)
|
||||||
|
end
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
m = Map("log")
|
log = SimpleForm("logview")
|
||||||
m.title = translate("Detailed Log (In Development)")
|
log.submit = false
|
||||||
|
log.reset = false
|
||||||
|
|
||||||
return m
|
t = log:field(DummyValue, '', '')
|
||||||
|
t.rawhtml = true
|
||||||
|
t.template = 'go-aliyundrive-webdav/go-aliyundrive-webdav_log'
|
||||||
|
|
||||||
|
return log
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
<%+cbi/valueheader%>
|
||||||
|
<textarea id="logview" class="cbi-input-textarea" style="width: 100%" rows="30" readonly="readonly"></textarea>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
const LOG_URL = '<%=luci.dispatcher.build_url("admin", "services", "go-aliyundrive-webdav", "logtail")%>';
|
||||||
|
XHR.poll(1, LOG_URL, null, (x, d) => {
|
||||||
|
let logview = document.getElementById("logview");
|
||||||
|
if (!d.running) {
|
||||||
|
XHR.halt();
|
||||||
|
}
|
||||||
|
logview.value = d.log;
|
||||||
|
logview.scrollTop = logview.scrollHeight;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<%+cbi/valuefooter%>
|
@ -43,9 +43,6 @@ msgstr "设置"
|
|||||||
msgid "Log"
|
msgid "Log"
|
||||||
msgstr "日志"
|
msgstr "日志"
|
||||||
|
|
||||||
msgid "Detailed Log (In Development)"
|
|
||||||
msgstr "详细日志(开发中)"
|
|
||||||
|
|
||||||
msgid "Enable detailed logging"
|
msgid "Enable detailed logging"
|
||||||
msgstr "启用详细日志记录"
|
msgstr "启用详细日志记录"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user