mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 11:17:34 +08:00
Delete luci-app-webd directory
This commit is contained in:
parent
d03bff475d
commit
34a844949f
@ -1,25 +0,0 @@
|
||||
# Copyright (C) 2020-2021 Hyy2001X <https://github.com/Hyy2001X>
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-webd
|
||||
PKG_VERSION:=1.3
|
||||
PKG_RELEASE:=3
|
||||
|
||||
LUCI_TITLE:=LuCI support for Webd Netdisk
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
LUCI_DEPENDS:= \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_WEBD_BINARY:webd
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_WEBD_BINARY
|
||||
bool "Include webd Binary"
|
||||
default y
|
||||
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
@ -1,3 +0,0 @@
|
||||
# luci-app-webd
|
||||
|
||||
项目地址: https://webd.cf/
|
@ -1,17 +0,0 @@
|
||||
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
|
@ -1,82 +0,0 @@
|
||||
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 Netdisk"))
|
||||
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 Netdisk"))
|
||||
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("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 Netdisk binary Path"))
|
||||
webd_bin.default = "/usr/bin/webd"
|
||||
webd_bin.rmempty = false
|
||||
|
||||
webd_conf = s:option(Value, "webd_conf", translate("Config Path"), translatef("Webd Netdisk 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
|
@ -1,27 +0,0 @@
|
||||
<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>
|
@ -1,80 +0,0 @@
|
||||
msgid "Webd Netdisk"
|
||||
msgstr "Webd 网盘"
|
||||
|
||||
msgid "Official Website"
|
||||
msgstr "官网"
|
||||
|
||||
msgid "Basic Settings"
|
||||
msgstr "基础设置"
|
||||
|
||||
msgid "Set the basic settings of Webd Netdisk"
|
||||
msgstr "配置 Webd 网盘的基础设置"
|
||||
|
||||
msgid "Listening Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "Webd - A lightweight self hosted netdisk"
|
||||
msgstr "Webd 是一款轻量级的 (self-hosted) 自建网盘软件, 界面简洁易用, 速度快资源占用低"
|
||||
|
||||
msgid "Listen IPv6"
|
||||
msgstr "监听 IPv6"
|
||||
|
||||
msgid "Listen both IPv4 and IPv6 Address"
|
||||
msgstr "同时监听 IPv4 和 IPv6 地址"
|
||||
|
||||
msgid "Enable Anonymous Access"
|
||||
msgstr "允许匿名访问"
|
||||
|
||||
msgid "Anonymous Permission"
|
||||
msgstr "匿名访问权限"
|
||||
|
||||
msgid "Anonymous access is allowed when enabled (Not Safe)"
|
||||
msgstr "启用后将允许匿名用户访问 (不安全)"
|
||||
|
||||
msgid "At least one permission must be choosed to allow anonymous access"
|
||||
msgstr "若要允许匿名访问则勾选至少一个权限"
|
||||
|
||||
msgid "Binary Path"
|
||||
msgstr "程序路径"
|
||||
|
||||
msgid "Webd Netdisk binary Path"
|
||||
msgstr "Webd 网盘二进制程序路径"
|
||||
|
||||
msgid "Config Path"
|
||||
msgstr "配置文件路径"
|
||||
|
||||
msgid "Webd Netdisk config Path"
|
||||
msgstr "Webd 网盘配置文件路径"
|
||||
|
||||
msgid "Local Directory"
|
||||
msgstr "本地路径"
|
||||
|
||||
msgid "Directory of Webd Netdisk"
|
||||
msgstr "Webd 网盘监听路径"
|
||||
|
||||
msgid "Recycle Bin"
|
||||
msgstr "回收站"
|
||||
|
||||
msgid "Automatically create recycle bin directory"
|
||||
msgstr "允许自动创建回收站目录"
|
||||
|
||||
msgid "Set the username, password and permissions. Maximum for 2 accounts"
|
||||
msgstr "设置用户名和密码, 以及单个用户的权限, 最多支持设置两个账号"
|
||||
|
||||
msgid "Read files"
|
||||
msgstr "读取文件"
|
||||
|
||||
msgid "Obtain file list"
|
||||
msgstr "获取文件列表"
|
||||
|
||||
msgid "Upload files"
|
||||
msgstr "上传文件"
|
||||
|
||||
msgid "Remove files"
|
||||
msgstr "删除或移动文件"
|
||||
|
||||
msgid "Show hidden files"
|
||||
msgstr "显示隐藏文件"
|
||||
|
||||
msgid "Play media"
|
||||
msgstr "播放媒体"
|
@ -1,80 +0,0 @@
|
||||
msgid "Webd Netdisk"
|
||||
msgstr "Webd 网盘"
|
||||
|
||||
msgid "Official Website"
|
||||
msgstr "官网"
|
||||
|
||||
msgid "Basic Settings"
|
||||
msgstr "基础设置"
|
||||
|
||||
msgid "Set the basic settings of Webd Netdisk"
|
||||
msgstr "配置 Webd 网盘的基础设置"
|
||||
|
||||
msgid "Listening Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "Webd - A lightweight self hosted netdisk"
|
||||
msgstr "Webd 是一款轻量级的 (self-hosted) 自建网盘软件, 界面简洁易用, 速度快资源占用低"
|
||||
|
||||
msgid "Listen IPv6"
|
||||
msgstr "监听 IPv6"
|
||||
|
||||
msgid "Listen both IPv4 and IPv6 Address"
|
||||
msgstr "同时监听 IPv4 和 IPv6 地址"
|
||||
|
||||
msgid "Enable Anonymous Access"
|
||||
msgstr "允许匿名访问"
|
||||
|
||||
msgid "Anonymous Permission"
|
||||
msgstr "匿名访问权限"
|
||||
|
||||
msgid "Anonymous access is allowed when enabled (Not Safe)"
|
||||
msgstr "启用后将允许匿名用户访问 (不安全)"
|
||||
|
||||
msgid "At least one permission must be choosed to allow anonymous access"
|
||||
msgstr "若要允许匿名访问则勾选至少一个权限"
|
||||
|
||||
msgid "Binary Path"
|
||||
msgstr "程序路径"
|
||||
|
||||
msgid "Webd Netdisk binary Path"
|
||||
msgstr "Webd 网盘二进制程序路径"
|
||||
|
||||
msgid "Config Path"
|
||||
msgstr "配置文件路径"
|
||||
|
||||
msgid "Webd Netdisk config Path"
|
||||
msgstr "Webd 网盘配置文件路径"
|
||||
|
||||
msgid "Local Directory"
|
||||
msgstr "本地路径"
|
||||
|
||||
msgid "Directory of Webd Netdisk"
|
||||
msgstr "Webd 网盘监听路径"
|
||||
|
||||
msgid "Recycle Bin"
|
||||
msgstr "回收站"
|
||||
|
||||
msgid "Automatically create recycle bin directory"
|
||||
msgstr "允许自动创建回收站目录"
|
||||
|
||||
msgid "Set the username, password and permissions. Maximum for 2 accounts"
|
||||
msgstr "设置用户名和密码, 以及单个用户的权限, 最多支持设置两个账号"
|
||||
|
||||
msgid "Read files"
|
||||
msgstr "读取文件"
|
||||
|
||||
msgid "Obtain file list"
|
||||
msgstr "获取文件列表"
|
||||
|
||||
msgid "Upload files"
|
||||
msgstr "上传文件"
|
||||
|
||||
msgid "Remove files"
|
||||
msgstr "删除或移动文件"
|
||||
|
||||
msgid "Show hidden files"
|
||||
msgstr "显示隐藏文件"
|
||||
|
||||
msgid "Play media"
|
||||
msgstr "播放媒体"
|
@ -1,13 +0,0 @@
|
||||
|
||||
config webd
|
||||
option enable '0'
|
||||
option webd_port '9212'
|
||||
|
||||
config users
|
||||
option enable_read '1'
|
||||
option enable_read_list '1'
|
||||
option enable_upload '1'
|
||||
option enable_move '1'
|
||||
option enable_showhide '0'
|
||||
option username 'root'
|
||||
option password 'password'
|
@ -1,120 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
LOGGER="logger -t [Webd]"
|
||||
|
||||
start_service() {
|
||||
local basic_list="enable webd_conf webd_bin webd_port webd_root enable_recyclebin enable_anonymous anonymous_perm enable_ipv6"
|
||||
local users_list="enable_read enable_read_list enable_upload enable_move enable_showhide"
|
||||
for i in $(echo $basic_list);do
|
||||
local eval $i="$(uci_get_by_type webd 0 $i)"
|
||||
done;unset i
|
||||
if [ "$enable" == 1 ]
|
||||
then
|
||||
[ ! -r "$webd_root" -o ! -d "$webd_root" ] && EXIT "Unable to access $webd_root,exit ..."
|
||||
[ ! -x "$webd_bin" ] && EXIT "Unable to access $webd_bin,exit ..."
|
||||
if [ "$enable_recyclebin" == 1 -a ! -d "$webd_root/.Trash" ]
|
||||
then
|
||||
${LOGGER} "Creating Recycle Bin directory ..."
|
||||
mkdir -p $webd_root/.Trash || EXIT "Failed to create Recycle Bin directory,exit ..."
|
||||
fi
|
||||
${LOGGER} "Removing old config file ..."
|
||||
rm -f $webd_conf
|
||||
touch -a $webd_conf || EXIT "Failed to create config,exit ..."
|
||||
[ "$enable_ipv6" == 1 ] && webd_port="[::]:${webd_port}"
|
||||
if [ "$enable_anonymous" != 0 ]
|
||||
then
|
||||
if [ -n "$anonymous_perm" ]
|
||||
then
|
||||
|
||||
unset enable_anonymous
|
||||
for i in $(echo $anonymous_perm);do
|
||||
enable_anonymous="$enable_anonymous$i"
|
||||
done
|
||||
unset i
|
||||
else
|
||||
enable_anonymous=0
|
||||
uci set webd.@webd[0].enable_anonymous=0
|
||||
uci commit webd
|
||||
fi
|
||||
fi
|
||||
echo "Webd.Listen $webd_port" >> $webd_conf
|
||||
echo "Webd.Root $webd_root" >> $webd_conf
|
||||
echo "Webd.Guest $enable_anonymous" >> $webd_conf
|
||||
|
||||
for u in 0 1;do
|
||||
for i in $(echo $users_list);do
|
||||
eval ${i}=$(uci_get_by_type users $u $i 0)
|
||||
echo "$users_list" | grep -q $i
|
||||
[ "$?" == 0 ] && eval perm_bin=$(eval echo '$'perm_bin)$(uci_get_by_type users $u $i)
|
||||
done
|
||||
unset i
|
||||
username=$(uci_get_by_type users $u username)
|
||||
password=$(uci_get_by_type users $u password)
|
||||
if [ -n "$username" ]
|
||||
then
|
||||
eval perm=$(perm_converter $(eval echo '$'perm_bin) | tail -n 1)
|
||||
if [ -n "$(eval echo '$'perm)" ]
|
||||
then
|
||||
${LOGGER} "Creating account for User $username ..."
|
||||
echo "Webd.User $(eval echo '$'perm) $username $password" >> $webd_conf
|
||||
else
|
||||
${LOGGER} "Removing excessive user config ..."
|
||||
uci delete webd.@users[$u]
|
||||
uci commit webd
|
||||
fi
|
||||
unset perm_bin
|
||||
fi
|
||||
done
|
||||
unset u
|
||||
${LOGGER} "Killing old processes ..."
|
||||
ps -efww | grep "$webd_bin" | awk '{print $1}' | xargs kill -9 2> /dev/null
|
||||
${LOGGER} "Starting Webd Netdisk Service ..."
|
||||
procd_open_instance
|
||||
procd_set_param command $webd_bin -c $webd_conf
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
else
|
||||
stop_service
|
||||
${LOGGER} "Webd Netdisk Service is now disabled ..."
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
${LOGGER} "Stopping Webd Netdisk Service ..."
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "webd"
|
||||
}
|
||||
|
||||
uci_get_by_type() {
|
||||
local ret=$(uci get webd.@$1[$2].$3 2>/dev/null)
|
||||
echo ${ret:=$4}
|
||||
}
|
||||
|
||||
EXIT() {
|
||||
${LOGGER} $*
|
||||
exit
|
||||
}
|
||||
|
||||
perm_converter() {
|
||||
local u i=1
|
||||
echo $1 | egrep -o [0-1] | while read X
|
||||
do
|
||||
if [ "$X" == 1 ]
|
||||
then
|
||||
case $i in
|
||||
1)u=r;;
|
||||
2)u=l;;
|
||||
3)u=u;;
|
||||
4)u=m;;
|
||||
5)u=S;;
|
||||
esac
|
||||
[ -n "$u" ] && a="$a$u"
|
||||
echo "$a"
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@webd[-1]
|
||||
add ucitrack webd
|
||||
set ucitrack.@webd[-1].init=webd
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-webd": {
|
||||
"description": "Grant UCI access for luci-app-webd",
|
||||
"read": {
|
||||
"uci": [ "webd" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "webd" ]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user