From c3b9f0f8a64bfafa0193b2c7e7a806f10a358768 Mon Sep 17 00:00:00 2001 From: Marcus Date: Tue, 22 Oct 2024 18:29:53 +0200 Subject: [PATCH] update system update page HTML --- Arduino/CanGrow/include/Webserver/Page_system.h | 6 ++++-- Arduino/CanGrow/include/Webserver/Page_system_HTML.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Arduino/CanGrow/include/Webserver/Page_system.h b/Arduino/CanGrow/include/Webserver/Page_system.h index def6002..99b1905 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system.h +++ b/Arduino/CanGrow/include/Webserver/Page_system.h @@ -135,7 +135,9 @@ String Proc_WebPage_system_update_POST(const String& var) { void WebPage_system_update(AsyncWebServerRequest *request) { if(request->method() == HTTP_POST) { doRestart = !Update.hasError(); - AsyncWebServerResponse *response = request->beginResponse(200, "text/html", doRestart?Page_system_update_HTML_POST:"UPDATE FAILED", Proc_WebPage_system_update_POST); + // when doRestart is true, deliver Page_system_update_HTML_POST + // otherwise Page_system_update_HTML_POST_FAILED + AsyncWebServerResponse *response = request->beginResponse(200, "text/html", doRestart?Page_system_update_HTML_POST:Page_system_update_HTML_POST_FAILED, Proc_WebPage_system_update_POST); response->addHeader("Connection", "close"); request->send(response); } else { @@ -145,7 +147,7 @@ void WebPage_system_update(AsyncWebServerRequest *request) { /* - * Subpage restart + * Subpage wipe */ String Proc_WebPage_system_wipe(const String& var) { if(TestHeaderFooter(var)) { diff --git a/Arduino/CanGrow/include/Webserver/Page_system_HTML.h b/Arduino/CanGrow/include/Webserver/Page_system_HTML.h index feff524..c151d6d 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system_HTML.h +++ b/Arduino/CanGrow/include/Webserver/Page_system_HTML.h @@ -94,8 +94,14 @@ Build : %CGBUILD%
const char* Page_system_update_HTML_POST PROGMEM = R"( -

Successfully updated! Restarting...


-Redirect to "/" in 15 seconds +

Successfully updated! +
Restarting...


+Redirecting to "/" in 15 seconds +)"; + +const char* Page_system_update_HTML_POST_FAILED PROGMEM = R"( +

UPDATE FAILED


+Please see messages on serial monitor for more information and go back to \"System settings > Firmware update\" and try another file. )"; /*