From b8db01529b3b74d4e8efe2b7e8a608c49a411c21 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 22 Feb 2025 11:13:40 +0100 Subject: [PATCH] docs: update webpages for version v1.3.37 --- html/upgrade.html | 19 +++++++++++++------ platformio.ini | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/html/upgrade.html b/html/upgrade.html index 9525807..a13281a 100644 --- a/html/upgrade.html +++ b/html/upgrade.html @@ -202,6 +202,16 @@ let response = this.responseText; try { const jsonResponse = JSON.parse(response); + + // Handle progress updates + if (jsonResponse.progress !== undefined) { + const percent = jsonResponse.progress; + progress.style.width = percent + '%'; + progress.textContent = Math.round(percent) + '%'; + return; + } + + // Handle success/error messages response = jsonResponse.message; if (jsonResponse.restart) { @@ -218,12 +228,9 @@ }, 1000); } } catch (e) { - if (!isNaN(response)) { - const percent = parseInt(response); - progress.style.width = percent + '%'; - progress.textContent = percent + '%'; - return; - } + console.error('JSON parse error:', e); + status.textContent = 'Update failed: Invalid response from server'; + status.classList.add('error'); } status.textContent = response; diff --git a/platformio.ini b/platformio.ini index ebb172b..10a203b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [common] -version = "1.3.36" +version = "1.3.37" #test