int
This commit is contained in:
parent
7c363a75a6
commit
e61a7f20f0
|
@ -1,17 +0,0 @@
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=luci-app-webdav
|
|
||||||
PKG_VERSION:=4.1.1
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
PKG_PO_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
|
|
||||||
|
|
||||||
PKG_LICENSE:=MIT
|
|
||||||
PKG_MAINTAINER:=hacdias <hacdias@icloud.com>
|
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI Support for webdav server
|
|
||||||
LUCI_PKGARCH:=all
|
|
||||||
LUCI_DEPENDS:=+webdav
|
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
|
||||||
|
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
|
|
@ -1,40 +0,0 @@
|
||||||
module("luci.controller.webdav", package.seeall)
|
|
||||||
|
|
||||||
function index()
|
|
||||||
if not nixio.fs.access("/etc/config/webdav") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local page
|
|
||||||
page = entry({"admin", "services", "webdav"}, alias("admin", "services", "webdav", "client"), _("WebDAV"), 10) -- 首页
|
|
||||||
page.dependent = true
|
|
||||||
page.acl_depends = { "luci-app-webdav" }
|
|
||||||
|
|
||||||
entry({"admin", "services", "webdav", "client"}, cbi("webdav/client"), _("Settings"), 10).leaf = true -- 客户端配置
|
|
||||||
entry({"admin", "services", "webdav", "log"}, form("webdav/log"), _("Log"), 30).leaf = true -- 日志页面
|
|
||||||
|
|
||||||
entry({"admin", "services", "webdav", "status"}, call("action_status")).leaf = true -- 运行状态
|
|
||||||
entry({"admin", "services", "webdav", "logtail"}, call("action_logtail")).leaf = true -- 日志采集
|
|
||||||
end
|
|
||||||
|
|
||||||
function action_status()
|
|
||||||
local e = {}
|
|
||||||
e.running = luci.sys.call("pidof webdav >/dev/null") == 0
|
|
||||||
e.application = luci.sys.exec("webdav --version")
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(e)
|
|
||||||
end
|
|
||||||
|
|
||||||
function action_logtail()
|
|
||||||
local fs = require "nixio.fs"
|
|
||||||
local log_path = "/var/log/webdav.log"
|
|
||||||
local e = {}
|
|
||||||
e.running = luci.sys.call("pidof 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,60 +0,0 @@
|
||||||
m = Map("webdav")
|
|
||||||
m.title = translate("AliyunDrive WebDAV")
|
|
||||||
m.description = translate("<a href=\"https://github.com/hacdias/webdav\" target=\"_blank\">Project GitHub URL</a>")
|
|
||||||
|
|
||||||
m:section(SimpleSection).template = "webdav/webdav_status"
|
|
||||||
|
|
||||||
e = m:section(TypedSection, "server")
|
|
||||||
e.anonymous = true
|
|
||||||
|
|
||||||
enable = e:option(Flag, "enable", translate("Enable"))
|
|
||||||
enable.rmempty = false
|
|
||||||
|
|
||||||
refresh_token = e:option(Value, "refresh_token", translate("Refresh Token"))
|
|
||||||
refresh_token.description = translate("<a href=\"https://github.com/hacdias/webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>")
|
|
||||||
|
|
||||||
root = e:option(Value, "root", translate("Root Directory"))
|
|
||||||
root.description = translate("Restrict access to a folder of aliyundrive, defaults to / which means no restrictions")
|
|
||||||
root.default = "/"
|
|
||||||
|
|
||||||
host = e:option(Value, "host", translate("Host"))
|
|
||||||
host.default = "0.0.0.0"
|
|
||||||
host.datatype = "ipaddr"
|
|
||||||
|
|
||||||
port = e:option(Value, "port", translate("Port"))
|
|
||||||
port.default = "8080"
|
|
||||||
port.datatype = "port"
|
|
||||||
|
|
||||||
tls_cert = e:option(Value, "tls_cert", translate("TLS certificate file path"))
|
|
||||||
tls_key = e:option(Value, "tls_key", translate("TLS private key file path"))
|
|
||||||
|
|
||||||
auth_user = e:option(Value, "auth_user", translate("Username"))
|
|
||||||
auth_password = e:option(Value, "auth_password", translate("Password"))
|
|
||||||
auth_password.password = true
|
|
||||||
|
|
||||||
read_buffer_size = e:option(Value, "read_buffer_size", translate("Read Buffer Size"))
|
|
||||||
read_buffer_size.default = "10485760"
|
|
||||||
read_buffer_size.datatype = "uinteger"
|
|
||||||
|
|
||||||
cache_size = e:option(Value, "cache_size", translate("Cache Size"))
|
|
||||||
cache_size.default = "1000"
|
|
||||||
cache_size.datatype = "uinteger"
|
|
||||||
|
|
||||||
cache_ttl = e:option(Value, "cache_ttl", translate("Cache Expiration Time (seconds)"))
|
|
||||||
cache_ttl.default = "600"
|
|
||||||
cache_ttl.datatype = "uinteger"
|
|
||||||
|
|
||||||
no_trash = e:option(Flag, "no_trash", translate("Delete file permanently instead of trashing"))
|
|
||||||
no_trash.rmempty = false
|
|
||||||
|
|
||||||
read_only = e:option(Flag, "read_only", translate("Enable read only mode"))
|
|
||||||
read_only.description = translate("Disallow upload, modify and delete file operations")
|
|
||||||
read_only.rmempty = false
|
|
||||||
|
|
||||||
domain_id = e:option(Value, "domain_id", translate("Domain ID"))
|
|
||||||
domain_id.description = translate("Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>")
|
|
||||||
|
|
||||||
debug = e:option(Flag, "debug", translate("Debug Mode"))
|
|
||||||
debug.rmempty = false
|
|
||||||
|
|
||||||
return m
|
|
|
@ -1,9 +0,0 @@
|
||||||
log = SimpleForm("logview")
|
|
||||||
log.submit = false
|
|
||||||
log.reset = false
|
|
||||||
|
|
||||||
t = log:field(DummyValue, '', '')
|
|
||||||
t.rawhtml = true
|
|
||||||
t.template = 'webdav/webdav_log'
|
|
||||||
|
|
||||||
return log
|
|
|
@ -1,21 +0,0 @@
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[webdav]], [[status]])%>', null,
|
|
||||||
function(x, data) {
|
|
||||||
var tb = document.getElementById('webdav_status');
|
|
||||||
if (data && tb) {
|
|
||||||
if (data.running) {
|
|
||||||
tb.innerHTML = '<em><b style=color:green>' + data.application + '<%:RUNNING%></b></em>';
|
|
||||||
} else {
|
|
||||||
tb.innerHTML = '<em><b style=color:red>' + data.application + '<%:NOT RUNNING%></b></em>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<p id="webdav_status">
|
|
||||||
<em><%:Collecting data...%></em>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<%+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", "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%>
|
|
|
@ -1,21 +0,0 @@
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[webdav]], [[status]])%>', null,
|
|
||||||
function(x, data) {
|
|
||||||
var tb = document.getElementById('webdav_status');
|
|
||||||
if (data && tb) {
|
|
||||||
if (data.running) {
|
|
||||||
tb.innerHTML = '<em><b style=color:green>' + data.application + '<%:RUNNING%></b></em>';
|
|
||||||
} else {
|
|
||||||
tb.innerHTML = '<em><b style=color:red>' + data.application + '<%:NOT RUNNING%></b></em>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<p id="webdav_status">
|
|
||||||
<em><%:Collecting data...%></em>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
|
@ -1,86 +0,0 @@
|
||||||
msgid ""
|
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
|
|
||||||
msgid "AliyunDrive"
|
|
||||||
msgstr "阿里云盘"
|
|
||||||
|
|
||||||
msgid "AliyunDrive WebDAV"
|
|
||||||
msgstr "阿里云盘 WebDAV"
|
|
||||||
|
|
||||||
msgid "Enable"
|
|
||||||
msgstr "启用"
|
|
||||||
|
|
||||||
msgid "Refresh Token"
|
|
||||||
msgstr "Refresh Token"
|
|
||||||
|
|
||||||
msgid "Root Directory"
|
|
||||||
msgstr "云盘根目录"
|
|
||||||
|
|
||||||
msgid "Host"
|
|
||||||
msgstr "监听主机"
|
|
||||||
|
|
||||||
msgid "Port"
|
|
||||||
msgstr "监听端口"
|
|
||||||
|
|
||||||
msgid "TLS certificate file path"
|
|
||||||
msgstr "TLS 证书文件路径"
|
|
||||||
|
|
||||||
msgid "TLS private key file path"
|
|
||||||
msgstr "TLS 私钥文件路径"
|
|
||||||
|
|
||||||
msgid "Username"
|
|
||||||
msgstr "用户名"
|
|
||||||
|
|
||||||
msgid "Password"
|
|
||||||
msgstr "密码"
|
|
||||||
|
|
||||||
msgid "Read Buffer Size"
|
|
||||||
msgstr "下载缓冲大小(bytes)"
|
|
||||||
|
|
||||||
msgid "Cache Size"
|
|
||||||
msgstr "目录缓存大小"
|
|
||||||
|
|
||||||
msgid "Cache Expiration Time (seconds)"
|
|
||||||
msgstr "目录缓存过期时间(单位为秒)"
|
|
||||||
|
|
||||||
msgid "Collecting data..."
|
|
||||||
msgstr "获取数据中..."
|
|
||||||
|
|
||||||
msgid "RUNNING"
|
|
||||||
msgstr "运行中"
|
|
||||||
|
|
||||||
msgid "NOT RUNNING"
|
|
||||||
msgstr "未运行"
|
|
||||||
|
|
||||||
msgid "Settings"
|
|
||||||
msgstr "设置"
|
|
||||||
|
|
||||||
msgid "Log"
|
|
||||||
msgstr "日志"
|
|
||||||
|
|
||||||
msgid "Debug Mode"
|
|
||||||
msgstr "调试模式"
|
|
||||||
|
|
||||||
msgid "<a href=\"https://github.com/hacdias/webdav\" target=\"_blank\">Project GitHub URL</a>"
|
|
||||||
msgstr "<a href=\"https://github.com/hacdias/webdav\" target=\"_blank\">GitHub 项目地址</a>"
|
|
||||||
|
|
||||||
msgid "<a href=\"https://github.com/hacdias/webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>"
|
|
||||||
msgstr "<a href=\"https://github.com/hacdias/webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">查看获取 refresh token 的方法</a>"
|
|
||||||
|
|
||||||
msgid "Restrict access to a folder of aliyundrive, defaults to / which means no restrictions"
|
|
||||||
msgstr "限制只能访问该云盘目录,默认为 / 表示不限制,注意这个参数不是本地磁盘路径"
|
|
||||||
|
|
||||||
msgid "Delete file permanently instead of trashing"
|
|
||||||
msgstr "删除文件不放入回收站"
|
|
||||||
|
|
||||||
msgid "Enable read only mode"
|
|
||||||
msgstr "启用只读模式"
|
|
||||||
|
|
||||||
msgid "Disallow upload, modify and delete file operations"
|
|
||||||
msgstr "禁止上传、修改和删除文件操作"
|
|
||||||
|
|
||||||
msgid "Domain ID"
|
|
||||||
msgstr "阿里云相册与云盘服务 domainId"
|
|
||||||
|
|
||||||
msgid "Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>"
|
|
||||||
msgstr "填写此选项将使用<a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">阿里云相册与网盘服务</a>而不是<a href=\"https://www.aliyundrive.com\" target=\"_blank\">阿里云盘</a>"
|
|
|
@ -1 +0,0 @@
|
||||||
zh-cn
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
uci -q batch <<-EOF >/dev/null
|
|
||||||
delete ucitrack.@webdav[-1]
|
|
||||||
add ucitrack webdav
|
|
||||||
set ucitrack.@webdav[-1].init=webdav
|
|
||||||
commit ucitrack
|
|
||||||
EOF
|
|
||||||
|
|
||||||
rm -f /tmp/luci-indexcache
|
|
||||||
exit 0
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"luci-app-webdav": {
|
|
||||||
"description": "Grant UCI access for luci-app-webdav",
|
|
||||||
"read": {
|
|
||||||
"uci": [ "webdav" ]
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"uci": [ "webdav" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue