mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 18:03:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
Executable
+17
@@ -0,0 +1,17 @@
|
||||
module("luci.controller.webd",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/webd") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "nas", "webd"}, cbi("webd"), _("Webd Netdisk"),99)
|
||||
entry({"admin", "nas", "webd", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep webd > /dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
m = Map("webd", translate("Webd Netdisk"),
|
||||
translate("Webd - A lightweight self hosted netdisk")
|
||||
.. [[ <a href="https://webd.cf/">]]
|
||||
.. translate("Official Website")
|
||||
.. [[</a>]]
|
||||
)
|
||||
|
||||
m:section(SimpleSection).template = "webd/webd_status"
|
||||
|
||||
s = m:section(TypedSection, "webd", translate("Basic Settings"), translate("Set the basic settings of Webd"))
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag, "enable", translate("Enable"))
|
||||
enable.default = 0
|
||||
|
||||
port = s:option(Value, "webd_port", translate("Listening Port"))
|
||||
port.datatype = "port"
|
||||
port.default = "9212"
|
||||
port.rmempty = false
|
||||
|
||||
enable_ipv6 = s:option(Flag, "enable_ipv6", translate("Listen IPv6"), translatef("Listen both IPv4 and IPv6 Address"))
|
||||
enable_ipv6.default = 0
|
||||
|
||||
root = s:option(Value, "webd_root", translate("Local Directory"), translatef("Directory of Webd"))
|
||||
root.default = "/mnt"
|
||||
root.rmempty = false
|
||||
|
||||
enable_recyclebin = s:option(Flag, "enable_recyclebin", translate("Recycle Bin"), translatef("Automatically create recycle bin directory"))
|
||||
enable_recyclebin.default = 1
|
||||
|
||||
enable_anonymous = s:option(Flag, "enable_anonymous", translate("Enable Anonymous Access"), translatef("Anonymous access is allowed when enabled (Not Safe)"))
|
||||
enable_anonymous.default = 0
|
||||
|
||||
anonymous_perm = s:option(MultiValue, "anonymous_perm", translate("Anonymous Permission"))
|
||||
anonymous_perm:value("r", translate("Read files"))
|
||||
anonymous_perm:value("l", translate("Obtain file list"))
|
||||
anonymous_perm:value("u", translate("Upload files"))
|
||||
anonymous_perm:value("m", translate("Remove files"))
|
||||
anonymous_perm:value("S", translate("Show hidden files"))
|
||||
anonymous_perm:value("D", translate("Append download attribute"))
|
||||
anonymous_perm:value("T", translate("Play media"))
|
||||
anonymous_perm:depends("enable_anonymous", "1")
|
||||
anonymous_perm.description = translate("At least one permission must be choosed to allow anonymous access")
|
||||
|
||||
webd_bin = s:option(Value, "webd_bin", translate("Binary Path"), translatef("Webd binary Path"))
|
||||
webd_bin.default = "/usr/bin/webd"
|
||||
webd_bin.rmempty = false
|
||||
|
||||
webd_conf = s:option(Value, "webd_conf", translate("Config Path"), translatef("Webd config Path"))
|
||||
webd_conf.default = "/etc/webd.conf"
|
||||
webd_conf.rmempty = false
|
||||
|
||||
s = m:section(TypedSection, "users", translate("User Settings"), translate("Set the username, password and permissions. Maximum for 2 accounts"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.template = "cbi/tblsection"
|
||||
|
||||
username = s:option(Value, "username", translate("Username"))
|
||||
username.rmempty = false
|
||||
|
||||
password = s:option(Value, "password", translate("Password"))
|
||||
password.rmempty = false
|
||||
password.password=false
|
||||
|
||||
enable_read = s:option(Flag, "enable_read", translate("Read files"))
|
||||
enable_read.default = 1
|
||||
|
||||
enable_read_list = s:option(Flag, "enable_read_list", translate("Obtain file list"))
|
||||
enable_read_list.default = 1
|
||||
|
||||
enable_upload = s:option(Flag, "enable_upload", translate("Upload files"))
|
||||
enable_upload.default = 1
|
||||
|
||||
enable_move = s:option(Flag, "enable_move", translate("Remove files"))
|
||||
enable_move.default = 1
|
||||
|
||||
enable_showhide = s:option(Flag, "enable_showhide", translate("Show hidden files"))
|
||||
enable_showhide.default = 0
|
||||
|
||||
enable_play = s:option(Flag, "enable_play", translate("Play media"))
|
||||
enable_play.default = 1
|
||||
|
||||
return m
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[nas]], [[webd]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('webd_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Webd Netdisk <%:RUNNING%></font></b></em><input class="cbi-button-reload mar-10" type="button" value="<%:Open Web Interface%>" onclick="WebUI();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Webd Netdisk <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function WebUI(){
|
||||
var url = window.location.host+":<%=luci.sys.exec("uci -q get webd.@webd[0].webd_port"):gsub("^%s*(.-)%s*$", "%1")%>";
|
||||
window.open('http://'+url,'target','');
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="webd_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
Reference in new issue
Block a user