From db1f33c2b6ba6ff6b3cfd7f861e3f1c20809856d Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Thu, 27 Mar 2025 19:13:57 +0100 Subject: [PATCH 1/2] fix: update reload logic after removing and saving Bambu credentials for better cache handling --- html/spoolman.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html/spoolman.html b/html/spoolman.html index 16736e0..912948d 100644 --- a/html/spoolman.html +++ b/html/spoolman.html @@ -70,8 +70,8 @@ document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials removed!'; // Reload with forced cache refresh after short delay setTimeout(() => { - window.location.replace('/'); - location.reload(true); + window.location.reload(true); + window.location.href = '/'; }, 1500); } else { document.getElementById('bambuStatusMessage').innerText = 'Error while removing Bambu Credentials.'; @@ -116,8 +116,8 @@ document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials saved!'; // Reload with forced cache refresh after short delay setTimeout(() => { - window.location.replace('/'); - location.reload(true); + window.location.reload(true); + window.location.href = '/'; }, 1500); } else { document.getElementById('bambuStatusMessage').innerText = 'Error while saving Bambu Credentials.'; From cb15dae87e707f1749b38fe02097d999d0facb81 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 29 Mar 2025 07:52:49 +0100 Subject: [PATCH 2/2] fix: improve HTTP client configuration and clear update documents after API calls --- src/api.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/api.cpp b/src/api.cpp index d15b273..d67d2ed 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -94,6 +94,9 @@ void sendToApi(void *parameter) { String octoToken = params->octoToken; HTTPClient http; + http.setReuse(false); + http.setTimeout(10000); + http.begin(spoolsUrl); http.addHeader("Content-Type", "application/json"); if (octoEnabled && octoToken != "") http.addHeader("X-Api-Key", octoToken); @@ -111,6 +114,7 @@ void sendToApi(void *parameter) { } http.end(); + vTaskDelay(50 / portTICK_PERIOD_MS); // Speicher freigeben delete params; @@ -165,6 +169,8 @@ bool updateSpoolTagId(String uidString, const char* payload) { NULL // Task-Handle (nicht benötigt) ); + updateDoc.clear(); + return true; } @@ -201,6 +207,8 @@ uint8_t updateSpoolWeight(String spoolId, uint16_t weight) { NULL // Task-Handle (nicht benötigt) ); + updateDoc.clear(); + return 1; } @@ -238,6 +246,8 @@ bool updateSpoolOcto(int spoolId) { NULL // Task-Handle (nicht benötigt) ); + updateDoc.clear(); + return true; }