Skip to content

Commit

Permalink
0.8.57
Browse files Browse the repository at this point in the history
* added protection to prevent update to wrong firmware (environment check)
  • Loading branch information
lumapu committed Jan 15, 2024
1 parent 358344a commit f503516
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 9 deletions.
45 changes: 45 additions & 0 deletions ahoy.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"folders": [
{
"path": "."
},
{
"path": "src"
}
],
"settings": {
"files.associations": {
"algorithm": "cpp",
"array": "cpp",
"chrono": "cpp",
"deque": "cpp",
"format": "cpp",
"forward_list": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iterator": "cpp",
"list": "cpp",
"memory": "cpp",
"queue": "cpp",
"random": "cpp",
"regex": "cpp",
"vector": "cpp",
"xhash": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"*.tcc": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"string_view": "cpp",
"sstream": "cpp",
"istream": "cpp",
"ostream": "cpp"
},
"editor.formatOnSave": false
}
}
1 change: 1 addition & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* merge PR: MI-MQTT and last retransmit #1363
* fixed DTU-ID, now built from the unique part of the MAC
* fix lang in `/system` #1346
* added protection to prevent update to wrong firmware (environment check)

## 0.8.56 - 2024-01-15
* potential fix of update problems and random reboots #1359 #1354
Expand Down
2 changes: 1 addition & 1 deletion src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void app::setup() {
}
#if defined(ESP32)
if(mConfig->cmt.enabled) {
mCmtRadio.setup(&mConfig->serial.debug, &mConfig->serial.privacyLog, &mConfig->serial.printWholeTrace, mConfig->cmt.pinSclk, mConfig->cmt.pinSdio, mConfig->cmt.pinCsb, mConfig->cmt.pinFcsb, false);
mCmtRadio.setup(&mConfig->serial.debug, &mConfig->serial.privacyLog, &mConfig->serial.printWholeTrace, mConfig->cmt.pinSclk, mConfig->cmt.pinSdio, mConfig->cmt.pinCsb, mConfig->cmt.pinFcsb);
}
#endif
#ifdef ETHERNET
Expand Down
4 changes: 2 additions & 2 deletions src/web/RestApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ class RestApi {
void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) {
getSysInfo(request, obj.createNestedObject(F("system")));
getGeneric(request, obj.createNestedObject(F("generic")));
char tmp[100];
snprintf(tmp, 100, "<a href=\"/factory\" class=\"btn\">%s</a><br/><br/><a href=\"/reboot\" class=\"btn\">%s</a>", FACTORY_RESET, BTN_REBOOT);
char tmp[200];
snprintf(tmp, 200, "<a href=\"/factory\" class=\"btn\">%s</a><br/><br/><a href=\"/reboot\" class=\"btn\">%s</a>", FACTORY_RESET, BTN_REBOOT);
obj[F("html")] = String(tmp);
}

Expand Down
29 changes: 23 additions & 6 deletions src/web/html/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,34 @@
</div>
{#HTML_FOOTER}
<script type="text/javascript">
var env;
function parseGeneric(obj) {
parseNav(obj);
parseESP(obj);
parseRssi(obj);
parseNav(obj)
parseESP(obj)
parseRssi(obj)
env = obj.env
document.getElementById("version").innerHTML = "{#VERSION_FULL}_" + obj.env + ".bin"
}

function hide() {
document.getElementById("form").submit();
var e = document.getElementById("content");
e.replaceChildren(span("{#UPDATE_STARTED}"));
var bin = document.getElementsByName("update")[0].value.slice(-env.length-4, -4)
if (bin !== env) {
var html = ml("div", {class: "row"}, [
ml("div", {class: "row my-3"}, "{#WARN_DIFF_ENV}"),
ml("div", {class: "row"}, [
ml("div", {class: "col-6"}, ml("input", {type: "button", class: "btn", value: "{#CANCEL}", onclick: function() { modalClose(); }}, null)),
ml("div", {class: "col-6"}, ml("input", {type: "button", class: "btn", value: "{#CONTIUE}", onclick: function() { start(); modalClose(); }}, null))
])
])
modal("{#UPDATE_MODAL}", html)
} else
start()
}

function start() {
document.getElementById("form").submit()
var e = document.getElementById("content")
e.replaceChildren(span("{#UPDATE_STARTED}"))
}

getAjax("/api/generic", parseGeneric);
Expand Down
20 changes: 20 additions & 0 deletions src/web/lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,26 @@
"token": "UPDATE_STARTED",
"en": "update started",
"de": "Aktualisierung gestartet"
},
{
"token": "UPDATE_MODAL",
"en": "Warning",
"de": "Warnung"
},
{
"token": "WARN_DIFF_ENV",
"en": "your environment does not match the update file!",
"de": "Die ausgew&auml;hlte Firmware passt uU. nicht zum Chipsatz!"
},
{
"token": "CONTIUE",
"en": "continue",
"de": "fortfahren"
},
{
"token": "CANCEL",
"en": "cancel",
"de": "abbrechen"
}
]
},
Expand Down

0 comments on commit f503516

Please sign in to comment.