Merge pull request #1086 from haverland/rolling

Add file length check before upload ota
This commit is contained in:
jomjol
2022-09-27 18:13:03 +02:00
committed by GitHub
3 changed files with 45 additions and 31 deletions

View File

@@ -268,6 +268,8 @@ jobs:
zip -r ../release/update.zip . zip -r ../release/update.zip .
cd ../firmware cd ../firmware
zip -r ../release/initial_esp32_setup.zip . zip -r ../release/initial_esp32_setup.zip .
cd ../sd-card/html
zip -r ../../firmware/html-from-11.3.1.zip .
# extract the version used in next step # extract the version used in next step
@@ -302,6 +304,8 @@ jobs:
body: ${{ steps.extract-release-notes.outputs.release_notes }} body: ${{ steps.extract-release-notes.outputs.release_notes }}
files: | files: |
release/* release/*
firmware/firmware.bin
firmware/html-from-11.3.1.zip
# Commit&Push Changelog to master branch. Must be manually merged back to rolling # Commit&Push Changelog to master branch. Must be manually merged back to rolling

View File

@@ -2,6 +2,12 @@
## [Unreleased] ## [Unreleased]
The release breaks a few things in ota update. So **read the update from version 11.3.1 carefully**.
1.) You should update to 11.3.1 before you update to this release. All other are not tested.
2.) Upload and update the firmware.bin file from this release. **but do not reboot**
3.) Upload the html-from-11.3.1.zip in html upload and update the web interface.
4.) Now you can reboot.
### Added ### Added
- automatic release creation - automatic release creation
@@ -11,6 +17,7 @@
- using the update.zip from release page <https://github.com/jomjol/AI-on-the-edge-device/releases> - using the update.zip from release page <https://github.com/jomjol/AI-on-the-edge-device/releases>
- status (upload, processing, ...) displayed - status (upload, processing, ...) displayed
- auto suggestion for reboot (or not in case of web ui update only) - auto suggestion for reboot (or not in case of web ui update only)
- Best for OTA use Firefox. Chrome works with warnings. Safari stuck in upload.
### Changed ### Changed
- Integrated version info better into the html (main page, logfile) - Integrated version info better into the html (main page, logfile)
@@ -25,7 +32,7 @@
### Removed ### Removed
- Remove `/firmware` from GitHub. - Remove `/firmware` from GitHub.
- If you want to get the latest firmware and html files, please download from the automated (build action)[https://github.com/jomjol/AI-on-the-edge-device/actions] or (release page)[https://github.com/jomjol/AI-on-the-edge-device/releases] - If you want to get the latest firmware and html files, please download from the automated [build action](https://github.com/jomjol/AI-on-the-edge-device/actions) or [release page](https://github.com/jomjol/AI-on-the-edge-device/releases)
## [11.3.1] - (2022-09-17) ## [11.3.1] - (2022-09-17)
Intermediate Digits Intermediate Digits

View File

@@ -168,6 +168,8 @@ function upload() {
alert("No file selected!"); alert("No file selected!");
} else if (filePath.length == 0) { } else if (filePath.length == 0) {
alert("File path on server is not set!"); alert("File path on server is not set!");
} else if (filePath.length > 100) {
alert("Filename is to long! Max 100 characters.");
} else if (filePath.indexOf(' ') >= 0) { } else if (filePath.indexOf(' ') >= 0) {
alert("File path on server cannot have spaces!"); alert("File path on server cannot have spaces!");
} else if (filePath[filePath.length-1] == '/') { } else if (filePath[filePath.length-1] == '/') {
@@ -199,35 +201,36 @@ function upload() {
xhttp.open("POST", upload_path, false); xhttp.open("POST", upload_path, false);
document.getElementById("status").innerText = "Status: uploading"; document.getElementById("status").innerText = "Status: uploading";
xhttp.send(file); xhttp.send(file);
document.getElementById("status").innerText = "Status: processing on ESP32";
var xhttp = new XMLHttpRequest();
/* first delete the old firmware */
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
if (xhttp.responseText.startsWith("reboot"))
{
doReboot();
}
else
{
alert("Processing done!\n\n" + xhttp.responseText);
}
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
var _toDo = basepath + "/ota?task=update&file=" + filePath;
xhttp.open("GET", _toDo, false);
xhttp.send();
} }
document.getElementById("status").innerText = "Status: processing on ESP32";
var xhttp = new XMLHttpRequest();
/* first delete the old firmware */
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
if (xhttp.responseText.startsWith("reboot"))
{
doReboot();
}
else
{
alert("Processing done!\n\n" + xhttp.responseText);
}
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
var _toDo = basepath + "/ota?task=update&file=" + filePath;
xhttp.open("GET", _toDo, false);
xhttp.send();
/* ----------------------------- */ /* ----------------------------- */
document.getElementById("reboot").disabled = false; document.getElementById("reboot").disabled = false;