Merge pull request #193 from naturallaw777/copilot/fix-update-system-flow

fix: skip update flow when no updates are available
This commit is contained in:
Sovran_Systems
2026-04-11 23:14:11 -05:00
committed by GitHub
2 changed files with 37 additions and 0 deletions

View File

@@ -2375,6 +2375,10 @@ async def api_updates_run():
if status == "RUNNING":
return {"ok": True, "status": "already_running"}
available = await loop.run_in_executor(None, check_for_updates)
if not available:
return {"ok": True, "status": "no_updates"}
# Clear stale status and log BEFORE starting the unit
_write_update_status("RUNNING")
try:

View File

@@ -3,6 +3,30 @@
// ── Update modal ──────────────────────────────────────────────────
function openUpdateModal() {
if (!$modal) return;
apiFetch("/api/updates/check")
.then(function(data) {
if (!data.available) {
_updateLog = "";
_updateLogOffset = 0;
_updateFinished = true;
if ($modalLog) $modalLog.textContent = "";
if ($modalStatus) $modalStatus.textContent = "✓ System is already up to date";
if ($modalSpinner) $modalSpinner.classList.remove("spinning");
if ($btnReboot) $btnReboot.style.display = "none";
if ($btnSave) $btnSave.style.display = "none";
if ($btnCloseModal) $btnCloseModal.disabled = false;
$modal.classList.add("open");
return;
}
_doOpenUpdateModal();
})
.catch(function() {
_doOpenUpdateModal();
});
}
function _doOpenUpdateModal() {
if (!$modal) return;
_updateLog = "";
_updateLogOffset = 0;
@@ -37,6 +61,15 @@ function startUpdate() {
return response.json();
})
.then(function(data) {
if (data.status === "no_updates") {
if ($modalStatus) $modalStatus.textContent = "✓ System is already up to date";
if ($modalSpinner) $modalSpinner.classList.remove("spinning");
if ($btnReboot) $btnReboot.style.display = "none";
if ($btnSave) $btnSave.style.display = "none";
if ($btnCloseModal) $btnCloseModal.disabled = false;
_updateFinished = true;
return;
}
if (data.status === "already_running") appendLog("[Update already in progress, attaching…]\n\n");
if ($modalStatus) $modalStatus.textContent = "Updating…";
startUpdatePoll();