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) {
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)) {

View file

@ -94,8 +94,14 @@ Build : %CGBUILD% <br>
const char* Page_system_update_HTML_POST PROGMEM = R"(<html>
<head><meta http-equiv='refresh' content='15;url=/' /></head>
<body><h1>Successfully updated! Restarting...</h1><br>
Redirect to "/" in 15 seconds
<body><h1>Successfully updated!
<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>)";
/*