Show progress for uploads and updates, and reload when they are done

An uploaded bundle gets a progress bar over the page; a running update an
overlay that follows its steps. A page that finished working, or that was sent
to the login page by a restart, is loaded whole.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
2026-11-18 10:03:53 +01:00
co-authored by Claude Sonnet 5.5
parent adb804570a
commit 55cf5f71c9
7 changed files with 139 additions and 5 deletions
+6 -1
View File
@@ -14,12 +14,17 @@
setTimeout(function () {
fetch(location.pathname + location.search,{ credentials: "same-origin", headers: { "X-Live": "1" } })
.then(function (r) {
if (r.redirected || !r.ok) throw new Error("not the page");
// Sent elsewhere: the web UI restarted and forgot the session. Show where it leads.
if (r.redirected) { location.reload(); return null; }
if (!r.ok) throw new Error("not the page");
return r.text();
})
.then(function (html) {
if (html === null) return;
var next = new DOMParser().parseFromString(html, "text/html").getElementById("live");
if (!next) throw new Error("no content");
// Done: load the page whole, as it is when nothing is going on.
if (!next.getAttribute("data-live")) { location.reload(); return; }
var old = live.querySelector("pre.log");
var atEnd = !old || old.scrollTop + old.clientHeight >= old.scrollHeight - 8;
var kept = old ? old.scrollTop : 0;