From 8b154485112f07d66f3e4440008f7e9d8c090abd Mon Sep 17 00:00:00 2001 From: Bard Date: Thu, 22 Jun 2023 12:59:18 +0800 Subject: [PATCH] luci-app-alist: fix `data_dir` --- luci-app-alist/luasrc/controller/alist.lua | 4 ++-- luci-app-alist/root/etc/init.d/alist | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/luci-app-alist/luasrc/controller/alist.lua b/luci-app-alist/luasrc/controller/alist.lua index 4f192ec..063aa37 100644 --- a/luci-app-alist/luasrc/controller/alist.lua +++ b/luci-app-alist/luasrc/controller/alist.lua @@ -41,8 +41,8 @@ function clear_log() end function admin_info() - local username = luci.sys.exec("/usr/bin/alist --data /etc/alist password 2>&1 | tail -2 | awk 'NR==1 {print $2}'") - local password = luci.sys.exec("/usr/bin/alist --data /etc/alist password 2>&1 | tail -2 | awk 'NR==2 {print $2}'") + local username = luci.sys.exec("/usr/bin/alist --data $(uci -q get alist.@alist[0].data_dir) password 2>&1 | tail -2 | awk 'NR==1 {print $2}'") + local password = luci.sys.exec("/usr/bin/alist --data $(uci -q get alist.@alist[0].data_dir) password 2>&1 | tail -2 | awk 'NR==2 {print $2}'") luci.http.prepare_content("application/json") luci.http.write_json({username = username, password = password}) diff --git a/luci-app-alist/root/etc/init.d/alist b/luci-app-alist/root/etc/init.d/alist index fa5d36a..c6de70f 100755 --- a/luci-app-alist/root/etc/init.d/alist +++ b/luci-app-alist/root/etc/init.d/alist @@ -59,7 +59,7 @@ start_service() { config_load alist config_foreach get_config alist [ $enabled != 1 ] && return 1 - mkdir -p $temp_dir + mkdir -p $temp_dir $data_dir [ "$ssl" -eq 1 ] && SSL=true || SSL=false [ "$log" -eq 1 ] && LOG=true || LOG=false if [ -e /proc/uptime ]; then