|
|
@@ -2641,7 +2641,23 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
|
|
|
}
|
|
|
if (xhr.status === 200) {
|
|
|
barEl.style.width = "100%";
|
|
|
- msgEl.textContent = "Done. Device is rebooting...";
|
|
|
+ msgEl.textContent = "Done. Device is rebooting";
|
|
|
+ let wait = 4;
|
|
|
+ const iv = setInterval(async () => {
|
|
|
+ msgEl.textContent += '.';
|
|
|
+ if (msgEl.textContent.length > 85) { clearInterval(iv); msgEl.textContent = "Device did not come back online. =("; return; }
|
|
|
+ if (--wait) { return; }
|
|
|
+ wait = 1000; // prevent concurrent fetch
|
|
|
+ try {
|
|
|
+ if ((await fetch("/", { cache: "no-store" })).ok) {
|
|
|
+ clearInterval(iv);
|
|
|
+ msgEl.textContent = "Device is back online. Redirecting to login...";
|
|
|
+ setTimeout(redirectToLogin, 1500);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (_) {}
|
|
|
+ wait = 4;
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
|
msgEl.textContent = "Failed: " + (xhr.responseText || String(xhr.status));
|
|
|
document.getElementById("otaUploadBtn").disabled = false;
|