luci-app-alist: add site_url configurable options

This commit is contained in:
sbwml 2023-06-18 11:30:34 +08:00
parent a86f0ee820
commit 5339eca235
4 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@ o.rmempty = false
o = s:option(Value, "port", translate("Port")) 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.default = "5244"
o = s:option(Flag, "log", translate("Enable Logs")) o = s:option(Flag, "log", translate("Enable Logs"))
o.default = 1 o.default = 1
@ -33,6 +34,10 @@ o:depends("ssl", "1")
o = s:option(Flag, "allow_wan", translate("Allow Access From Internet")) o = s:option(Flag, "allow_wan", translate("Allow Access From Internet"))
o.rmempty = false 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 = 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.datatype = "and(uinteger,min(0))"
o.default = "0" o.default = "0"

View File

@ -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" msgid "0 is unlimited, It is recommend to set a low number of concurrency (10-20) for poor performance device"
msgstr "默认0不限制低性能设备建议设置较低的并发数10-20" 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 结尾请勿携带 '/'"

View File

@ -5,3 +5,4 @@ config alist
option 'ssl' '0' option 'ssl' '0'
option 'token_expires_in' '48' option 'token_expires_in' '48'
option 'max_connections' '0' option 'max_connections' '0'
option 'site_url' ''

View File

@ -9,6 +9,7 @@ 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 log $1 log 1 config_get log $1 log 1
config_get site_url $1 site_url ""
config_get temp_dir $1 temp_dir "/tmp/alist" config_get temp_dir $1 temp_dir "/tmp/alist"
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 ""
@ -61,7 +62,7 @@ start_service() {
set_firewall set_firewall
cat /dev/null > $temp_dir/alist.log cat /dev/null > $temp_dir/alist.log
cat > $CONFIG_DIR/config.json <<EOF cat > $CONFIG_DIR/config.json <<EOF
{"force":false,"address":"$listen_addr","port":$port,"https_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":{"disable_http":$SSL,"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},"max_connections":$max_connections} {"force":false,"address":"$listen_addr","port":$port,"https_port":$port,"site_url":"$site_url","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":{"disable_http":$SSL,"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},"max_connections":$max_connections}
EOF EOF
procd_open_instance alist procd_open_instance alist
procd_set_param command $PROG procd_set_param command $PROG