From ddab0931e1325709e3d39ddd221b0bfa34540822 Mon Sep 17 00:00:00 2001 From: tobiasfaust Date: Wed, 9 Oct 2024 16:45:06 +0200 Subject: [PATCH] extract reboot response into html file --- data/web/reboot.html | 19 +++++++++++++++++++ src/MyWebServer.cpp | 9 ++------- src/html_update.h | 25 ------------------------- 3 files changed, 21 insertions(+), 32 deletions(-) create mode 100644 data/web/reboot.html diff --git a/data/web/reboot.html b/data/web/reboot.html new file mode 100644 index 0000000..bae87c4 --- /dev/null +++ b/data/web/reboot.html @@ -0,0 +1,19 @@ + + + + + + + + Solar Inverter Modbus MQTT Gateway + + Success! Rebooting... +

+ + + \ No newline at end of file diff --git a/src/MyWebServer.cpp b/src/MyWebServer.cpp index 457d0bf..5d8b88a 100644 --- a/src/MyWebServer.cpp +++ b/src/MyWebServer.cpp @@ -47,9 +47,7 @@ void MyWebServer::handle_update_page(AsyncWebServerRequest *request) { } void MyWebServer::handle_update_response(AsyncWebServerRequest *request) { - AsyncWebServerResponse *response = request->beginResponse(200, "text/html", HTML_UPDATERESPONSE); - response->addHeader("Server","ESP Async Web Server"); - request->send(response); + request->send(LittleFS, "/web/reboot.html", "text/html"); } void MyWebServer::handle_update_progress(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) { @@ -112,10 +110,7 @@ void MyWebServer::handleFavIcon(AsyncWebServerRequest *request) { } void MyWebServer::handleReboot(AsyncWebServerRequest *request) { - AsyncWebServerResponse *response = request->beginResponse(200, "text/html", HTML_UPDATERESPONSE); - response->addHeader("Server","ESP Async Web Server"); - request->send(response); - + request->send(LittleFS, "/web/reboot.html", "text/html"); this->DoReboot = true; } diff --git a/src/html_update.h b/src/html_update.h index e340710..b58a4ce 100644 --- a/src/html_update.h +++ b/src/html_update.h @@ -1,31 +1,6 @@ #ifndef HTMLUPDATE_H #define HTMLUPDATE_H -const char HTML_UPDATERESPONSE[] PROGMEM = R"=====( - - - - - - - - - Solar Inverter Modbus MQTT Gateway - - Success! Rebooting... -

- - - - -)====="; - - // https://jsfiddle.net/tobiasfaust/Lc1earnz/ const char HTML_UPDATEPAGE[] PROGMEM = R"=====(