1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 06:12:20 +01:00

Merge branch 'ota_web_server_esp8266_flash' into integration

This commit is contained in:
J. Nick Koston
2025-09-05 10:26:10 -05:00

View File

@@ -198,9 +198,20 @@ void OTARequestHandler::handleUpload(AsyncWebServerRequest *request, const Strin
void OTARequestHandler::handleRequest(AsyncWebServerRequest *request) { void OTARequestHandler::handleRequest(AsyncWebServerRequest *request) {
AsyncWebServerResponse *response; AsyncWebServerResponse *response;
// Use the ota_success_ flag to determine the actual result // Use the ota_success_ flag to determine the actual result
#ifdef USE_ESP8266
static const char UPDATE_SUCCESS[] PROGMEM = "Update Successful!";
static const char UPDATE_FAILED[] PROGMEM = "Update Failed!";
static const char TEXT_PLAIN[] PROGMEM = "text/plain";
static const char CONNECTION_STR[] PROGMEM = "Connection";
static const char CLOSE_STR[] PROGMEM = "close";
const char *msg = this->ota_success_ ? UPDATE_SUCCESS : UPDATE_FAILED;
response = request->beginResponse(200, TEXT_PLAIN, msg);
response->addHeader(CONNECTION_STR, CLOSE_STR);
#else
const char *msg = this->ota_success_ ? "Update Successful!" : "Update Failed!"; const char *msg = this->ota_success_ ? "Update Successful!" : "Update Failed!";
response = request->beginResponse(200, "text/plain", msg); response = request->beginResponse(200, "text/plain", msg);
response->addHeader("Connection", "close"); response->addHeader("Connection", "close");
#endif
request->send(response); request->send(response);
} }