From 1333792fba11a242a03f1f7966725343fbddf270 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 01:23:08 +0800 Subject: [PATCH] update 2023-01-31 01:23:08 --- UnblockNeteaseMusic/Makefile | 52 +++++++++ alist/Makefile | 99 ++++++++++++++++++ alist/files/assets/logo.svg | 10 ++ ...-delete-of-temp-directory-at-startup.patch | 15 +++ luci-app-alist/Makefile | 29 +++++ luci-app-alist/luasrc/controller/alist.lua | 49 +++++++++ .../luasrc/model/cbi/alist/basic.lua | 50 +++++++++ luci-app-alist/luasrc/model/cbi/alist/log.lua | 5 + .../luasrc/view/alist/admin_info.htm | 26 +++++ .../luasrc/view/alist/alist_log.htm | 29 +++++ .../luasrc/view/alist/alist_status.htm | 36 +++++++ luci-app-alist/po/zh-cn/alist.po | 77 ++++++++++++++ luci-app-alist/po/zh_Hans | 1 + luci-app-alist/root/etc/alist/data.db | Bin 0 -> 36864 bytes luci-app-alist/root/etc/config/alist | 6 ++ luci-app-alist/root/etc/init.d/alist | 81 ++++++++++++++ .../root/etc/uci-defaults/luci-alist | 11 ++ .../usr/share/rpcd/acl.d/luci-app-alist.json | 11 ++ 18 files changed, 587 insertions(+) create mode 100644 UnblockNeteaseMusic/Makefile create mode 100644 alist/Makefile create mode 100644 alist/files/assets/logo.svg create mode 100644 alist/patches/001-disable-delete-of-temp-directory-at-startup.patch create mode 100644 luci-app-alist/Makefile create mode 100644 luci-app-alist/luasrc/controller/alist.lua create mode 100644 luci-app-alist/luasrc/model/cbi/alist/basic.lua create mode 100644 luci-app-alist/luasrc/model/cbi/alist/log.lua create mode 100644 luci-app-alist/luasrc/view/alist/admin_info.htm create mode 100644 luci-app-alist/luasrc/view/alist/alist_log.htm create mode 100644 luci-app-alist/luasrc/view/alist/alist_status.htm create mode 100644 luci-app-alist/po/zh-cn/alist.po create mode 120000 luci-app-alist/po/zh_Hans create mode 100644 luci-app-alist/root/etc/alist/data.db create mode 100644 luci-app-alist/root/etc/config/alist create mode 100755 luci-app-alist/root/etc/init.d/alist create mode 100755 luci-app-alist/root/etc/uci-defaults/luci-alist create mode 100644 luci-app-alist/root/usr/share/rpcd/acl.d/luci-app-alist.json diff --git a/UnblockNeteaseMusic/Makefile b/UnblockNeteaseMusic/Makefile new file mode 100644 index 000000000..23e5b3ab9 --- /dev/null +++ b/UnblockNeteaseMusic/Makefile @@ -0,0 +1,52 @@ +# SPDX-Identifier-License: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=UnblockNeteaseMusic +PKG_BASE_VERSION:=0.27.0 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/UnblockNeteaseMusic/server.git +PKG_SOURCE_DATE:=2022-10-09 +PKG_SOURCE_VERSION:=253dc89329ebd16ff22175d9d0ab9382ed8aaccc +PKG_MIRROR_HASH:=c2ed5f269c1935575c57ed5489504ef37f453b2a512209bf0762a55fc3eb4b29 + +PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION)) + +PKG_LICENSE:=LGPL-3.0-only +PKG_LICENSE_FILE:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +include $(INCLUDE_DIR)/package.mk + +define Package/UnblockNeteaseMusic + SECTION:=multimedia + CATEGORY:=Multimedia + TITLE:=Revive Netease Cloud Music (NodeJS) + URL:=https://github.com/nondanee/UnblockNeteaseMusic + DEPENDS:=+node + PKGARCH:=all +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + xzcat $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) +endef + +define Build/Configure + echo -e $(PKG_BASE_VERSION) > $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/core_ver + echo -e $(PKG_SOURCE_VERSION) > $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/local_ver +endef + +define Build/Compile +endef + +define Package/UnblockNeteaseMusic/install + $(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusic + $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/* $(1)/usr/share/UnblockNeteaseMusic +endef + +$(eval $(call BuildPackage,UnblockNeteaseMusic)) diff --git a/alist/Makefile b/alist/Makefile new file mode 100644 index 000000000..897dc7b6c --- /dev/null +++ b/alist/Makefile @@ -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 + +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))) diff --git a/alist/files/assets/logo.svg b/alist/files/assets/logo.svg new file mode 100644 index 000000000..37d5fdcd9 --- /dev/null +++ b/alist/files/assets/logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/alist/patches/001-disable-delete-of-temp-directory-at-startup.patch b/alist/patches/001-disable-delete-of-temp-directory-at-startup.patch new file mode 100644 index 000000000..3dbc53532 --- /dev/null +++ b/alist/patches/001-disable-delete-of-temp-directory-at-startup.patch @@ -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) + } diff --git a/luci-app-alist/Makefile b/luci-app-alist/Makefile new file mode 100644 index 000000000..220b3fcbe --- /dev/null +++ b/luci-app-alist/Makefile @@ -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 diff --git a/luci-app-alist/luasrc/controller/alist.lua b/luci-app-alist/luasrc/controller/alist.lua new file mode 100644 index 000000000..4f192ec09 --- /dev/null +++ b/luci-app-alist/luasrc/controller/alist.lua @@ -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 diff --git a/luci-app-alist/luasrc/model/cbi/alist/basic.lua b/luci-app-alist/luasrc/model/cbi/alist/basic.lua new file mode 100644 index 000000000..3914288c3 --- /dev/null +++ b/luci-app-alist/luasrc/model/cbi/alist/basic.lua @@ -0,0 +1,50 @@ +local m, s + +m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. "
" .. [[]] .. translate("User Manual") .. [[]]) + +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 diff --git a/luci-app-alist/luasrc/model/cbi/alist/log.lua b/luci-app-alist/luasrc/model/cbi/alist/log.lua new file mode 100644 index 000000000..4b6c36f82 --- /dev/null +++ b/luci-app-alist/luasrc/model/cbi/alist/log.lua @@ -0,0 +1,5 @@ +m = Map("alist") + +m:append(Template("alist/alist_log")) + +return m diff --git a/luci-app-alist/luasrc/view/alist/admin_info.htm b/luci-app-alist/luasrc/view/alist/admin_info.htm new file mode 100644 index 000000000..c593f2806 --- /dev/null +++ b/luci-app-alist/luasrc/view/alist/admin_info.htm @@ -0,0 +1,26 @@ +<%+cbi/valueheader%> + + +<%=self.value%> +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/luci-app-alist/luasrc/view/alist/alist_log.htm b/luci-app-alist/luasrc/view/alist/alist_log.htm new file mode 100644 index 000000000..b77932e4f --- /dev/null +++ b/luci-app-alist/luasrc/view/alist/alist_log.htm @@ -0,0 +1,29 @@ + +
+ + +
diff --git a/luci-app-alist/luasrc/view/alist/alist_status.htm b/luci-app-alist/luasrc/view/alist/alist_status.htm new file mode 100644 index 000000000..6be654eae --- /dev/null +++ b/luci-app-alist/luasrc/view/alist/alist_status.htm @@ -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 +%> + + + + +
+

