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