From e079c30c54bdc10c64cb5f50559ab7a271395c0f Mon Sep 17 00:00:00 2001 From: Nic Limper Date: Sun, 8 Dec 2024 20:48:58 +0100 Subject: [PATCH] version compare bugfix --- ESP32_AP-Flasher/wwwroot/index.html | 6 +++--- ESP32_AP-Flasher/wwwroot/ota.js | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ESP32_AP-Flasher/wwwroot/index.html b/ESP32_AP-Flasher/wwwroot/index.html index 5969fba3..f69af71e 100644 --- a/ESP32_AP-Flasher/wwwroot/index.html +++ b/ESP32_AP-Flasher/wwwroot/index.html @@ -6,9 +6,9 @@ Open EPaper Link Access Point - - - + + + diff --git a/ESP32_AP-Flasher/wwwroot/ota.js b/ESP32_AP-Flasher/wwwroot/ota.js index 4cb77177..5e054aff 100644 --- a/ESP32_AP-Flasher/wwwroot/ota.js +++ b/ESP32_AP-Flasher/wwwroot/ota.js @@ -97,7 +97,7 @@ export async function initUpdate() { } else { const release = releaseDetails[0]; if (release?.tag_name) { - if (parseInt(release.tag_name) == parseInt(currentVer)) { + if (normalizeVersion(release.tag_name) === normalizeVersion(currentVer)) { easyupdate.innerHTML = `Version ${currentVer}. You are up to date`; } else if (release.date < formatEpoch(currentBuildtime - 30 * 60)) { easyupdate.innerHTML = `Your version is newer than the latest release date.
Are you the developer? :-)`; @@ -638,3 +638,7 @@ async function fetchAndCheckTagtypes(cleanup) { print("Error: " + error, "red"); } } + +function normalizeVersion(version) { + return version.replace(/(\.\d*?)0+$/, '$1').replace(/\.$/, ''); +}