/* SPDX-License-Identifier: GPL-3.0-only */ #pragma once #include "esp_http_server.h" #define WEB_FIRMWARE_UPDATE_URI "/api/firmware" /* Synchronous HTTPD POST handler; enforces admin cookie/Origin/CSRF itself. * Streams a raw application/octet-stream image into the inactive OTA slot and * rechecks session authority before boot selection. ESP_OK can mean a sent error * response, not a committed update. Selection survives a failed success response: * never blindly retry; further uploads require reboot. A sent success schedules it. */ esp_err_t web_firmware_update_handler(httpd_req_t *request); /* Atomically exclude uploads until reset. Call immediately before an ordinary * reboot (and before any acknowledgement delay); failure means do not reset. * Independent of HTTPS initialization, so UART0 recovery remains available. */ esp_err_t web_firmware_update_reserve_reboot(void); /* Internal HTTPS owner reservation. HTTPD takes before flash and releases on * failure; successful response transfers lifetime to the reboot owner. No * service mutex is held during receive/flash/response. Implemented by server. */ esp_err_t web_firmware_update_reserve(httpd_handle_t server); void web_firmware_update_release(void);