fix(webui): auto-close the config UI tab after saving

The success overlay already told the user they could close the tab,
but nothing ever tried to. Calls window.close() shortly after the save
+ shutdown round-trip completes. Browsers permit scripted close on
tabs whose entire session history is a single page, which the config
UI always is, so this closes cleanly and drops the user back to their
terminal; if a browser still blocks it, the existing on-screen message
remains as the manual fallback.
This commit is contained in:
akadeepesh
2026-09-20 11:56:37 +05:30
parent 20490a75e8
commit 777e798041
+11
View File
@@ -1148,6 +1148,17 @@ INDEX_HTML = r"""<!DOCTYPE html>
document.getElementById("overlay").classList.add("show");
setTimeout(function () {
api("/api/shutdown", { method: "GET" }).catch(function () {});
// Try to close the tab automatically and hop back to the terminal.
// Browsers only allow script-initiated close on windows/tabs that
// were opened by a script, or ones whose entire session history is
// just this one page — which this config-UI tab always is, since
// it's a single page with no navigation. If the browser still
// blocks it (some do, regardless), window.close() is a silent
// no-op and the overlay's "you can close this tab" text — already
// on screen — is the fallback the user follows manually.
setTimeout(function () {
try { window.close(); } catch (e) { /* ignored — fallback is the overlay text */ }
}, 300);
}, 900);
}).catch(function () {
btn.disabled = false;