mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-03 04:05:55 +02:00
0.8.57
* added protection to prevent update to wrong firmware (environment check)
This commit is contained in:
parent
358344ad6d
commit
f503516c9f
6 changed files with 92 additions and 9 deletions
45
ahoy.code-workspace
Normal file
45
ahoy.code-workspace
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
* merge PR: MI-MQTT and last retransmit #1363
|
* merge PR: MI-MQTT and last retransmit #1363
|
||||||
* fixed DTU-ID, now built from the unique part of the MAC
|
* fixed DTU-ID, now built from the unique part of the MAC
|
||||||
* fix lang in `/system` #1346
|
* fix lang in `/system` #1346
|
||||||
|
* added protection to prevent update to wrong firmware (environment check)
|
||||||
|
|
||||||
## 0.8.56 - 2024-01-15
|
## 0.8.56 - 2024-01-15
|
||||||
* potential fix of update problems and random reboots #1359 #1354
|
* potential fix of update problems and random reboots #1359 #1354
|
||||||
|
|
|
@ -35,7 +35,7 @@ void app::setup() {
|
||||||
}
|
}
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
if(mConfig->cmt.enabled) {
|
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
|
#endif
|
||||||
#ifdef ETHERNET
|
#ifdef ETHERNET
|
||||||
|
|
|
@ -326,8 +326,8 @@ class RestApi {
|
||||||
void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) {
|
void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) {
|
||||||
getSysInfo(request, obj.createNestedObject(F("system")));
|
getSysInfo(request, obj.createNestedObject(F("system")));
|
||||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||||
char tmp[100];
|
char tmp[200];
|
||||||
snprintf(tmp, 100, "<a href=\"/factory\" class=\"btn\">%s</a><br/><br/><a href=\"/reboot\" class=\"btn\">%s</a>", FACTORY_RESET, BTN_REBOOT);
|
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);
|
obj[F("html")] = String(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,34 @@
|
||||||
</div>
|
</div>
|
||||||
{#HTML_FOOTER}
|
{#HTML_FOOTER}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var env;
|
||||||
function parseGeneric(obj) {
|
function parseGeneric(obj) {
|
||||||
parseNav(obj);
|
parseNav(obj)
|
||||||
parseESP(obj);
|
parseESP(obj)
|
||||||
parseRssi(obj);
|
parseRssi(obj)
|
||||||
|
env = obj.env
|
||||||
document.getElementById("version").innerHTML = "{#VERSION_FULL}_" + obj.env + ".bin"
|
document.getElementById("version").innerHTML = "{#VERSION_FULL}_" + obj.env + ".bin"
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
document.getElementById("form").submit();
|
var bin = document.getElementsByName("update")[0].value.slice(-env.length-4, -4)
|
||||||
var e = document.getElementById("content");
|
if (bin !== env) {
|
||||||
e.replaceChildren(span("{#UPDATE_STARTED}"));
|
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);
|
getAjax("/api/generic", parseGeneric);
|
||||||
|
|
|
@ -1052,6 +1052,26 @@
|
||||||
"token": "UPDATE_STARTED",
|
"token": "UPDATE_STARTED",
|
||||||
"en": "update started",
|
"en": "update started",
|
||||||
"de": "Aktualisierung gestartet"
|
"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ählte Firmware passt uU. nicht zum Chipsatz!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"token": "CONTIUE",
|
||||||
|
"en": "continue",
|
||||||
|
"de": "fortfahren"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"token": "CANCEL",
|
||||||
|
"en": "cancel",
|
||||||
|
"de": "abbrechen"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue