luci-app-alist: update for v3

This commit is contained in:
sbwml 2022-09-09 19:22:50 +08:00
parent 20a3613161
commit 4d00052697
6 changed files with 14 additions and 38 deletions

View File

@ -6,11 +6,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-alist PKG_NAME:=luci-app-alist
PKG_VERSION:=1.0.4 PKG_VERSION:=1.0.5
PKG_RELEASE:=1 PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for alist LUCI_TITLE:=LuCI support for alist
LUCI_DEPENDS:=+alist +luci-compat LUCI_DEPENDS:=+alist
define Package/$(PKG_NAME)/conffiles define Package/$(PKG_NAME)/conffiles
/etc/alist /etc/alist

View File

@ -2,10 +2,10 @@ local m, s
local sys = require "luci.sys" local sys = require "luci.sys"
if sys.call("pidof alist >/dev/null") == 0 then 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}'") local password = sys.exec("/usr/bin/alist --conf /etc/alist/config.json -password |& tail -1 | awk -F': ' '{print $2}'")
m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. " " .. translate("manage password:") .. "<font color=\"green\">" .. password .. "</font>" .. "<br/>" .. [[<a href="https://alist-doc.nn.ci/docs/driver/native" target="_blank">]] .. translate("User Manual") .. [[</a>]]) m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. " " .. translate("manage password:") .. "<font color=\"green\">" .. password .. "</font>" .. "<br/>" .. [[<a href="https://alist.nn.ci/guide/drivers/local.html" target="_blank">]] .. translate("User Manual") .. [[</a>]])
else else
m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. "<br/>" .. [[<a href="https://alist-doc.nn.ci/docs/driver/native" target="_blank">]] .. translate("User Manual") .. [[</a>]]) m = Map("alist", translate("Alist"), translate("A file list program that supports multiple storage.") .. "<br/>" .. [[<a href="https://alist.nn.ci/guide/drivers/local.html" target="_blank">]] .. translate("User Manual") .. [[</a>]])
end end
m:section(SimpleSection).template = "alist_status" m:section(SimpleSection).template = "alist_status"
@ -21,6 +21,11 @@ o = s:option(Value, "port", translate("Port"))
o.datatype = "and(port,min(1))" o.datatype = "and(port,min(1))"
o.rmempty = false 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(Flag, "ssl", translate("Enable SSL")) o = s:option(Flag, "ssl", translate("Enable SSL"))
o.rmempty=false o.rmempty=false
@ -34,20 +39,4 @@ o:depends("ssl", "1")
o.datatype = "string" o.datatype = "string"
o.rmempty = true 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 return m

View File

@ -34,15 +34,6 @@ msgstr "SSL 密钥"
msgid "SSL key file path" msgid "SSL key file path"
msgstr "SSL 密钥文件路径" msgstr "SSL 密钥文件路径"
msgid "Cache settings"
msgstr "缓存设置"
msgid "Cache invalidation time (unit: minutes)"
msgstr "缓存失效时间(分钟)"
msgid "Clear the invalidation cache interval (unit: minutes)"
msgstr "清理失效缓存间隔(分钟)"
msgid "Cache directory" msgid "Cache directory"
msgstr "缓存目录" msgstr "缓存目录"

View File

@ -1,7 +1,5 @@
config alist config alist
option 'enabled' '0' option 'enabled' '0'
option 'port' '5244' option 'port' '5244'
option 'expiration' '60' option 'temp_dir' '/tmp/alist'
option 'cleanup_interval' '120'
option 'temp_dir' '/tmp'
option 'ssl' '0' option 'ssl' '0'

View File

@ -8,9 +8,7 @@ CONFIG=/etc/alist/config.json
get_config() { get_config() {
config_get_bool enabled $1 enabled 1 config_get_bool enabled $1 enabled 1
config_get port $1 port 5244 config_get port $1 port 5244
config_get expiration $1 expiration 60 config_get temp_dir $1 temp_dir "/tmp/alist"
config_get cleanup_interval $1 cleanup_interval 120
config_get temp_dir $1 temp_dir "/tmp"
config_get ssl $1 ssl 0 config_get ssl $1 ssl 0
config_get ssl_cert $1 ssl_cert "" config_get ssl_cert $1 ssl_cert ""
config_get ssl_key $1 ssl_key "" config_get ssl_key $1 ssl_key ""
@ -27,11 +25,11 @@ start_service() {
SSL=false SSL=false
fi fi
cat > $CONFIG <<EOF cat > $CONFIG <<EOF
{"address":"0.0.0.0","port":$port,"assets":"/","database":{"type":"sqlite3","user":"","password":"","host":"","port":0,"name":"","table_prefix":"x_","db_file":"/etc/alist/data.db","ssl_mode":"disable"},"scheme":{"https":$SSL,"cert_file":"$ssl_cert","key_file":"$ssl_key"},"cache":{"expiration":$expiration,"cleanup_interval":$cleanup_interval},"temp_dir":"$temp_dir"} {"force":false,"address":"0.0.0.0","port":$port,"jwt_secret":"","cdn":"","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":false,"name":"$temp_dir/alist.log","max_size":10,"max_backups":5,"max_age":28,"compress":false}}
EOF EOF
procd_open_instance alist procd_open_instance alist
procd_set_param command $PROG procd_set_param command $PROG
procd_append_param command --conf $CONFIG procd_append_param command server --conf $CONFIG
procd_set_param stdout 1 procd_set_param stdout 1
procd_set_param stderr 1 procd_set_param stderr 1
procd_set_param respawn procd_set_param respawn