From 5339eca2358d84b7f3f4355e22420702f0cc7981 Mon Sep 17 00:00:00 2001 From: sbwml Date: Sun, 18 Jun 2023 11:30:34 +0800 Subject: [PATCH] luci-app-alist: add `site_url` configurable options --- luci-app-alist/luasrc/model/cbi/alist/basic.lua | 5 +++++ luci-app-alist/po/zh-cn/alist.po | 6 ++++++ luci-app-alist/root/etc/config/alist | 1 + luci-app-alist/root/etc/init.d/alist | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/luci-app-alist/luasrc/model/cbi/alist/basic.lua b/luci-app-alist/luasrc/model/cbi/alist/basic.lua index b756d51..690526b 100644 --- a/luci-app-alist/luasrc/model/cbi/alist/basic.lua +++ b/luci-app-alist/luasrc/model/cbi/alist/basic.lua @@ -14,6 +14,7 @@ o.rmempty = false o = s:option(Value, "port", translate("Port")) o.datatype = "and(port,min(1))" o.rmempty = false +o.default = "5244" o = s:option(Flag, "log", translate("Enable Logs")) o.default = 1 @@ -33,6 +34,10 @@ o:depends("ssl", "1") o = s:option(Flag, "allow_wan", translate("Allow Access From Internet")) o.rmempty = false +o = s:option(Value, "site_url", translate("Site URL"), translate("When the web is reverse proxied to a subdirectory, this option must be filled out to ensure proper functioning of the web. Do not include '/' at the end of the URL")) +o.datatype = "string" +o.rmempty = false + o = s:option(Value, "max_connections", translate("Max Connections"), translate("0 is unlimited, It is recommend to set a low number of concurrency (10-20) for poor performance device")) o.datatype = "and(uinteger,min(0))" o.default = "0" diff --git a/luci-app-alist/po/zh-cn/alist.po b/luci-app-alist/po/zh-cn/alist.po index 7c847a1..65e08df 100644 --- a/luci-app-alist/po/zh-cn/alist.po +++ b/luci-app-alist/po/zh-cn/alist.po @@ -84,3 +84,9 @@ msgstr "最大并发连接数" msgid "0 is unlimited, It is recommend to set a low number of concurrency (10-20) for poor performance device" msgstr "默认0不限制,低性能设备建议设置较低的并发数(10-20)" + +msgid "Site URL" +msgstr "站点 URL" + +msgid "When the web is reverse proxied to a subdirectory, this option must be filled out to ensure proper functioning of the web. Do not include '/' at the end of the URL" +msgstr "Web 被反向代理到二级目录时,必须填写该选项以确保 Web 正常工作。URL 结尾请勿携带 '/'" diff --git a/luci-app-alist/root/etc/config/alist b/luci-app-alist/root/etc/config/alist index b717104..1b6e0ad 100644 --- a/luci-app-alist/root/etc/config/alist +++ b/luci-app-alist/root/etc/config/alist @@ -5,3 +5,4 @@ config alist option 'ssl' '0' option 'token_expires_in' '48' option 'max_connections' '0' + option 'site_url' '' diff --git a/luci-app-alist/root/etc/init.d/alist b/luci-app-alist/root/etc/init.d/alist index 5ee99fd..9ee7dd5 100755 --- a/luci-app-alist/root/etc/init.d/alist +++ b/luci-app-alist/root/etc/init.d/alist @@ -9,6 +9,7 @@ get_config() { config_get_bool enabled $1 enabled 1 config_get port $1 port 5244 config_get log $1 log 1 + config_get site_url $1 site_url "" config_get temp_dir $1 temp_dir "/tmp/alist" config_get ssl $1 ssl 0 config_get ssl_cert $1 ssl_cert "" @@ -61,7 +62,7 @@ start_service() { set_firewall cat /dev/null > $temp_dir/alist.log cat > $CONFIG_DIR/config.json <