From 055a36d68db9b3e53bc282242cf93c65a1f72d4f Mon Sep 17 00:00:00 2001 From: Paul Wieland Date: Tue, 31 Dec 2024 11:37:39 -0500 Subject: [PATCH] Add ota firmware download button --- static/index.html | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 25bcd59..eea17bc 100644 --- a/static/index.html +++ b/static/index.html @@ -255,7 +255,10 @@

- +

+ +
+

@@ -310,6 +313,19 @@ } } + function setOTAFirmwarePath(url) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'json'; + xhr.onload = function() { + var status = xhr.status; + if (status === 200) { + document.querySelector("#download_ota_form").action = xhr.response.builds[0].ota.path; + } + }; + xhr.send(); + }; + document.querySelectorAll('div.radios input').forEach((radio) => radio.addEventListener("change", () => { const button = document.querySelector("esp-web-install-button"); @@ -337,6 +353,7 @@ } button.manifest = `${hardware}${protocol}-manifest.json`; + setOTAFirmwarePath(button.manifest); }) );