diff --git a/luci-app-alist/Makefile b/luci-app-alist/Makefile index 8779d6371..7196c13db 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.8 +PKG_VERSION:=1.0.9 PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for alist diff --git a/luci-app-alist/luasrc/model/cbi/alist/basic.lua b/luci-app-alist/luasrc/model/cbi/alist/basic.lua index d9eea5982..b550b42a0 100644 --- a/luci-app-alist/luasrc/model/cbi/alist/basic.lua +++ b/luci-app-alist/luasrc/model/cbi/alist/basic.lua @@ -47,6 +47,11 @@ o.datatype = "and(uinteger,min(1))" o.default = "48" o.rmempty = false +o = s:option(Value, "delayed_start", translate("Delayed Start (seconds)")) +o.datatype = "and(uinteger,min(0))" +o.default = "0" +o.rmempty = false + o = s:option(Value, "temp_dir", translate("Cache directory")) o.datatype = "string" o.default = "/tmp/alist" diff --git a/luci-app-alist/po/zh-cn/alist.po b/luci-app-alist/po/zh-cn/alist.po index 65e08df72..beebf07aa 100644 --- a/luci-app-alist/po/zh-cn/alist.po +++ b/luci-app-alist/po/zh-cn/alist.po @@ -90,3 +90,6 @@ 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 结尾请勿携带 '/'" + +msgid "Delayed Start (seconds)" +msgstr "开机延时启动(秒)" diff --git a/luci-app-alist/root/etc/config/alist b/luci-app-alist/root/etc/config/alist index 1b6e0adee..75aa0b320 100644 --- a/luci-app-alist/root/etc/config/alist +++ b/luci-app-alist/root/etc/config/alist @@ -6,3 +6,4 @@ config alist option 'token_expires_in' '48' option 'max_connections' '0' option 'site_url' '' + option 'delayed_start' '0' diff --git a/luci-app-alist/root/etc/init.d/alist b/luci-app-alist/root/etc/init.d/alist index 9ee7dd51b..6edf98652 100755 --- a/luci-app-alist/root/etc/init.d/alist +++ b/luci-app-alist/root/etc/init.d/alist @@ -17,6 +17,7 @@ get_config() { 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_get delayed_start $1 delayed_start 0 config_load network config_get lan_addr lan ipaddr "0.0.0.0" if echo "${lan_addr}" | grep -Fq ' '; then @@ -52,6 +53,11 @@ start_service() { mkdir -p $temp_dir [ "$ssl" -eq 1 ] && SSL=true || SSL=false [ "$log" -eq 1 ] && LOG=true || LOG=false + if [ -e /proc/uptime ]; then + [ $(awk -F. '{print $1}' /proc/uptime) -lt "300" ] && delayed_start=$delayed_start || delayed_start=0 + else + delayed_start=$delayed_start + fi if [ "$allow_wan" -eq "1" ]; then listen_addr="0.0.0.0" external_access="allow" @@ -62,7 +68,7 @@ start_service() { set_firewall cat /dev/null > $temp_dir/alist.log cat > $CONFIG_DIR/config.json <