diff --git a/src/sys/svc/hasp_http.cpp b/src/sys/svc/hasp_http.cpp index febf097c..f5b367a0 100644 --- a/src/sys/svc/hasp_http.cpp +++ b/src/sys/svc/hasp_http.cpp @@ -1,7 +1,6 @@ /* MIT License - Copyright (c) 2019-2022 Francis Van Roie For full license information read the LICENSE file in the project folder */ -//#include "webServer.h" #include "hasplib.h" #include "ArduinoLog.h" @@ -2021,7 +2020,26 @@ static void webHandleFirmware() { if(!httpIsAuthenticated(F("firmware"))) return; - { // Send Content + if(webServer.method() == HTTP_POST && webServer.hasArg(PSTR("url"))) { + String url = webServer.arg(PSTR("url")); + { + String httpMessage((char*)0); + httpMessage.reserve(HTTP_PAGE_SIZE); + httpMessage += F("
ESP update
Updating ESP firmware from: "); + httpMessage += url; + + webSendHeader(haspDevice.get_hostname(), httpMessage.length(), true); + webServer.sendContent(httpMessage); + } + + LOG_TRACE(TAG_HTTP, F("Updating ESP firmware from: %s"), url.c_str()); + dispatch_web_update(NULL, url.c_str(), TAG_HTTP); + } else { + // Send Firmware page String httpMessage((char*)0); httpMessage.reserve(HTTP_PAGE_SIZE); httpMessage += F("