diff --git a/alist/Makefile b/alist/Makefile index daf521ba..47e28d15 100644 --- a/alist/Makefile +++ b/alist/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=alist -PKG_VERSION:=2.6.4 -PKG_WEB_VERSION:=2.6.4 +PKG_VERSION:=3.0.0-rc.0 +PKG_WEB_VERSION:=3.0.0-rc.0 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:=3860f5cec5d809159c55498874c472386cd6142a932a5e7bbfb3b0f569e3e12b +PKG_HASH:=659ddabc87ceca834a09320c6dd87ab24b16247b992d297b12d9ea4771bed9bf PKG_LICENSE:=GPL-3.0 PKG_LICENSE_FILE:=LICENSE @@ -22,8 +22,8 @@ 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/web-v2/releases/download/$(PKG_WEB_VERSION)/ - HASH:=4189ce3c523e6b8f6bba55faefabc926f6ef793c8755c5c2a2d3f75532fb2243 + URL:=https://github.com/alist-org/alist-web/releases/download/$(PKG_WEB_VERSION)/ + HASH:=55ad8bf4e39e48ff1a0a503783c4e6922e102810cae6dcdf99cec91263c79414 endef PKG_CONFIG_DEPENDS:=CONFIG_ALIST_COMPRESS_UPX @@ -32,10 +32,12 @@ PKG_BUILD_DEPENDS:=golang/host PKG_BUILD_PARALLEL:=1 PKG_USE_MIPS16:=0 -GO_PKG:=github.com/Xhofe/alist -ALIST_PKG:=github.com/Xhofe/alist/conf +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:=$(ALIST_PKG).GitTag=v$(PKG_VERSION)-$(ARCH) +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 @@ -66,8 +68,8 @@ endef define Build/Prepare $(call Build/Prepare/Default) $(eval $(call Download,$(PKG_NAME)-web)) - $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/public -xzf $(DL_DIR)/$(PKG_NAME)-web-$(PKG_WEB_VERSION).tar.gz - $(CP) ./files/assets/. $(PKG_BUILD_DIR)/public/assets/ + $(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 diff --git a/alist/files/assets/circle_center.svg b/alist/files/assets/circle_center.svg deleted file mode 100644 index bc49a26c..00000000 --- a/alist/files/assets/circle_center.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/alist/files/assets/http_can_circle.svg b/alist/files/assets/http_can_circle.svg deleted file mode 100644 index cab3c49f..00000000 --- a/alist/files/assets/http_can_circle.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch b/alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch deleted file mode 100644 index 7aaf37d1..00000000 --- a/alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch +++ /dev/null @@ -1,38 +0,0 @@ -From fdcb81f6ba8b8d7546a6742e9566487e12815499 Mon Sep 17 00:00:00 2001 -From: sbwml -Date: Thu, 28 Apr 2022 11:10:53 +0800 -Subject: [PATCH] Revert "feat: clear temp file while start" - -This reverts commit 24d031d57875d3c6a9624fa7334c6eac1c9111fb. ---- - bootstrap/conf.go | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/bootstrap/conf.go b/bootstrap/conf.go -index 5c9a1b3..f4d87d4 100644 ---- a/bootstrap/conf.go -+++ b/bootstrap/conf.go -@@ -7,7 +7,6 @@ import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "os" -- "path/filepath" - ) - - // InitConf init config -@@ -47,11 +46,7 @@ func InitConf() { - if !conf.Conf.Force { - confFromEnv() - } -- err := os.RemoveAll(filepath.Join(conf.Conf.TempDir)) -- if err != nil { -- log.Errorln("failed delete temp file:", err) -- } -- err = os.MkdirAll(conf.Conf.TempDir, 0700) -+ err := os.MkdirAll(conf.Conf.TempDir, 0700) - if err != nil { - log.Fatalf("create temp dir error: %s", err.Error()) - } --- -2.34.1 - 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 00000000..ad5c4bdc --- /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 +@@ -55,11 +55,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, 0700) ++ err := os.MkdirAll(conf.Conf.TempDir, 0700) + if err != nil { + log.Fatalf("create temp dir error: %+v", err) + } diff --git a/luci-app-alist/Makefile b/luci-app-alist/Makefile index 11ebc459..b7ab3f5d 100644 --- a/luci-app-alist/Makefile +++ b/luci-app-alist/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-alist -PKG_VERSION:=1.0.4 +PKG_VERSION:=1.0.5 PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for alist diff --git a/luci-app-alist/luasrc/controller/alist.lua b/luci-app-alist/luasrc/controller/alist.lua index 1bb66401..28593a04 100644 --- a/luci-app-alist/luasrc/controller/alist.lua +++ b/luci-app-alist/luasrc/controller/alist.lua @@ -5,9 +5,17 @@ function index() 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"}, cbi("alist"), _("Alist"), 20).dependent = true - entry({"admin", "nas", "alist_status"}, call("alist_status")) + 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() @@ -23,3 +31,19 @@ function alist_status() 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 --conf /etc/alist/config.json password 2>&1 | tail -2 | awk 'NR==1 {print $2}'") + local password = luci.sys.exec("/usr/bin/alist --conf /etc/alist/config.json 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.lua b/luci-app-alist/luasrc/model/cbi/alist.lua deleted file mode 100644 index be84605f..00000000 --- a/luci-app-alist/luasrc/model/cbi/alist.lua +++ /dev/null @@ -1,53 +0,0 @@ -local m, s -local sys = require "luci.sys" - -if sys.call("pidof alist >/dev/null") == 0 then - local password = sys.exec("/usr/bin/alist --conf /etc/alist/config.json -password | awk '{print $3}'") - m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. " " .. translate("manage password:") .. "" .. password .. "" .. "
" .. [[]] .. translate("User Manual") .. [[]]) -else - m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. "
" .. [[]] .. translate("User Manual") .. [[]]) -end - -m:section(SimpleSection).template = "alist_status" - -s = m:section(TypedSection, "alist", translate("Global settings")) -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, "ssl", translate("Enable SSL")) -o.rmempty=false - -o = s:option(Value,"ssl_cert", translate("SSL cert"), translate("SSL certificate file path")) -o:depends("ssl", "1") -o.datatype = "string" -o.rmempty = true - -o = s:option(Value,"ssl_key", translate("SSL key"), translate("SSL key file path")) -o:depends("ssl", "1") -o.datatype = "string" -o.rmempty = true - -s = m:section(TypedSection, "alist", translate("Cache settings")) -s.addremove = false -s.anonymous = true - -o = s:option(Value, "expiration", translate("Cache invalidation time (unit: minutes)")) -o.datatype = "and(uinteger,min(1))" -o.rmempty = false - -o = s:option(Value, "cleanup_interval", translate("Clear the invalidation cache interval (unit: minutes)")) -o.datatype = "and(uinteger,min(1))" -o.rmempty = false - -o = s:option(Value, "temp_dir", translate("Cache directory")) -o.datatype = "string" -o.rmempty = false - -return m 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 00000000..eaca6cc9 --- /dev/null +++ b/luci-app-alist/luasrc/model/cbi/alist/basic.lua @@ -0,0 +1,45 @@ +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, "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 00000000..4b6c36f8 --- /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 00000000..c593f280 --- /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 00000000..b77932e4 --- /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_status.htm b/luci-app-alist/luasrc/view/alist/alist_status.htm similarity index 56% rename from luci-app-alist/luasrc/view/alist_status.htm rename to luci-app-alist/luasrc/view/alist/alist_status.htm index 42b1d1a3..fc11c224 100644 --- a/luci-app-alist/luasrc/view/alist_status.htm +++ b/luci-app-alist/luasrc/view/alist/alist_status.htm @@ -9,7 +9,7 @@ %>