mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 03:30:23 +00:00
Remove return URL persistence from self-update flow
Replace sessionStorage-based return URL tracking with simple page reload after backend restart. Remove getSavedReturnUrl, saveReturnUrl helper methods and SELF_UPDATE_RETURN_URL_KEY constant. Update tests to verify removal of URL persistence code.
This commit is contained in:
parent
f31693d5c3
commit
68ad5aca46
2 changed files with 5 additions and 26 deletions
|
|
@ -113,7 +113,11 @@ def test_self_update_frontend_uses_preloaded_select():
|
|||
assert "this.selectedTagExistsOnBranch" in content
|
||||
assert 'const response = await fetch("/api/health"' in content
|
||||
assert "if (response.ok && observedBackendUnavailable)" in content
|
||||
assert "window.location.reload();" in content
|
||||
assert "Waiting for Agent Zero to disconnect before reloading the page." in content
|
||||
assert "SELF_UPDATE_RETURN_URL_KEY" not in content
|
||||
assert "saveReturnUrl(" not in content
|
||||
assert "getSavedReturnUrl(" not in content
|
||||
assert "/api/csrf_token" not in content
|
||||
assert "tagSuggestions" not in content
|
||||
assert "tagDropdownOpen" not in content
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { openModal, closeModal } from "/js/modals.js";
|
|||
|
||||
const HEALTH_POLL_INTERVAL_MS = 2000;
|
||||
const HEALTH_WAIT_BUFFER_MS = 30000;
|
||||
const SELF_UPDATE_RETURN_URL_KEY = "a0:self-update:return-url";
|
||||
const SELF_UPDATE_OVERLAY_ID = "self-update-progress-overlay";
|
||||
const SELF_UPDATE_MODAL_PATH = "settings/external/self-update-modal.html";
|
||||
const SELF_UPDATE_MANUAL_BACKUP_MODAL_PATH = "settings/backup/backup_restore.html";
|
||||
|
|
@ -129,26 +128,6 @@ const model = {
|
|||
return `${branch || "main"} / ${tag || "None"}`;
|
||||
},
|
||||
|
||||
getSavedReturnUrl() {
|
||||
try {
|
||||
return sessionStorage.getItem(SELF_UPDATE_RETURN_URL_KEY) || "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
|
||||
saveReturnUrl(url = "") {
|
||||
try {
|
||||
if (url) {
|
||||
sessionStorage.setItem(SELF_UPDATE_RETURN_URL_KEY, url);
|
||||
} else {
|
||||
sessionStorage.removeItem(SELF_UPDATE_RETURN_URL_KEY);
|
||||
}
|
||||
} catch {
|
||||
// ignore storage errors
|
||||
}
|
||||
},
|
||||
|
||||
getProgressOverlay() {
|
||||
return document.getElementById(SELF_UPDATE_OVERLAY_ID);
|
||||
},
|
||||
|
|
@ -446,7 +425,6 @@ const model = {
|
|||
undefined,
|
||||
true,
|
||||
);
|
||||
this.saveReturnUrl(window.location.href);
|
||||
await this.restartAndReload();
|
||||
} catch (error) {
|
||||
console.error("Failed to schedule self-update:", error);
|
||||
|
|
@ -506,9 +484,7 @@ const model = {
|
|||
cache: "no-store",
|
||||
});
|
||||
if (response.ok && observedBackendUnavailable) {
|
||||
const returnUrl = this.getSavedReturnUrl() || window.location.href;
|
||||
this.saveReturnUrl("");
|
||||
window.location.replace(returnUrl);
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
if (response.ok) {
|
||||
|
|
@ -544,7 +520,6 @@ const model = {
|
|||
|
||||
this.restarting = false;
|
||||
this.removeProgressOverlay();
|
||||
this.saveReturnUrl("");
|
||||
this.error =
|
||||
"Agent Zero did not come back within the expected window. It may still be rolling back. " +
|
||||
(lastError ? `Last health check error: ${lastError}` : "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue