update system update page HTML

This commit is contained in:
Marcus 2024-10-22 18:29:53 +02:00
parent f1a1cb3aa9
commit c3b9f0f8a6
2 changed files with 12 additions and 4 deletions

View file

@ -135,7 +135,9 @@ String Proc_WebPage_system_update_POST(const String& var) {
void WebPage_system_update(AsyncWebServerRequest *request) { void WebPage_system_update(AsyncWebServerRequest *request) {
if(request->method() == HTTP_POST) { if(request->method() == HTTP_POST) {
doRestart = !Update.hasError(); 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"); response->addHeader("Connection", "close");
request->send(response); request->send(response);
} else { } else {
@ -145,7 +147,7 @@ void WebPage_system_update(AsyncWebServerRequest *request) {
/* /*
* Subpage restart * Subpage wipe
*/ */
String Proc_WebPage_system_wipe(const String& var) { String Proc_WebPage_system_wipe(const String& var) {
if(TestHeaderFooter(var)) { if(TestHeaderFooter(var)) {

View file

@ -94,8 +94,14 @@ Build : %CGBUILD% <br>
const char* Page_system_update_HTML_POST PROGMEM = R"(<html> const char* Page_system_update_HTML_POST PROGMEM = R"(<html>
<head><meta http-equiv='refresh' content='15;url=/' /></head> <head><meta http-equiv='refresh' content='15;url=/' /></head>
<body><h1>Successfully updated! Restarting...</h1><br> <body><h1>Successfully updated!
Redirect to "/" in 15 seconds <br>Restarting...</h1><br>
Redirecting to "/" in 15 seconds
</body></html>)";
const char* Page_system_update_HTML_POST_FAILED PROGMEM = R"(<html>
<head></head><body><h1>UPDATE FAILED</h1><br>
Please see messages on serial monitor for more information and go back to <a href='/system/update'>\"System settings > Firmware update\"</a> and try another file.
</body></html>)"; </body></html>)";
/* /*