From ff70952432ec302157e74d05f85e74f6de662f3e Mon Sep 17 00:00:00 2001 From: sbwml Date: Fri, 11 Aug 2023 17:29:32 +0800 Subject: [PATCH] luci-app-alist: use reset password instead of view password * view password has been deprecated in v3.25.1 --- luci-app-alist/Makefile | 2 +- luci-app-alist/luasrc/controller/alist.lua | 5 +++-- luci-app-alist/luasrc/model/cbi/alist/basic.lua | 2 +- luci-app-alist/luasrc/view/alist/admin_info.htm | 6 +++--- luci-app-alist/po/zh-cn/alist.po | 13 +++++-------- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/luci-app-alist/Makefile b/luci-app-alist/Makefile index a0fa2f77..70fc451b 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.10 +PKG_VERSION:=1.0.11 PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for alist diff --git a/luci-app-alist/luasrc/controller/alist.lua b/luci-app-alist/luasrc/controller/alist.lua index 063aa37e..d611d5cf 100644 --- a/luci-app-alist/luasrc/controller/alist.lua +++ b/luci-app-alist/luasrc/controller/alist.lua @@ -41,8 +41,9 @@ function clear_log() end function admin_info() - 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}'") + local random = luci.sys.exec("/usr/bin/alist --data $(uci -q get alist.@alist[0].data_dir) admin random 2>&1") + local username = string.match(random, "username: (%S+)") + local password = string.match(random, "password: (%S+)") luci.http.prepare_content("application/json") luci.http.write_json({username = username, password = password}) diff --git a/luci-app-alist/luasrc/model/cbi/alist/basic.lua b/luci-app-alist/luasrc/model/cbi/alist/basic.lua index 5b7723b3..d390f215 100644 --- a/luci-app-alist/luasrc/model/cbi/alist/basic.lua +++ b/luci-app-alist/luasrc/model/cbi/alist/basic.lua @@ -86,7 +86,7 @@ o.datatype = "string" o.default = "/tmp/alist" o.rmempty = false -o = s:option(Button, "admin_info", translate("View Password")) +o = s:option(Button, "admin_info", translate("Reset Password")) o.rawhtml = true o.template = "alist/admin_info" diff --git a/luci-app-alist/luasrc/view/alist/admin_info.htm b/luci-app-alist/luasrc/view/alist/admin_info.htm index c593f280..ba34e91b 100644 --- a/luci-app-alist/luasrc/view/alist/admin_info.htm +++ b/luci-app-alist/luasrc/view/alist/admin_info.htm @@ -3,7 +3,7 @@ function admin_info(btn) { btn.disabled = true; - btn.value = '<%:Reading...%>'; + btn.value = '<%:Collecting data...%>'; XHR.get('<%=luci.dispatcher.build_url("admin", "nas", "alist", "admin_info")%>', null, function(x,rv) @@ -15,12 +15,12 @@ tb.innerHTML += "<%:Password:%>" + "" + rv.password + ""; } btn.disabled = false; - btn.value = '<%:Read%>'; + btn.value = '<%:Reset%>'; } ); return false; } //]]> - + <%=self.value%> <%+cbi/valuefooter%> \ No newline at end of file diff --git a/luci-app-alist/po/zh-cn/alist.po b/luci-app-alist/po/zh-cn/alist.po index 1f996d93..bd79412b 100644 --- a/luci-app-alist/po/zh-cn/alist.po +++ b/luci-app-alist/po/zh-cn/alist.po @@ -64,8 +64,11 @@ msgstr "启用日志" msgid "Clear logs" msgstr "清空日志" -msgid "View Password" -msgstr "查看密码" +msgid "Reset Password" +msgstr "重置密码" + +msgid "Reset" +msgstr "重置" msgid "Username:" msgstr "用户名:" @@ -73,12 +76,6 @@ msgstr "用户名:" msgid "Password:" msgstr "密码:" -msgid "Reading..." -msgstr "读取中..." - -msgid "Read" -msgstr "读取" - msgid "Login Validity Period (hours)" msgstr "登录有效期(小时)"