mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-15 23:13:07 +01:00
intermediate: OTA update
This commit is contained in:
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