Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file length check before upload ota #1086

Merged
merged 8 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ jobs:
zip -r ../release/update.zip .
cd ../firmware
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
- id: get_version
Expand Down Expand Up @@ -301,7 +303,9 @@ jobs:
name: ${{ steps.get_version.outputs.version-without-v }}
body: ${{ steps.extract-release-notes.outputs.release_notes }}
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
Expand Down
9 changes: 8 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [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

- automatic release creation
Expand All @@ -11,6 +17,7 @@
- using the update.zip from release page <https://github.com/jomjol/AI-on-the-edge-device/releases>
- status (upload, processing, ...) displayed
- 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
- Integrated version info better into the html (main page, logfile)
Expand All @@ -25,7 +32,7 @@

### Removed
- 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)
Intermediate Digits
Expand Down
55 changes: 29 additions & 26 deletions sd-card/html/ota_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ <h2>Reboot</h2>
alert("No file selected!");
} else if (filePath.length == 0) {
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) {
alert("File path on server cannot have spaces!");
} else if (filePath[filePath.length-1] == '/') {
Expand Down Expand Up @@ -199,35 +201,36 @@ <h2>Reboot</h2>
xhttp.open("POST", upload_path, false);
document.getElementById("status").innerText = "Status: uploading";
xhttp.send(file);
}


document.getElementById("status").innerText = "Status: processing on ESP32";
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);
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();
}
} 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();
}
};
var _toDo = basepath + "/ota?task=update&file=" + filePath;
xhttp.open("GET", _toDo, false);
xhttp.send();
}
/* ----------------------------- */

document.getElementById("reboot").disabled = false;
Expand Down