luci-app-alist: Add max connections setting

This commit is contained in:
sbwml 2023-02-21 20:17:51 +08:00
parent 1496bdfe5c
commit 9d6f8d3dbb
5 changed files with 15 additions and 2 deletions

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-alist
PKG_VERSION:=1.0.7
PKG_VERSION:=1.0.8
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for alist

View File

@ -33,6 +33,11 @@ o:depends("ssl", "1")
o = s:option(Flag, "allow_wan", translate("Allow Access From Internet"))
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"
o.rmempty = false
o = s:option(Value, "token_expires_in", translate("Login Validity Period (hours)"))
o.datatype = "and(uinteger,min(0))"
o.default = "48"

View File

@ -75,3 +75,9 @@ msgstr "读取"
msgid "Login Validity Period (hours)"
msgstr "登录有效期(小时)"
msgid "Max Connections"
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"

View File

@ -4,3 +4,4 @@ config alist
option 'temp_dir' '/tmp/alist'
option 'ssl' '0'
option 'token_expires_in' '48'
option 'max_connections' '0'

View File

@ -15,6 +15,7 @@ get_config() {
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_get max_connections $1 max_connections 0
config_load network
config_get lan_addr lan ipaddr "0.0.0.0"
if echo "${lan_addr}" | grep -Fq ' '; then
@ -60,7 +61,7 @@ start_service() {
set_firewall
cat /dev/null > $temp_dir/alist.log
cat > $CONFIG_DIR/config.json <<EOF
{"force":false,"address":"$listen_addr","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":{"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}}
{"force":false,"address":"$listen_addr","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":{"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
procd_open_instance alist
procd_set_param command $PROG