mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-12 13:33:06 +01:00
intermediate: OTA update
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
<div class="tab" data-page="configPage">Config</div>
|
||||
<div class="tab" data-page="xdrPage">XDR</div>
|
||||
<div class="tab" data-page="dashboardPage">Data</div>
|
||||
<div class="tab" data-page="updatePage">Update</div>
|
||||
</div>
|
||||
<div id="statusPage" class="tabPage">
|
||||
<div id="statusPageContent">
|
||||
@@ -74,6 +75,12 @@
|
||||
<div class="tabPage hidden" id="dashboardPage">
|
||||
|
||||
</div>
|
||||
<div class="tabPage hidden" id="updatePage">
|
||||
<form action="api/update" method="post" id="uploadForm">
|
||||
<input type="file" name="file1" id="uploadFile">
|
||||
</form>
|
||||
<button id="uploadBin">Upload</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="overlayContainer hidden" id="overlayContainer">
|
||||
|
||||
18
web/index.js
18
web/index.js
@@ -1445,7 +1445,23 @@ function updateDashboard(data) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function uploadBin(){
|
||||
let el=document.getElementById("uploadFile");
|
||||
if (! el) return;
|
||||
if ( el.files.length < 1) return;
|
||||
ensurePass()
|
||||
.then (function(hash){
|
||||
let req = new XMLHttpRequest();
|
||||
req.onloadend=function(){
|
||||
alert("upload complete");
|
||||
}
|
||||
let formData = new FormData();
|
||||
formData.append("file1", el.files[0]);
|
||||
req.open("POST", '/api/update?_hash='+encodeURIComponent(hash));
|
||||
req.send(formData);
|
||||
})
|
||||
.catch(function(e){});
|
||||
}
|
||||
window.setInterval(update, 1000);
|
||||
window.setInterval(function () {
|
||||
let dp = document.getElementById('dashboardPage');
|
||||
|
||||
Reference in New Issue
Block a user