Skip to content

Commit

Permalink
luci-app-alist: use reset password instead of view password
Browse files Browse the repository at this point in the history
* view password has been deprecated in v3.25.1
  • Loading branch information
sbwml committed Aug 11, 2023
1 parent 683aa2b commit ff70952
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion luci-app-alist/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions luci-app-alist/luasrc/controller/alist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion luci-app-alist/luasrc/model/cbi/alist/basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 3 additions & 3 deletions luci-app-alist/luasrc/view/alist/admin_info.htm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -15,12 +15,12 @@
tb.innerHTML += "<%:Password:%>" + "<font color='green'>" + rv.password + "</font>";
}
btn.disabled = false;
btn.value = '<%:Read%>';
btn.value = '<%:Reset%>';
}
);
return false;
}
//]]></script>
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Read%>" onclick="return admin_info(this)" />
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Reset%>" onclick="return admin_info(this)" />
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
<%+cbi/valuefooter%>
13 changes: 5 additions & 8 deletions luci-app-alist/po/zh-cn/alist.po
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,18 @@ msgstr "启用日志"
msgid "Clear logs"
msgstr "清空日志"

msgid "View Password"
msgstr "查看密码"
msgid "Reset Password"
msgstr "重置密码"

msgid "Reset"
msgstr "重置"

msgid "Username:"
msgstr "用户名:"

msgid "Password:"
msgstr "密码:"

msgid "Reading..."
msgstr "读取中..."

msgid "Read"
msgstr "读取"

msgid "Login Validity Period (hours)"
msgstr "登录有效期(小时)"

Expand Down

0 comments on commit ff70952

Please sign in to comment.