+ <%:Collecting data...%> +

+
diff --git a/luci-app-alist/po/zh-cn/alist.po b/luci-app-alist/po/zh-cn/alist.po new file mode 100644 index 000000000..fd3578a1c --- /dev/null +++ b/luci-app-alist/po/zh-cn/alist.po @@ -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 "登录有效期(小时)" diff --git a/luci-app-alist/po/zh_Hans b/luci-app-alist/po/zh_Hans new file mode 120000 index 000000000..41451e4a1 --- /dev/null +++ b/luci-app-alist/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file diff --git a/luci-app-alist/root/etc/alist/data.db b/luci-app-alist/root/etc/alist/data.db new file mode 100644 index 0000000000000000000000000000000000000000..e1bb40dd3698470f938f69a26d619cbb0418c0f0 GIT binary patch literal 36864 zcmeI5&u<%99l&SoG#Mwg-O^@F$d+}oq+2&Hb{xk^8mQ8=Nvm$#?GKt=mA10SGtc8m zX66ku&yGVALCdb-utMUn5*H2}5eLK{fP}P&!-@;bafO7qAb~ip5C-g|KK&gz3l z>09fMTBpinE-Qnn`_r;yIy!Co-?qT*l3M31XqS3CEaiIyvBWhwo*EmIzdzav-=$p#`TjQZU{nagE&26IIqlSK>X{lTZ+qZm zce|&*X6hY2wVpnYs=D3j^$zwPDsg<$*ctlKsig+D*z8W1$jgQMO9<^Z9 zed@s+2wnzyaRkysJcQIy+b;HHQc-(s=A{N8$d`g7)~1{E{Ebrk6hyxnmqcAM25-W63R zdYBB<>k35o%!Uwz^Fvd$8ZFVLYkI0!4P66$uJU?kb*Q>-h66%HkJ_rY)iz@@-K?4v zrk$>G%1xV+vTpifRfDWE`vPA|mCiB^+q&sdt=l#%VNca~smiRt_wbC{v{G_C)&%X2 zL6GTcqvSHn)H+smw(W!?OLfocf4K^g!PJe3{+FxGI#{`_3nD(#E8>P47rRqphYuux z1dsp{Kmter2_OL^fCP{L5{cNfCP{L5Ue_1gCB!C2v01`j~NB{{S0VIF~kN^@u z0-r}feE*NX|Mz*6upbE^0VIF~kN^@u0!RP}AOR$R1dzbXO(34QBAtkTDkY1FSL2^1 z%gN!vzyCMSmzx55j|7ka5f+M;OhI2L z&de_?Rc0zn`MH_=oL*d5EYdluE`96PJNY$d;q7bN)w}E0*;`AO)WyR3T;aysw-$|! z{I#2FZ#H+X+l$5G)j9j_nqH`1cP`!9c$lxSs#9CCeC|OxumN!3Njx~e>Y3_Xs}57x zc>+3DZgh3lJ+sESyPV5eOjE5I^ZD|^((G(*(`Sz7YWr%+Eup3`%`2&HpyY!V9A+IS ztC>0I$W={?2AZK-bYwL0hp8XD5g!E@E>u!dwVjej4gbQ*GW>g@?>^4YTzU$x`6oK; z=N`|_%!}q+5sr#aGf%RaXNA2lG<5jFWgwtJU!}gG=E+=NrQ+V<)AaL7 zKv~WVUs&15sG3H7zZ6XE%NMd2Gv`IUDY(+oUz5SSvP@^It3=i;RG+F)PYn27JeUYt z9ZE&n=67hR!t|ZC_Ro7eYfwL}-TD5g&{SMi+k%Q;B~h} zB&MOCdy<0^cx!jov$mdtGH#)hS3^q;7{-F?bFQWCwCzN|&O|sst?T9y0}@xFGb~sK z;Q)<6buh7j#9G+&_10Q2YPoRPGtYp9Ww0x@YC6GD)^8Z$>WCz+ME*Se?s(w0S@ob4 z8`R;V4U=yB&xT`@I@1VjP13Y{u{DY7aN?dg3wV>mu|2Re>FU+CZ}--&XE*&Wivf@p9~cLnIjBb#_(Z*Ijoa3WxNdE? zz~bENL2fC_1gGbxV{Lgjwdp4X)6- z`N8RabS6IbSW%`gW=55%99&&RQ5^@W5Ngz>4qp{-64F)XrSH1bdFR1Hfjl#yOymN~ zzNnSSO>WUc1H*gC#k0!mf}yN*-ItC=DSm&Sr+UrahVzG}pnF5SeNdE6<;PCPH^L71 zPhZ?RI^wA}#CREQg`x~(qmZ4=&dyYzPGxpB91|H%{82iQ_)to2B|c2SxxzFY{iZu1{Tc{< z844f?{Z(lFtd(0n2ge_Dr;A?&!MiK-@IgLEJq?2Fbho_|iRgs9pO6@U`8n0e6o>+UsaASGBpOCq HIf4HG^Qxr` literal 0 HcmV?d00001 diff --git a/luci-app-alist/root/etc/config/alist b/luci-app-alist/root/etc/config/alist new file mode 100644 index 000000000..e47fae617 --- /dev/null +++ b/luci-app-alist/root/etc/config/alist @@ -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' diff --git a/luci-app-alist/root/etc/init.d/alist b/luci-app-alist/root/etc/init.d/alist new file mode 100755 index 000000000..2760a883b --- /dev/null +++ b/luci-app-alist/root/etc/init.d/alist @@ -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 </dev/null + delete ucitrack.@alist[-1] + add ucitrack alist + set ucitrack.@alist[-1].init=alist + commit ucitrack +EOF + +rm -rf /tmp/luci-* +exit 0 diff --git a/luci-app-alist/root/usr/share/rpcd/acl.d/luci-app-alist.json b/luci-app-alist/root/usr/share/rpcd/acl.d/luci-app-alist.json new file mode 100644 index 000000000..98ba9422a --- /dev/null +++ b/luci-app-alist/root/usr/share/rpcd/acl.d/luci-app-alist.json @@ -0,0 +1,11 @@ +{ + "luci-app-alist": { + "description": "Grant UCI access for luci-app-alist", + "read": { + "uci": [ "alist" ] + }, + "write": { + "uci": [ "alist" ] + } + } +}