Add ESP32 bootloader upgrade functionality with JSON API support

Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
This commit is contained in:
Will Tatam
2025-11-09 09:15:23 +00:00
parent 670f74d589
commit 013ecfb189
4 changed files with 165 additions and 0 deletions

View File

@@ -29,6 +29,13 @@
if (data.arch == "esp8266") {
toggle('rev');
}
isESP32 = data.arch && data.arch.startsWith('esp32');
if (isESP32) {
gId('bootloader-section').style.display = 'block';
if (data.bootloaderSHA256) {
gId('bootloader-hash').innerText = 'Current bootloader SHA256: ' + data.bootloaderSHA256;
}
}
})
.catch(error => {
console.log('Could not fetch device info:', error);
@@ -37,6 +44,7 @@
document.querySelector('.release-name').textContent = 'Unknown';
});
}
function GetV() {/*injected values here*/}
</script>
<style>
@import url("style.css");
@@ -60,6 +68,16 @@
<button id="rev" type="button" onclick="cR()">Revert update</button><br>
<button type="button" onclick="B()">Back</button>
</form>
<div id="bootloader-section" style="display:none;">
<hr class="sml">
<h2>ESP32 Bootloader Update</h2>
<div id="bootloader-hash" class="sip" style="margin-bottom:8px;"></div>
<form method='POST' action='./updatebootloader' id='bootupd' enctype='multipart/form-data' onsubmit="toggle('bootupd')">
<b>Warning:</b> Only upload verified ESP32 bootloader files!<br>
<input type='file' name='update' required><br>
<button type="submit">Update Bootloader</button>
</form>
</div>
<div id="Noupd" class="hide"><b>Updating...</b><br>Please do not close or refresh the page :)</div>
</body>
</html>