From 655256ca6b338490de219b7c2d2caf9895db8e55 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 8 Jun 2026 09:20:37 +1200 Subject: [PATCH] Add erase flash button --- html/about.html | 3 +++ static/js/about.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/html/about.html b/html/about.html index 8000410..a5ebf16 100644 --- a/html/about.html +++ b/html/about.html @@ -154,6 +154,9 @@

Installed Packages

+
+ +
diff --git a/static/js/about.js b/static/js/about.js index 40a4ff1..0667d98 100644 --- a/static/js/about.js +++ b/static/js/about.js @@ -258,3 +258,32 @@ async function setEnvironment() { function downloadTemperatureCsv() { window.location.href = "/temperature-csv"; } + +async function eraseFlash() { + if (!confirm("Are you sure you want to erase flash? This cannot be undone. Device must stay on for at least 2 minutes.")) { + return; + } + $("#erase-flash-button").attr("disabled", true); + $("#erase-flash-button").html("Erasing Flash..."); + try { + const response = await fetch("/api/erase-flash", { + method: "POST", + headers: { + Authorization: "Basic " + btoa("admin:feathers"), + "Content-Type": "application/json", + }, + }); + + if (response.ok) { + alert("Flash erase done."); + } else { + alert("Error erasing flash"); + console.error("Error with response:", await response.text()); + } + } catch (error) { + alert("Error erasing flash"); + console.error("Error erasing flash:", error); + } + $("#erase-flash-button").attr("disabled", false); + $("#erase-flash-button").html("Erase Flash"); +}