mirror of
https://github.com/kenzok8/openwrt-packages
synced 2025-01-08 11:17:27 +08:00
update 2023-01-27 20:14:47
This commit is contained in:
parent
83fab9583f
commit
5b5d40b3dd
99
alist/Makefile
Normal file
99
alist/Makefile
Normal file
@ -0,0 +1,99 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alist
|
||||
PKG_VERSION:=3.9.2
|
||||
PKG_WEB_VERSION:=3.9.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/alist-org/alist/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=0e102eea65f6d3b0d247c6c73c97a3ae7d04c71ba9962d3897e04dca8877cf3e
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=sbwml <admin@cooluc.com>
|
||||
|
||||
define Download/$(PKG_NAME)-web
|
||||
FILE:=$(PKG_NAME)-web-$(PKG_WEB_VERSION).tar.gz
|
||||
URL_FILE:=dist.tar.gz
|
||||
URL:=https://github.com/alist-org/alist-web/releases/download/$(PKG_WEB_VERSION)/
|
||||
HASH:=3b8f68bdc1da77fdfae33a346074038218eed907737417b41002a51c122ea0c3
|
||||
endef
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_ALIST_COMPRESS_GOPROXY \
|
||||
CONFIG_ALIST_COMPRESS_UPX
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_ALIST:=github.com/alist-org/alist/v3/internal/conf
|
||||
GO_PKG:=github.com/alist-org/alist
|
||||
GO_PKG_LDFLAGS:=-w -s
|
||||
GO_PKG_LDFLAGS_X:= \
|
||||
$(PKG_ALIST).Version=v$(PKG_VERSION)-$(ARCH) \
|
||||
$(PKG_ALIST).WebVersion=$(PKG_WEB_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/$(PKG_NAME)/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=Alist - Main program
|
||||
URL:=https://alist-doc.nn.ci/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
A file list program that supports multiple storage
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
$(call Package/alist/Default)
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
config ALIST_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
default n
|
||||
|
||||
config ALIST_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_ALIST_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://mirrors.aliyun.com/goproxy/
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(eval $(call Download,$(PKG_NAME)-web))
|
||||
$(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/public/dist -xzf $(DL_DIR)/$(PKG_NAME)-web-$(PKG_WEB_VERSION).tar.gz
|
||||
$(CP) ./files/assets/. $(PKG_BUILD_DIR)/public/dist/assets/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
ifneq ($(CONFIG_ALIST_COMPRESS_UPX),)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/alist
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/alist $(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
10
alist/files/assets/logo.svg
Normal file
10
alist/files/assets/logo.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg width="1252" height="1252" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||
<g>
|
||||
<g id="#70c6beff">
|
||||
<path id="svg_2" d="m634.37,138.38c11.88,-1.36 24.25,1.3 34.18,8.09c14.96,9.66 25.55,24.41 34.49,39.51c40.59,68.03 81.45,135.91 122.02,203.96c54.02,90.99 108.06,181.97 161.94,273.06c37.28,63 74.65,125.96 112.18,188.82c24.72,41.99 50.21,83.54 73.84,126.16c10.18,17.84 15.77,38.44 14.93,59.03c-0.59,15.92 -3.48,32.28 -11.84,46.08c-11.73,19.46 -31.39,33.2 -52.71,40.36c-11.37,4.09 -23.3,6.87 -35.43,6.89c-132.32,-0.05 -264.64,0.04 -396.95,0.03c-11.38,-0.29 -22.95,-1.6 -33.63,-5.72c-7.81,-3.33 -15.5,-7.43 -21.61,-13.42c-10.43,-10.32 -17.19,-24.96 -15.38,-39.83c0.94,-10.39 3.48,-20.64 7.76,-30.16c4.15,-9.77 9.99,-18.67 15.06,-27.97c22.13,-39.47 45.31,-78.35 69.42,-116.65c7.72,-12.05 14.44,-25.07 25.12,-34.87c11.35,-10.39 25.6,-18.54 41.21,-19.6c12.55,-0.52 24.89,3.82 35.35,10.55c11.8,6.92 21.09,18.44 24.2,31.88c4.49,17.01 -0.34,34.88 -7.55,50.42c-8.09,17.65 -19.62,33.67 -25.81,52.18c-1.13,4.21 -2.66,9.52 0.48,13.23c3.19,3 7.62,4.18 11.77,5.22c12,2.67 24.38,1.98 36.59,2.06c45,-0.01 90,0 135,0c8.91,-0.15 17.83,0.3 26.74,-0.22c6.43,-0.74 13.44,-1.79 18.44,-6.28c3.3,-2.92 3.71,-7.85 2.46,-11.85c-2.74,-8.86 -7.46,-16.93 -12.12,-24.89c-119.99,-204.91 -239.31,-410.22 -360.56,-614.4c-3.96,-6.56 -7.36,-13.68 -13.03,-18.98c-2.8,-2.69 -6.95,-4.22 -10.77,-3.11c-3.25,1.17 -5.45,4.03 -7.61,6.57c-5.34,6.81 -10.12,14.06 -14.51,21.52c-20.89,33.95 -40.88,68.44 -61.35,102.64c-117.9,198.43 -235.82,396.85 -353.71,595.29c-7.31,13.46 -15.09,26.67 -23.57,39.43c-7.45,10.96 -16.49,21.23 -28.14,27.83c-13.73,7.94 -30.69,11.09 -46.08,6.54c-11.23,-3.47 -22.09,-9.12 -30.13,-17.84c-10.18,-10.08 -14.69,-24.83 -14.17,-38.94c0.52,-14.86 5.49,-29.34 12.98,-42.1c71.58,-121.59 143.62,-242.92 215.93,-364.09c37.2,-62.8 74.23,-125.69 111.64,-188.36c37.84,-63.5 75.77,-126.94 113.44,-190.54c21.02,-35.82 42.19,-71.56 64.28,-106.74c6.79,-11.15 15.58,-21.15 26.16,-28.85c8.68,-5.92 18.42,-11 29.05,-11.94z" fill="#70c6be"/>
|
||||
</g>
|
||||
<g id="#1ba0d8ff">
|
||||
<path id="svg_3" d="m628.35,608.38c17.83,-2.87 36.72,1.39 51.5,11.78c11.22,8.66 19.01,21.64 21.26,35.65c1.53,10.68 0.49,21.75 -3.44,31.84c-3.02,8.73 -7.35,16.94 -12.17,24.81c-68.76,115.58 -137.5,231.17 -206.27,346.75c-8.8,14.47 -16.82,29.47 -26.96,43.07c-7.37,9.11 -16.58,16.85 -27.21,21.89c-22.47,11.97 -51.79,4.67 -68.88,-13.33c-8.66,-8.69 -13.74,-20.63 -14.4,-32.84c-0.98,-12.64 1.81,-25.42 7.53,-36.69c5.03,-10.96 10.98,-21.45 17.19,-31.77c30.22,-50.84 60.17,-101.84 90.3,-152.73c41.24,-69.98 83.16,-139.55 124.66,-209.37c4.41,-7.94 9.91,-15.26 16.09,-21.9c8.33,-8.46 18.9,-15.3 30.8,-17.16z" fill="#1ba0d8"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,15 @@
|
||||
--- a/internal/bootstrap/config.go
|
||||
+++ b/internal/bootstrap/config.go
|
||||
@@ -65,11 +65,7 @@ func InitConfig() {
|
||||
}
|
||||
conf.Conf.TempDir = absPath
|
||||
}
|
||||
- err := os.RemoveAll(filepath.Join(conf.Conf.TempDir))
|
||||
- if err != nil {
|
||||
- log.Errorln("failed delete temp file:", err)
|
||||
- }
|
||||
- err = os.MkdirAll(conf.Conf.TempDir, 0777)
|
||||
+ err := os.MkdirAll(conf.Conf.TempDir, 0777)
|
||||
if err != nil {
|
||||
log.Fatalf("create temp dir error: %+v", err)
|
||||
}
|
29
luci-app-alist/Makefile
Normal file
29
luci-app-alist/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-alist
|
||||
PKG_VERSION:=1.0.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LUCI_TITLE:=LuCI support for alist
|
||||
LUCI_DEPENDS:=+alist +luci-compat
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/alist
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
[ -n "${IPKG_INSTROOT}" ] || {
|
||||
( . /etc/uci-defaults/luci-alist ) && rm -f /etc/uci-defaults/luci-alist
|
||||
exit 0
|
||||
}
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
49
luci-app-alist/luasrc/controller/alist.lua
Normal file
49
luci-app-alist/luasrc/controller/alist.lua
Normal file
@ -0,0 +1,49 @@
|
||||
module("luci.controller.alist", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/alist") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "nas", "alist"}, alias("admin", "nas", "alist", "basic"), _("Alist"), 20)
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-alist" }
|
||||
|
||||
entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false
|
||||
entry({"admin", "nas", "alist", "basic"}, cbi("alist/basic"), _("Basic Setting"), 1).leaf = true
|
||||
entry({"admin", "nas", "alist", "log"}, cbi("alist/log"), _("Logs"), 2).leaf = true
|
||||
entry({"admin", "nas", "alist", "alist_status"}, call("alist_status")).leaf = true
|
||||
entry({"admin", "nas", "alist", "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "nas", "alist", "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "nas", "alist", "admin_info"}, call("admin_info")).leaf = true
|
||||
end
|
||||
|
||||
function alist_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local port = tonumber(uci:get_first("alist", "alist", "port"))
|
||||
|
||||
local status = {
|
||||
running = (sys.call("pidof alist >/dev/null") == 0),
|
||||
port = (port or 5244)
|
||||
}
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(status)
|
||||
end
|
||||
|
||||
function get_log()
|
||||
luci.http.write(luci.sys.exec("cat $(uci -q get alist.@alist[0].temp_dir)/alist.log"))
|
||||
end
|
||||
|
||||
function clear_log()
|
||||
luci.sys.call("cat /dev/null > $(uci -q get alist.@alist[0].temp_dir)/alist.log")
|
||||
end
|
||||
|
||||
function admin_info()
|
||||
local username = luci.sys.exec("/usr/bin/alist --data /etc/alist password 2>&1 | tail -2 | awk 'NR==1 {print $2}'")
|
||||
local password = luci.sys.exec("/usr/bin/alist --data /etc/alist password 2>&1 | tail -2 | awk 'NR==2 {print $2}'")
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({username = username, password = password})
|
||||
end
|
50
luci-app-alist/luasrc/model/cbi/alist/basic.lua
Normal file
50
luci-app-alist/luasrc/model/cbi/alist/basic.lua
Normal file
@ -0,0 +1,50 @@
|
||||
local m, s
|
||||
|
||||
m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. "<br/>" .. [[<a href="https://alist.nn.ci/zh/guide/drivers/local.html" target="_blank">]] .. translate("User Manual") .. [[</a>]])
|
||||
|
||||
m:section(SimpleSection).template = "alist/alist_status"
|
||||
|
||||
s = m:section(TypedSection, "alist")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "port", translate("Port"))
|
||||
o.datatype = "and(port,min(1))"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "log", translate("Enable Logs"))
|
||||
o.default = 1
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "ssl", translate("Enable SSL"))
|
||||
o.rmempty=false
|
||||
|
||||
o = s:option(Value,"ssl_cert", translate("SSL cert"), translate("SSL certificate file path"))
|
||||
o.datatype = "file"
|
||||
o:depends("ssl", "1")
|
||||
|
||||
o = s:option(Value,"ssl_key", translate("SSL key"), translate("SSL key file path"))
|
||||
o.datatype = "file"
|
||||
o:depends("ssl", "1")
|
||||
|
||||
o = s:option(Flag, "allow_wan", translate("Allow Access From Internet"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "token_expires_in", translate("Login Validity Period (hours)"))
|
||||
o.datatype = "and(uinteger,min(0))"
|
||||
o.default = "48"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "temp_dir", translate("Cache directory"))
|
||||
o.datatype = "string"
|
||||
o.default = "/tmp/alist"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Button, "admin_info", translate("View Password"))
|
||||
o.rawhtml = true
|
||||
o.template = "alist/admin_info"
|
||||
|
||||
return m
|
5
luci-app-alist/luasrc/model/cbi/alist/log.lua
Normal file
5
luci-app-alist/luasrc/model/cbi/alist/log.lua
Normal file
@ -0,0 +1,5 @@
|
||||
m = Map("alist")
|
||||
|
||||
m:append(Template("alist/alist_log"))
|
||||
|
||||
return m
|
26
luci-app-alist/luasrc/view/alist/admin_info.htm
Normal file
26
luci-app-alist/luasrc/view/alist/admin_info.htm
Normal file
@ -0,0 +1,26 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function admin_info(btn)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Reading...%>';
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "nas", "alist", "admin_info")%>',
|
||||
null,
|
||||
function(x,rv)
|
||||
{
|
||||
var tb = document.getElementById('<%=self.option%>-status');
|
||||
if (tb)
|
||||
{
|
||||
tb.innerHTML = "<%:Username:%>" + "<font color='green'>" + rv.username + "</font>";
|
||||
tb.innerHTML += "<%:Password:%>" + "<font color='green'>" + rv.password + "</font>";
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Read%>';
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Read%>" onclick="return admin_info(this)" />
|
||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||
<%+cbi/valuefooter%>
|
29
luci-app-alist/luasrc/view/alist/alist_log.htm
Normal file
29
luci-app-alist/luasrc/view/alist/alist_log.htm
Normal file
@ -0,0 +1,29 @@
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function clear_log(btn) {
|
||||
XHR.get('<%=url([[admin]], [[nas]], [[alist]], [[clear_log]])%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = "";
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
XHR.poll(2, '<%=url([[admin]], [[nas]], [[alist]], [[get_log]])%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = x.responseText;
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<fieldset class="cbi-section" id="_log_fieldset">
|
||||
<input class="cbi-button cbi-input-remove" type="button" onclick="clear_log()" value="<%:Clear logs%>" style="margin-left: 10px; margin-top: 10px;">
|
||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: calc(100% - 20px); height: 500px; margin: 10px;" data-update="change" rows="5" wrap="off" readonly="readonly"></textarea>
|
||||
</fieldset>
|
36
luci-app-alist/luasrc/view/alist/alist_status.htm
Normal file
36
luci-app-alist/luasrc/view/alist/alist_status.htm
Normal file
@ -0,0 +1,36 @@
|
||||
<%
|
||||
local uci = require 'luci.model.uci'.cursor()
|
||||
ssl = uci:get_first('alist', 'alist', 'ssl')
|
||||
if ssl == '1' then
|
||||
protocol="https://"
|
||||
else
|
||||
protocol="http://"
|
||||
end
|
||||
%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url("admin/nas/alist/alist_status")%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('alist_status');
|
||||
if (st && tb)
|
||||
{
|
||||
if (st.running)
|
||||
{
|
||||
tb.innerHTML = '<em style=\"color:green\"><b>Alist <%:RUNNING%></b></em>' + "<input class=\"cbi-button cbi-button-reload mar-10\" type=\"button\" value=\" <%:Open Web Interface%> \" onclick=\"window.open('<%=protocol%>" + window.location.hostname + ":" + st.port + "/')\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
tb.innerHTML = '<em style=\"color:red\"><b>Alist <%:NOT RUNNING%></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="alist_status">
|
||||
<em><b><%:Collecting data...%></b></em>
|
||||
</p>
|
||||
</fieldset>
|
77
luci-app-alist/po/zh-cn/alist.po
Normal file
77
luci-app-alist/po/zh-cn/alist.po
Normal file
@ -0,0 +1,77 @@
|
||||
msgid "Alist"
|
||||
msgstr "Alist 文件列表"
|
||||
|
||||
msgid "Running state"
|
||||
msgstr "运行状态"
|
||||
|
||||
msgid "Open Web Interface"
|
||||
msgstr "打开 Web 界面"
|
||||
|
||||
msgid "A file list program that supports multiple storage."
|
||||
msgstr "一款支持多种存储的目录文件列表程序。"
|
||||
|
||||
msgid "Basic Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Port"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "Enable SSL"
|
||||
msgstr "启用 SSL"
|
||||
|
||||
msgid "SSL cert"
|
||||
msgstr "SSL 证书"
|
||||
|
||||
msgid "SSL certificate file path"
|
||||
msgstr "SSL 证书文件路径"
|
||||
|
||||
msgid "SSL key"
|
||||
msgstr "SSL 密钥"
|
||||
|
||||
msgid "SSL key file path"
|
||||
msgstr "SSL 密钥文件路径"
|
||||
|
||||
msgid "Cache directory"
|
||||
msgstr "缓存目录"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Collecting data..."
|
||||
msgstr "收集数据..."
|
||||
|
||||
msgid "NAS"
|
||||
msgstr "网络存储"
|
||||
|
||||
msgid "User Manual"
|
||||
msgstr "用户手册"
|
||||
|
||||
msgid "Allow Access From Internet"
|
||||
msgstr "允许从外网访问"
|
||||
|
||||
msgid "Enable Logs"
|
||||
msgstr "启用日志"
|
||||
|
||||
msgid "Clear logs"
|
||||
msgstr "清空日志"
|
||||
|
||||
msgid "View Password"
|
||||
msgstr "查看密码"
|
||||
|
||||
msgid "Username:"
|
||||
msgstr "用户名:"
|
||||
|
||||
msgid "Password:"
|
||||
msgstr "密码:"
|
||||
|
||||
msgid "Reading..."
|
||||
msgstr "读取中..."
|
||||
|
||||
msgid "Read"
|
||||
msgstr "读取"
|
||||
|
||||
msgid "Login Validity Period (hours)"
|
||||
msgstr "登录有效期(小时)"
|
1
luci-app-alist/po/zh_Hans
Symbolic link
1
luci-app-alist/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
BIN
luci-app-alist/root/etc/alist/data.db
Normal file
BIN
luci-app-alist/root/etc/alist/data.db
Normal file
Binary file not shown.
6
luci-app-alist/root/etc/config/alist
Normal file
6
luci-app-alist/root/etc/config/alist
Normal file
@ -0,0 +1,6 @@
|
||||
config alist
|
||||
option 'enabled' '0'
|
||||
option 'port' '5244'
|
||||
option 'temp_dir' '/tmp/alist'
|
||||
option 'ssl' '0'
|
||||
option 'token_expires_in' '48'
|
81
luci-app-alist/root/etc/init.d/alist
Executable file
81
luci-app-alist/root/etc/init.d/alist
Executable file
@ -0,0 +1,81 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
PROG=/usr/bin/alist
|
||||
CONFIG_DIR=/etc/alist
|
||||
|
||||
get_config() {
|
||||
config_get_bool enabled $1 enabled 1
|
||||
config_get port $1 port 5244
|
||||
config_get log $1 log 1
|
||||
config_get temp_dir $1 temp_dir "/tmp/alist"
|
||||
config_get ssl $1 ssl 0
|
||||
config_get ssl_cert $1 ssl_cert ""
|
||||
config_get ssl_key $1 ssl_key ""
|
||||
config_get token_expires_in $1 token_expires_in 48
|
||||
config_get allow_wan $1 allow_wan 0
|
||||
config_load network
|
||||
config_get lan_addr lan ipaddr "0.0.0.0"
|
||||
}
|
||||
|
||||
set_firewall() {
|
||||
if [ "$external_access" = "allow" ]; then
|
||||
uci -q delete firewall.alist
|
||||
uci set firewall.alist=rule
|
||||
uci set firewall.alist.name="alist"
|
||||
uci set firewall.alist.target="ACCEPT"
|
||||
uci set firewall.alist.src="wan"
|
||||
uci set firewall.alist.proto="tcp"
|
||||
uci set firewall.alist.dest_port="$port"
|
||||
uci set firewall.alist.enabled="1"
|
||||
uci commit firewall
|
||||
/etc/init.d/firewall reload >/dev/null 2>&1
|
||||
elif [ "$external_access" = "deny" ]; then
|
||||
uci -q delete firewall.alist
|
||||
uci commit firewall
|
||||
/etc/init.d/firewall reload >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load alist
|
||||
config_foreach get_config alist
|
||||
[ $enabled != 1 ] && return 1
|
||||
mkdir -p $temp_dir
|
||||
[ "$ssl" -eq 1 ] && SSL=true || SSL=false
|
||||
[ "$log" -eq 1 ] && LOG=true || LOG=false
|
||||
if [ "$allow_wan" -eq "1" ]; then
|
||||
listen_addr="0.0.0.0"
|
||||
external_access="allow"
|
||||
else
|
||||
listen_addr=$lan_addr
|
||||
external_access="deny"
|
||||
fi
|
||||
set_firewall
|
||||
cat /dev/null > $temp_dir/alist.log
|
||||
cat > $CONFIG_DIR/config.json <<EOF
|
||||
{"force":false,"address":"$listen_addr","port":$port,"cdn":"","jwt_secret":"","token_expires_in":$token_expires_in,"database":{"type":"sqlite3","host":"","port":0,"user":"","password":"","name":"","db_file":"/etc/alist/data.db","table_prefix":"x_","ssl_mode":""},"scheme":{"https":$SSL,"cert_file":"$ssl_cert","key_file":"$ssl_key"},"temp_dir":"$temp_dir","log":{"enable":$LOG,"name":"$temp_dir/alist.log","max_size":10,"max_backups":5,"max_age":28,"compress":false}}
|
||||
EOF
|
||||
procd_open_instance alist
|
||||
procd_set_param command $PROG
|
||||
procd_append_param command server --data $CONFIG_DIR
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance alist
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "alist"
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
external_access="deny"
|
||||
set_firewall
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
11
luci-app-alist/root/etc/uci-defaults/luci-alist
Executable file
11
luci-app-alist/root/etc/uci-defaults/luci-alist
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@alist[-1]
|
||||
add ucitrack alist
|
||||
set ucitrack.@alist[-1].init=alist
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
11
luci-app-alist/root/usr/share/rpcd/acl.d/luci-app-alist.json
Normal file
11
luci-app-alist/root/usr/share/rpcd/acl.d/luci-app-alist.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-alist": {
|
||||
"description": "Grant UCI access for luci-app-alist",
|
||||
"read": {
|
||||
"uci": [ "alist" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "alist" ]
|
||||
}
|
||||
}
|
||||
}
|
0
luci-app-lucky/luci-app-lucky/root/etc/init.d/lucky
Normal file → Executable file
0
luci-app-lucky/luci-app-lucky/root/etc/init.d/lucky
Normal file → Executable file
Loading…
Reference in New Issue
Block a user