update 2024-09-08 00:13:16

This commit is contained in:
actions-user 2024-09-08 00:13:16 +08:00
parent f9a8e91a6c
commit 355552d1b5
3 changed files with 17 additions and 5 deletions

View File

@ -784,7 +784,7 @@ function to_check(arch, app_name)
remote_version = remote_version:gsub(com[app_name].remote_version_str_replace, "")
end
local has_update = compare_versions(local_version:match("[^v]+"), "<", remote_version:match("[^v]+"))
--[[
if not has_update then
return {
code = 0,
@ -792,7 +792,7 @@ function to_check(arch, app_name)
remote_version = remote_version
}
end
]]--
local asset = {}
for _, v in ipairs(json.assets) do
if v.name and v.name:match(match_file_name) then
@ -813,7 +813,7 @@ function to_check(arch, app_name)
return {
code = 0,
has_update = true,
has_update = has_update,
local_version = local_version,
remote_version = remote_version,
html_url = json.html_url,
@ -1003,6 +1003,7 @@ function to_check_self()
end
local local_version = get_version()
local remote_version = sys.exec("echo -n $(grep 'PKG_VERSION' /tmp/passwall_makefile|awk -F '=' '{print $2}')")
exec("/bin/rm", {"-f", tmp_file})
local has_update = compare_versions(local_version, "<", remote_version)
if not has_update then

View File

@ -10,6 +10,8 @@ local version = {}
var inProgressCount = 0;
var tokenStr = '<%=token%>';
var checkUpdateText = '<%:Check update%>';
var forceUpdateText = '<%:Force update%>';
var retryText = '<%:Retry%>';
var noUpdateText = '<%:It is the latest version%>';
var updateSuccessText = '<%:Update successful%>';
var clickToUpdateText = '<%:Click to update%>';
@ -55,7 +57,7 @@ local version = {}
function onRequestError(btn, errorMessage) {
btn.disabled = false;
btn.value = checkUpdateText;
btn.value = retryText;
var ckeckDetailElm = document.getElementById(btn.id + '-detail');
if (errorMessage && ckeckDetailElm) {
@ -90,8 +92,8 @@ local version = {}
appInfoList[app] = undefined;
onRequestError(btn, json.error);
} else {
appInfoList[app] = json;
if (json.has_update) {
appInfoList[app] = json;
btn.disabled = false;
btn.value = clickToUpdateText;
btn.placeholder = clickToUpdateText;
@ -109,6 +111,7 @@ local version = {}
} else {
btn.disabled = true;
btn.value = noUpdateText;
window['_' + app + '-force_btn'].style.display = "inline";
}
}
}, 300);
@ -197,6 +200,8 @@ local version = {}
<span><%=version[k] ~="" and version[k] or translate("Null") %> 】</span>
<input class="btn cbi-button cbi-button-apply" type="button" id="_<%=k%>-check_btn"
onclick="onBtnClick(this,'<%=k%>');" value="<%:Check update%>" />
<input class="btn cbi-button cbi-button-apply" type="button" id="_<%=k%>-force_btn"
onclick="doUpdate(this,'<%=k%>');" value="<%:Force update%>" style="display:none"/>
<span id="_<%=k%>-check_btn-detail"></span>
</div>
</div>

View File

@ -841,6 +841,9 @@ msgstr "备用"
msgid "Check update"
msgstr "检查更新"
msgid "Force update"
msgstr "强制更新"
msgid "Manually update"
msgstr "手动更新"
@ -934,6 +937,9 @@ msgstr "点击更新"
msgid "Updating..."
msgstr "更新中"
msgid "Retry"
msgstr "重试"
msgid "Unexpected error"
msgstr "意外错误"