🗽 Sync 2026-11-16 05:29:50

This commit is contained in:
github-actions[bot] committed 2026-11-16 05:29:50 +08:00
1 parent 9145e782b9
commit 30cbf03f19
10 files changed
+459 -126

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ghfu
PKG_VERSION:=1.6.1
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_LICENSE:=GPL-3.0-only
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Kiddin'
+13 -13
View File
@@ -1177,7 +1177,7 @@ function index()
return
end
entry({"admin", "system", "ghfu"}, call("action_index"), _("System Online Upgrade"), 65)
entry({"admin", "system", "ghfu"}, call("action_index"), _("System Online Upgrade"), 2)
entry({"admin", "system", "ghfu", "status"}, call("action_status")).leaf = true
entry({"admin", "system", "ghfu", "local_status"}, call("action_local_status")).leaf = true
entry({"admin", "system", "ghfu", "sysversion_check"}, call("action_sysversion_check")).leaf = true
@@ -1469,8 +1469,8 @@ function action_download()
"fi\n",
})
logs[#logs + 1] = tr("Downloading firmware: ") .. clean_name
local start_cmd = "sh -c " .. util.shellquote("(" .. shell_script .. ") >/dev/null 2>&1 &")
logs[#logs + 1] = tr("Downloading firmware:") .. " " .. clean_name
local start_cmd = "sh -c " .. util.shellquote("(" .. shell_script .. ") </dev/null >/dev/null 2>&1 &")
local rc = sys.call(start_cmd)
if rc ~= 0 then
logs[#logs + 1] = tr("Firmware download failed, please check network connection")
@@ -1531,23 +1531,23 @@ function action_download_status()
if pct then
local speed_text = human_bytes(rate) .. "/s"
if tonumber(total) and tonumber(total) > 0 then
logs[#logs + 1] = tr("Download progress: ") .. pct .. "% (" .. human_bytes(size) .. "/" .. human_bytes(total) .. "), " .. tr("Speed: ") .. speed_text
logs[#logs + 1] = tr("Download progress:") .. " " .. pct .. "% (" .. human_bytes(size) .. "/" .. human_bytes(total) .. "), " .. tr("Speed:") .. " " .. speed_text
else
logs[#logs + 1] = tr("Download progress: ") .. human_bytes(size) .. ", " .. tr("Speed: ") .. speed_text
logs[#logs + 1] = tr("Download progress:") .. " " .. human_bytes(size) .. ", " .. tr("Speed:") .. " " .. speed_text
end
else
local status2, done_size, done_total, target2 = line:match("^DONE|([A-Z]+)|(%d+)|(%d+)|(.+)$")
if status2 then
if status2 == "OK" then
if tonumber(done_total) and tonumber(done_total) > 0 then
logs[#logs + 1] = tr("Download finished: ") .. human_bytes(done_size) .. "/" .. human_bytes(done_total)
logs[#logs + 1] = tr("Download finished:") .. " " .. human_bytes(done_size) .. "/" .. human_bytes(done_total)
else
logs[#logs + 1] = tr("Download finished: ") .. human_bytes(done_size)
logs[#logs + 1] = tr("Download finished:") .. " " .. human_bytes(done_size)
end
local name2 = tostring(target2 or ""):match("/tmp/ghfu_(.+)$")
if name2 and name2 ~= "" then
logs[#logs + 1] = name2 .. tr(" downloaded successfully")
logs[#logs + 1] = name2 .. " " .. tr("downloaded successfully")
end
else
logs[#logs + 1] = tr("Firmware download failed, please check network connection")
@@ -1555,13 +1555,13 @@ function action_download_status()
else
local sha256ok_hash = line:match("^SHA256OK|([a-f0-9]+)$")
if sha256ok_hash then
logs[#logs + 1] = tr("SHA256 verification passed: ") .. sha256ok_hash
logs[#logs + 1] = tr("SHA256 verification passed:") .. " " .. sha256ok_hash
else
local comp, exp = line:match("^SHA256FAIL|([a-f0-9]+)|([a-f0-9]+)$")
if comp then
logs[#logs + 1] = tr("SHA256 verification failed, upgrade cancelled")
logs[#logs + 1] = tr(" Expected: ") .. exp
logs[#logs + 1] = tr(" Got: ") .. comp
logs[#logs + 1] = " " .. tr("Expected:") .. " " .. exp
logs[#logs + 1] = " " .. tr("Got:") .. " " .. comp
else
local err_line = line:match("^ERR|(.+)$")
if err_line and trim(err_line) ~= "" then
@@ -1580,7 +1580,7 @@ function action_download_status()
if validation.valid then
logs[#logs + 1] = tr("Firmware image validation passed")
else
logs[#logs + 1] = tr("Image check failed: ") .. (validation.message ~= "" and validation.message or tr("The uploaded image file does not contain a supported format."))
logs[#logs + 1] = tr("Image check failed:") .. " " .. (validation.message ~= "" and validation.message or tr("The uploaded image file does not contain a supported format."))
end
end
@@ -1688,7 +1688,7 @@ function action_upgrade()
logs[#logs + 1] = tr("Package mode: retain installed packages (-k)")
end
local bg = string.format("(sleep 2; %s >/tmp/ghfu-upgrade.log 2>&1) &", up_cmd)
local bg = "sh -c " .. util.shellquote(string.format("(sleep 2; %s) </dev/null >/tmp/ghfu-upgrade.log 2>&1 &", up_cmd))
sys.call(bg)
json_resp({
@@ -8,21 +8,338 @@ if fs.access("/etc/config/luci") then
end
if autoupgrade_fm == "1" then
-%>
<style>
.ghfu-top-banner {
--ghfu-tb-bg: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
--ghfu-tb-border: #93c5fd;
--ghfu-tb-accent-bar: #2563eb;
--ghfu-tb-text: #1e293b;
--ghfu-tb-muted: #475569;
--ghfu-tb-ver-bg: #dcfce7;
--ghfu-tb-ver-text: #15803d;
--ghfu-tb-ver-border: #86efac;
--ghfu-tb-tag-bg: #dbeafe;
--ghfu-tb-tag-text: #1d4ed8;
--ghfu-tb-tag-border: #93c5fd;
--ghfu-tb-btn-bg: #2563eb;
--ghfu-tb-btn-hover: #1d4ed8;
--ghfu-tb-btn-text: #ffffff;
--ghfu-tb-close-color: #64748b;
--ghfu-tb-close-hover: rgba(15, 23, 42, 0.08);
--ghfu-tb-close-htext: #0f172a;
--ghfu-tb-shadow: 0 2px 8px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
width: 100%;
box-sizing: border-box;
margin: 0 0 10px 0;
padding: 10px 14px;
border-radius: 10px;
border: 1px solid var(--ghfu-tb-border);
border-left: 4px solid var(--ghfu-tb-accent-bar);
background: var(--ghfu-tb-bg);
color: var(--ghfu-tb-text);
box-shadow: var(--ghfu-tb-shadow);
font-size: 13px;
line-height: 1.5;
position: relative;
z-index: 20;
transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ghfu-top-banner[data-ghfu-dark="1"] {
--ghfu-tb-bg: linear-gradient(135deg, #1e293b 0%, #17253b 100%);
--ghfu-tb-border: #3b82f6;
--ghfu-tb-accent-bar: #60a5fa;
--ghfu-tb-text: #e2e8f0;
--ghfu-tb-muted: #94a3b8;
--ghfu-tb-ver-bg: rgba(34, 197, 94, 0.18);
--ghfu-tb-ver-text: #4ade80;
--ghfu-tb-ver-border: rgba(74, 222, 128, 0.38);
--ghfu-tb-tag-bg: rgba(59, 130, 246, 0.20);
--ghfu-tb-tag-text: #93c5fd;
--ghfu-tb-tag-border: rgba(96, 165, 250, 0.40);
--ghfu-tb-btn-bg: #3b82f6;
--ghfu-tb-btn-hover: #2563eb;
--ghfu-tb-btn-text: #ffffff;
--ghfu-tb-close-color: #94a3b8;
--ghfu-tb-close-hover: rgba(255, 255, 255, 0.10);
--ghfu-tb-close-htext: #f8fafc;
--ghfu-tb-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
}
.ghfu-top-banner.ghfu-top-banner-closing {
opacity: 0;
transform: translateY(-6px);
pointer-events: none;
}
.ghfu-top-banner-main {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px 10px;
flex: 1 1 auto;
min-width: 0;
text-decoration: none !important;
color: inherit !important;
cursor: pointer;
}
.ghfu-top-banner-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #22c55e;
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
flex-shrink: 0;
}
.ghfu-top-banner-title {
font-weight: 700;
color: var(--ghfu-tb-text);
white-space: nowrap;
}
.ghfu-top-banner-ver {
display: inline-flex;
align-items: center;
padding: 1px 9px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
background: var(--ghfu-tb-ver-bg);
color: var(--ghfu-tb-ver-text);
border: 1px solid var(--ghfu-tb-ver-border);
}
.ghfu-top-banner-badge {
display: inline-flex;
align-items: center;
padding: 1px 8px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
background: var(--ghfu-tb-tag-bg);
color: var(--ghfu-tb-tag-text);
border: 1px solid var(--ghfu-tb-tag-border);
}
.ghfu-top-banner-cur {
font-size: 12px;
color: var(--ghfu-tb-muted);
}
.ghfu-top-banner-actions {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.ghfu-top-banner-go {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 12px;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
background: var(--ghfu-tb-btn-bg);
color: var(--ghfu-tb-btn-text) !important;
text-decoration: none !important;
transition: background 0.15s ease;
white-space: nowrap;
}
.ghfu-top-banner-go:hover {
background: var(--ghfu-tb-btn-hover);
}
.ghfu-top-banner-close {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
margin: 0;
border: none;
border-radius: 6px;
background: transparent;
color: var(--ghfu-tb-close-color);
font-size: 15px;
line-height: 1;
cursor: pointer;
transition: background 0.15s ease, color 0.15s ease;
}
.ghfu-top-banner-close:hover {
background: var(--ghfu-tb-close-hover);
color: var(--ghfu-tb-close-htext);
}
</style>
<script type="text/javascript">
(function() {
var checkUrl = '<%=url([[admin]], [[system]], [[ghfu]], [[sysversion_check]])%>';
var upgradeUrl = '<%=url([[admin]], [[system]], [[ghfu]])%>';
var I18N = {
newVerAvailable: '<%:New version available%>',
formalRelease: '<%:Formal Release%>',
curSysVer: '<%:Current system version%>',
upgradeNow: '<%:Upgrade Now%>',
closeBtn: '<%:Close%>'
};
function escHtml(s) {
return String(s || '').replace(/[&<>"']/g, function(c) {
return ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c];
});
}
function detectDarkTheme() {
var html = document.documentElement;
var body = document.body;
var attrs = [
body && body.getAttribute('data-theme'),
body && body.getAttribute('data-bs-theme'),
body && body.getAttribute('data-color-scheme'),
body && body.getAttribute('data-argon-mode'),
html && html.getAttribute('data-theme'),
html && html.getAttribute('data-bs-theme'),
html && html.getAttribute('data-color-scheme'),
html && html.getAttribute('data-argon-mode')
];
for (var a = 0; a < attrs.length; a++) {
var val = (attrs[a] || '').toLowerCase();
if (val.indexOf('dark') !== -1 || val.indexOf('black') !== -1 || val.indexOf('night') !== -1) return true;
if (val.indexOf('light') !== -1 || val.indexOf('white') !== -1 || val.indexOf('day') !== -1) return false;
}
var darkClasses = ['dark', 'is-dark', 'night', 'dark-mode', 'theme-dark', 'luci-dark'];
var lightClasses = ['light', 'is-light', 'day', 'light-mode', 'theme-light', 'luci-light'];
for (var i = 0; i < darkClasses.length; i++) {
if ((body && body.classList.contains(darkClasses[i])) || (html && html.classList.contains(darkClasses[i]))) return true;
}
for (var j = 0; j < lightClasses.length; j++) {
if ((body && body.classList.contains(lightClasses[j])) || (html && html.classList.contains(lightClasses[j]))) return false;
}
var targets = [
document.querySelector('#maincontent'),
document.querySelector('.main-right'),
document.querySelector('main'),
body,
html
];
for (var k = 0; k < targets.length; k++) {
var el = targets[k];
if (!el) continue;
try {
var bg = window.getComputedStyle(el).backgroundColor || '';
var m = bg.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
if (m) {
var alpha = m[4] !== undefined ? parseFloat(m[4]) : 1;
if (alpha > 0.15) {
var lum = (0.299 * +m[1] + 0.587 * +m[2] + 0.114 * +m[3]) / 255;
return lum < 0.45;
}
}
} catch (e) {}
}
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return true;
}
return false;
}
function syncBannerTheme(banner) {
if (!banner) return;
if (detectDarkTheme()) {
banner.setAttribute('data-ghfu-dark', '1');
} else {
banner.removeAttribute('data-ghfu-dark');
}
}
function mountTopBanner(json) {
var existing = document.getElementById('ghfu_sysupgrade_top_banner');
if (existing) {
existing.remove();
}
var container = document.querySelector('#maincontent') ||
document.querySelector('.main-right') ||
document.querySelector('main') ||
document.body;
if (!container) return;
var banner = document.createElement('div');
banner.id = 'ghfu_sysupgrade_top_banner';
banner.className = 'ghfu-top-banner';
syncBannerTheme(banner);
var curVerHtml = '';
if (json.now_version) {
curVerHtml = '<span class="ghfu-top-banner-cur">(' + escHtml(I18N.curSysVer) + ': ' + escHtml(json.now_version) + ')</span>';
}
banner.innerHTML =
'<a class="ghfu-top-banner-main" href="' + escHtml(upgradeUrl) + '">' +
'<span class="ghfu-top-banner-dot"></span>' +
'<span class="ghfu-top-banner-title">' + escHtml(I18N.newVerAvailable) + '</span>' +
'<span class="ghfu-top-banner-ver">' + escHtml(json.version) + '</span>' +
'<span class="ghfu-top-banner-badge">' + escHtml(I18N.formalRelease) + '</span>' +
curVerHtml +
'</a>' +
'<div class="ghfu-top-banner-actions">' +
'<a class="ghfu-top-banner-go" href="' + escHtml(upgradeUrl) + '">' + escHtml(I18N.upgradeNow) + ' &rarr;</a>' +
'<button type="button" class="ghfu-top-banner-close" id="ghfu_top_banner_close" title="' + escHtml(I18N.closeBtn) + '" aria-label="' + escHtml(I18N.closeBtn) + '">&#10005;</button>' +
'</div>';
container.insertBefore(banner, container.firstChild);
var closeBtn = banner.querySelector('#ghfu_top_banner_close');
if (closeBtn) {
closeBtn.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
banner.classList.add('ghfu-top-banner-closing');
setTimeout(function() {
if (banner.parentNode) {
banner.parentNode.removeChild(banner);
}
}, 180);
});
}
if (window.MutationObserver) {
var obs = new MutationObserver(function() { syncBannerTheme(banner); });
if (document.documentElement) {
obs.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-theme', 'data-bs-theme', 'data-color-scheme', 'data-argon-mode'] });
}
if (document.body) {
obs.observe(document.body, { attributes: true, attributeFilter: ['class', 'style', 'data-theme', 'data-bs-theme', 'data-color-scheme', 'data-argon-mode'] });
}
}
if (window.matchMedia) {
var mq = window.matchMedia('(prefers-color-scheme: dark)');
if (mq.addEventListener) {
mq.addEventListener('change', function() { syncBannerTheme(banner); });
}
}
}
fetch(checkUrl, { method: 'GET', credentials: 'include' })
.then(function(r) { return r.json(); })
.then(function(json) {
if (json && json.code === 0 && json.notice && json.version) {
var mainContent = document.querySelector("#maincontent");
if (mainContent) {
var banner = document.createElement("div");
banner.className = "alert-message fade-in success";
banner.style.cssText = "display:flex;margin-top:-1.5rem;padding:0.31rem 0rem;";
banner.innerHTML = '<div style="flex:10"><a href="<%=url([[admin]], [[system]], [[ghfu]])%>"><p><%:New version available%>:' + json.version + '</p></a></div>';
mainContent.insertBefore(banner, mainContent.firstChild);
}
mountTopBanner(json);
}
})
.catch(function() {});
+49 -32
View File
@@ -820,7 +820,6 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
keepLabel: '<%:Keep Configuration%>',
retainPkgLabel: '<%:Retain Installed Packages%>',
statusLabel: '<%:System and Firmware Status%>',
assetsLabel: '<%:Available Firmware%>',
assetsLabelWithCount: '<%:Available Firmware (%d)%>',
logLabel: '<%:Logs%>',
changelogLabel: '<%:Firmware Changelog%>',
@@ -829,12 +828,11 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
flashLatestBtn: '<%:Flash this latest firmware%>',
reflashLatestBtn: '<%:Already latest version, sure to reflash this version?%>',
flashOldBtn: '<%:Sure to flash this older version?%>',
waitingStatus: '<%:Waiting to check firmware%>',
noMatch: '<%:No matching firmware%>',
beginFetch: '<%:Checking latest firmware%>',
fetchFailed: '<%:Check failed%>',
requestFailed: '<%:Request failed: %>',
latestRelease: '<%:Latest version: %>',
requestFailed: '<%:Request failed:%>',
latestRelease: '<%:Latest version:%>',
statusUpdated: '<%:Status updated%>',
currentVersion: '<%:Current system version%>',
currentDevice: '<%:Current device%>',
@@ -846,16 +844,15 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
fetchFieldFailed: '<%:Fetch failed%>',
chooseFirmware: '<%:Please select firmware to upgrade%>',
chooseAsset: '<%:Please select a firmware asset%>',
upgradeReqFailed: '<%:Upgrade request failed: %>',
selectedFirmware: '<%:Selected firmware: %>',
unknown: '<%:unknown%>',
upgradeReqFailed: '<%:Upgrade request failed:%>',
selectedFirmware: '<%:Selected firmware:%>',
backupBtn: '<%:Download Backup%>',
upgradingTitle: '<%:Upgrading System%>',
upgradingMsg: '<%:Upgrade successful, Waiting for device...%>',
unreachableMsg: '<%:Device unreachable! Still waiting for device...%>',
beginDownload: '<%:Starting download: %>',
countdownPrefix: '<%:System upgrade will start in %>',
countdownSuffix: '<%: seconds%>',
beginDownload: '<%:Starting download:%>',
countdownLogMsg: '<%:System upgrade will start in %d seconds%>',
startingSystemUpgrade: '<%:Starting system upgrade%>',
startingUpgrade: '<%:Flashing...%>',
countdownLockTitle: '<%:Firmware Download Completed%>',
countdownLockMsg: '<%:Firmware is ready. System upgrade will start in %d seconds. Please do not leave this page.%>',
@@ -875,14 +872,15 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
valTitle: '<%:Firmware Image Check Failed%>',
valSummary: '<%:The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.%>',
valForceLabel: '<%:Force upgrade%>',
valForceDesc: '<%:Select \'Force upgrade\' to flash the image even if the image format check fails. Use only if you are sure that the firmware is correct and meant for your device!%>',
valForceDesc: "<%:Select 'Force upgrade' to flash the image even if the image format check fails. Use only if you are sure that the firmware is correct and meant for your device!%>",
valNotForceable: '<%:Force upgrade is disallowed for this image by the system validator.%>',
valNoBackupWarn: '<%:The image does not support keeping current configuration; configuration retention will be disabled (-n).%>',
valCancelBtn: '<%:Cancel%>',
valContinueBtn: '<%:Force Flash%>',
valCancelledLog: '<%:Upgrade cancelled by user after firmware check warning%>',
sizeLabel: '<%:Size%>',
sha256Label: '<%:SHA256%>'
sha256Label: '<%:SHA256%>',
invalidJsonResp: '<%:Server returned invalid JSON response%>'
};
var BUILTIN_VALID_EXTS = ['.img.gz', '.img', '.bin', '.tar.gz', '.tar', '.itb', '.trx', '.chk', '.dlf', '.ari'];
@@ -1064,7 +1062,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
renderAssets();
updateUpgradeButtonText();
if (!silent) {
appendLog(t('selectedFirmware') + (asset.name || ''));
appendLog(t('selectedFirmware') + ' ' + (asset.name || ''));
}
}
@@ -1297,7 +1295,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
try {
return JSON.parse(txt);
} catch (e) {
throw new Error('Server returned invalid JSON response');
throw new Error(t('invalidJsonResp'));
}
});
}
@@ -1653,7 +1651,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
pollDownloadProgress(keepConfig, retainPkg, resp.next_offset || 0);
}, 1000);
}).catch(function(err) {
appendLog(t('requestFailed') + err);
appendLog(t('requestFailed') + ' ' + err);
restoreButtonsAfterDownload();
stopDownloadPolling();
});
@@ -1764,7 +1762,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
lastFlashedRaw: (resp.config && resp.config.selected_release) || lastFlashedFirmwareText
});
appendLog(t('latestRelease') + ((resp.latest && resp.latest.release_name) || '-'));
appendLog(t('latestRelease') + ' ' + ((resp.latest && resp.latest.release_name) || '-'));
appendLog(resp.msg || t('statusUpdated'));
syncInteractiveState();
@@ -1786,7 +1784,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
if (err && err.name === 'AbortError') {
appendLog(t('fetchTimedOut'));
} else {
appendLog(t('requestFailed') + err);
appendLog(t('requestFailed') + ' ' + err);
}
});
}
@@ -1824,7 +1822,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
setUpgradeWorkflowBusy(true);
stopDownloadPolling();
appendLog(t('beginDownload') + (selectedAsset.name || selectedRelease));
appendLog(t('beginDownload') + ' ' + (selectedAsset.name || selectedRelease));
request('<%=url([[admin]], [[system]], [[ghfu]], [[download]])%>', {
selected_release: selectedRelease,
@@ -1853,7 +1851,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
restoreButtonsAfterDownload();
}
}).catch(function(err) {
appendLog(t('upgradeReqFailed') + err);
appendLog(t('upgradeReqFailed') + ' ' + err);
restoreButtonsAfterDownload();
});
}
@@ -1863,7 +1861,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
var sec = 5;
activeCountdownFwName = fwName;
showUpgradeModal('countdown', sec);
appendLog(t('countdownPrefix') + sec + t('countdownSuffix'));
appendLog(t('countdownLogMsg').replace('%d', String(sec)));
countdownTimer = setInterval(function() {
sec--;
if (sec <= 0) {
@@ -1874,7 +1872,7 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
doUpgradeRequest(fwName, keepConfig, retainPkg, forceUpgrade);
} else {
showUpgradeModal('countdown', sec);
appendLog(t('countdownPrefix') + sec + t('countdownSuffix'));
appendLog(t('countdownLogMsg').replace('%d', String(sec)));
}
}, 1000);
}
@@ -1894,13 +1892,13 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
}
function doUpgradeRequest(fwName, keepConfig, retainPkg, forceUpgrade) {
request('<%=url([[admin]], [[system]], [[ghfu]], [[upgrade]])%>', {
requestWithTimeout('<%=url([[admin]], [[system]], [[ghfu]], [[upgrade]])%>', {
fw_name: fwName,
selected_release: trim(selectedReleaseText || fwName),
keep_config: keepConfig,
retain_packages: retainPkg,
force: forceUpgrade ? '1' : '0'
}).then(function(resp) {
}, 25000).then(function(resp) {
var lines = normalizeLogLines(resp.logs);
lines.forEach(appendLog);
if (resp.ok && resp.rebooting) {
@@ -1916,9 +1914,10 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
}
restoreButtonsAfterDownload();
}).catch(function(err) {
appendLog(t('upgradeReqFailed') + err);
hideUpgradeModal();
restoreButtonsAfterDownload();
// sysupgrade may terminate uhttpd or drop the connection before HTTP response finishes
appendLog(t('startingSystemUpgrade'));
showUpgradeModal('upgrading');
pollForReboot();
});
}
@@ -1992,29 +1991,47 @@ Adapted exclusively for https://dl.openwrt.ai/firmware with built-in firmware fi
var poll = function() {
rebootPollTimer = setTimeout(function() {
rebootPollAttempts++;
if (rebootPollAttempts >= 30 && byId('ghfu_modal_msg')) {
if (rebootPollAttempts >= 60 && byId('ghfu_modal_msg')) {
byId('ghfu_modal_msg').textContent = t('unreachableMsg');
}
var settled = false;
var img = new Image();
var probeTimeout = setTimeout(function() {
if (settled) { return; }
settled = true;
img.onload = null;
img.onerror = null;
rebootSeenOffline = true;
poll();
}, 3500);
img.onload = function() {
if (!rebootSeenOffline && rebootPollAttempts < 3) {
if (settled) { return; }
settled = true;
clearTimeout(probeTimeout);
if (!rebootSeenOffline && rebootPollAttempts < 12) {
poll();
return;
}
clearTimeout(rebootPollTimer);
hideUpgradeModal();
window.location.href = adminHomeUrl;
setTimeout(function() {
hideUpgradeModal();
window.location.href = adminHomeUrl;
}, 2000);
};
img.onerror = function() {
if (settled) { return; }
settled = true;
clearTimeout(probeTimeout);
rebootSeenOffline = true;
poll();
};
img.src = pingUrl + '?_=' + Date.now();
}, 3000);
}, 4000);
};
rebootPollTimer = setTimeout(poll, 6000);
rebootPollTimer = setTimeout(poll, 15000);
}
function blockNavigationWhileUpgrading(evt) {
+35 -32
View File
@@ -67,11 +67,11 @@ msgstr "正在检查最新固件"
msgid "Check failed"
msgstr "检查失败"
msgid "Request failed: "
msgstr "请求失败: "
msgid "Request failed:"
msgstr "请求失败:"
msgid "Latest version: "
msgstr "最新版本: "
msgid "Latest version:"
msgstr "最新版本:"
msgid "Status updated"
msgstr "状态已更新"
@@ -109,11 +109,11 @@ msgstr "请选择要升级的固件"
msgid "Please select a firmware asset"
msgstr "请选择固件下载项"
msgid "Upgrade request failed: "
msgstr "升级请求失败: "
msgid "Upgrade request failed:"
msgstr "升级请求失败:"
msgid "Selected firmware: "
msgstr "已选择固件: "
msgid "Selected firmware:"
msgstr "已选择固件:"
msgid "New firmware is available"
msgstr "检测到新固件,可升级"
@@ -124,6 +124,12 @@ msgstr "当前系统已是最新版本"
msgid "New version available"
msgstr "新版本可用"
msgid "Upgrade Now"
msgstr "前往更新"
msgid "Close"
msgstr "关闭"
msgid "Formal Release"
msgstr "正式版"
@@ -148,20 +154,20 @@ msgstr "服务端返回了无效的 JSON 响应"
msgid "Invalid firmware URL, only https://dl.openwrt.ai/firmware is supported"
msgstr "固件下载地址非法,仅支持 https://dl.openwrt.ai/firmware 官方源"
msgid "Downloading firmware: "
msgstr "正在下载固件: "
msgid "Downloading firmware:"
msgstr "正在下载固件:"
msgid "Download progress: "
msgstr "下载进度: "
msgid "Download progress:"
msgstr "下载进度:"
msgid "Speed: "
msgstr "速率: "
msgid "Speed:"
msgstr "速率:"
msgid "Download finished: "
msgstr "下载完成: "
msgid "Download finished:"
msgstr "下载完成:"
msgid " downloaded successfully"
msgstr " 下载成功"
msgid "downloaded successfully"
msgstr "下载成功"
msgid "Verifying firmware image format..."
msgstr "正在校验固件镜像格式与设备兼容性..."
@@ -169,7 +175,7 @@ msgstr "正在校验固件镜像格式与设备兼容性..."
msgid "Firmware image validation passed"
msgstr "固件镜像格式与设备兼容性校验通过"
msgid "Image check failed: "
msgid "Image check failed:"
msgstr "固件镜像校验未通过:"
msgid "The uploaded image file does not contain a supported format."
@@ -236,7 +242,7 @@ msgid "Backup failed"
msgstr "备份失败"
msgid "Download Backup"
msgstr "下载配置备份"
msgstr "下载备份"
msgid "Upgrading System"
msgstr "正在升级系统"
@@ -253,14 +259,11 @@ msgstr "固件下载完成"
msgid "Firmware is ready. System upgrade will start in %d seconds. Please do not leave this page."
msgstr "固件已就绪,系统将在 %d 秒后开始刷入。请勿离开当前页面。"
msgid "Starting download: "
msgstr "开始下载: "
msgid "Starting download:"
msgstr "开始下载:"
msgid "System upgrade will start in "
msgstr "系统将在 "
msgid " seconds"
msgstr " 秒后开始刷入"
msgid "System upgrade will start in %d seconds"
msgstr "系统将在 %d 秒后开始刷入"
msgid "Flashing..."
msgstr "正在刷入固件..."
@@ -295,14 +298,14 @@ msgstr "已自动匹配并选中最新固件:%s"
msgid "Upgrade workflow is running, please wait until current operation finishes"
msgstr "升级流程正在执行,请等待当前操作完成"
msgid "SHA256 verification passed: "
msgid "SHA256 verification passed:"
msgstr "SHA256 校验通过:"
msgid "SHA256 verification failed, upgrade cancelled"
msgstr "SHA256 校验失败,已取消升级"
msgid " Expected: "
msgstr " 期望值:"
msgid "Expected:"
msgstr "期望值:"
msgid " Got: "
msgstr " 实际值:"
msgid "Got:"
msgstr "实际值:"
@@ -1,21 +1,5 @@
#!/bin/sh
uci -q get ghfu.main >/dev/null || {
uci -q batch <<EOF
set ghfu.main=ghfu
set ghfu.main.selected_release=''
set ghfu.main.keep_config='1'
set ghfu.main.retain_packages='0'
EOF
uci commit ghfu
}
if [ -f /etc/config/luci ]; then
uci -q get luci.main.autoupgrade_fm >/dev/null || {
uci -q set luci.main.autoupgrade_fm='1'
uci commit luci
}
fi
grep -q "opkg-upgrade" /etc/crontabs/root 2>/dev/null || {
hour="$(grep -m1 -ao '[4-6]' /dev/urandom 2>/dev/null | head -n1)"
+2 -2
View File
@@ -12,7 +12,7 @@ LUCI_DEPENDS:=
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-wizard
PKG_MAINTAINER:=Chen Minqiang <ptpt52@gmail.com>
PKG_MAINTAINER:=Kiddin9
PKG_LICENSE:=GPLv3
define Package/luci-app-wizard/conffiles
@@ -21,4 +21,4 @@ endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
# call BuildPackage - OpenWrt buildroot signature
-3
View File
@@ -1,3 +0,0 @@
# luci-app-wizard
修改自 https://github.com/x-wrt/com.x-wrt/tree/master/luci-app-wizard
@@ -526,10 +526,10 @@ return view.extend({
// 1. 核心操作:调用 apply_unchecked,进行强制永久提交,彻底绕过 90 秒回滚保护机制!
L.post(L.url('admin', 'uci', 'apply_unchecked')).catch(function() {});
// 2. 立即在前端呼出弹窗遮罩层
// 2. 立即在前端呼出弹窗遮罩层(剥离 _() 内首尾空格以防 po2lmo 截断导致匹配失效)
ui.showModal(_('LAN IP Address Changed'), [
E('p', {}, [_('LAN IP has been changed to '), E('strong', {}, newIp), '.']),
E('p', {}, [_('Applying changes without rollback. Redirecting to the new address in '), countSpan, _(' seconds...')]),
E('p', {}, [_('LAN IP has been changed to'), ' ', E('strong', {}, newIp), '.']),
E('p', {}, [_('Applying changes without rollback. Redirecting to the new address in'), ' ', countSpan, ' ', _('seconds...')]),
E('p', { 'class': 'alert-message notice', 'style': 'margin-top: 1em;' },
_('提示:更改网段后,若未能自动加载新页面,请尝试重新插拔网线或断开重连 Wi-Fi,以获取新网段的 IP 地址。')),
E('div', { 'class': 'spinning', 'style': 'margin: 1.5em auto;' }),
+31 -16
View File
@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: luci-app-wizard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-20 20:00+0800\n"
"PO-Revision-Date: 2026-09-20 20:00+0800\n"
"PO-Revision-Date: 2026-11-16 03:22+0800\n"
"Last-Translator: Eric\n"
"Language-Team: Chinese (Simplified) <zh_Hans>\n"
"Language: zh_Hans\n"
@@ -15,12 +15,21 @@ msgstr ""
msgid "Home"
msgstr "首页"
msgid "Default"
msgstr "默认"
msgid "Auto"
msgstr "自动"
msgid "Setup Wizard"
msgstr "快速设置向导"
msgid "Quickly configure common network, wireless, and system settings."
msgstr "快速配置常用网络、无线与系统运行设置。"
msgid "Grant UCI and filesystem access for LuCI Setup Wizard"
msgstr "授予 LuCI 快速设置向导访问 UCI 配置与文件系统的权限"
msgid "Net Settings"
msgstr "网络设置"
@@ -60,6 +69,9 @@ msgstr "LAN IPv4 地址"
msgid "Custom DNS Server(s)"
msgstr "自定义 DNS 服务器"
msgid "Leave empty for ISP DNS."
msgstr "留空则使用上级或运营商默认 DNS。"
msgid "Gateway Address"
msgstr "网关地址"
@@ -70,10 +82,7 @@ msgid "Enable DHCP Server"
msgstr "启用 DHCP 服务器"
msgid "If this DHCP is enabled, disable the main router's DHCP. If disabled, manually set client devices' gateway and DNS to this bypass router's IP."
msgstr "开启此DHCP则需要关闭主路由DHCP, 关闭此DHCP则需要手动将上网设备的网关和DNS改为此旁路由的IP。"
msgid "Leave empty for ISP DNS."
msgstr "留空则使用 ISP 运营商DNS"
msgstr "开启此 DHCP 时请关闭主路由 DHCP;关闭此 DHCP 时需手动将客户端设备的网关和 DNS 设为本旁路由 IP。"
msgid "IPv6 Support"
msgstr "IPv6 支持"
@@ -108,8 +117,17 @@ msgstr "自动将普通 HTTP 请求重定向到加密的 HTTPS 连接。"
msgid "Landing Dashboard Mode"
msgstr "管理首页展示模式"
msgid "Default"
msgstr "默认"
msgid "Auto"
msgstr "自动"
msgid "Overview"
msgstr "概览"
msgid "iStoreOS"
msgstr "iStoreOS"
msgid "Dashboard"
msgstr "仪表盘"
msgid "RouterDog"
msgstr "路由狗"
@@ -126,9 +144,6 @@ msgstr "Router"
msgid "Wireless Network Name (SSID)"
msgstr "无线网络名称 (SSID)"
msgid "无线名称基准前缀,系统将自动识别并为 2.4G 追加 _2.4G、5G 追加 _5G、6G 追加 _6G。"
msgstr "无线名称基准前缀,系统将自动识别并为 2.4G 追加 _2.4G、5G 追加 _5G、6G 追加 _6G。"
msgid "Wireless Password (Key)"
msgstr "无线密码"
@@ -165,14 +180,14 @@ msgstr "没有需要应用的更改"
msgid "LAN IP Address Changed"
msgstr "LAN 口 IP 地址已变更"
msgid "LAN IP has been changed to "
msgstr "LAN 口 IP 地址已更改为 "
msgid "LAN IP has been changed to"
msgstr "LAN 口 IP 地址已更改为"
msgid "Applying changes without rollback. Redirecting to the new address in "
msgstr "正在永久应用更改(已禁用回滚保护)。将在 "
msgid "Applying changes without rollback. Redirecting to the new address in"
msgstr "正在永久应用更改(已禁用回滚保护)。将在"
msgid " seconds..."
msgstr " 秒后自动跳转至新地址..."
msgid "seconds..."
msgstr "秒后自动跳转至新地址..."
msgid "提示:更改网段后,若未能自动加载新页面,请尝试重新插拔网线或断开重连 Wi-Fi,以获取新网段的 IP 地址。"
msgstr "提示:更改网段后,若未能自动加载新页面,请尝试重新插拔网线或断开重连 Wi-Fi,以获取新网段的 IP 地址。"