Files
led-driver/main/web.h
T
jimmyandClaude Haiku 5.5 c9838d1cbe led-driver: channel default 11, bare ESP-NOW build, settings and USB config updates
Default ESP-NOW channel is now 11. Adds the bare ESP-NOW-only build option
(CONFIG_LED_ESPNOW_ONLY) with its sdkconfig fragments, a default hostname from
the Wi-Fi MAC, and the related net, link, web and settings changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-21 01:18:55 +13:00

36 lines
1.1 KiB
C

/*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "esp_err.h"
#include "esp_http_server.h"
#ifdef __cplusplus
extern "C" {
#endif
#define WEB_API_MSG_MAX 2048 // a request message: {"method","path","body","host"}
#define WEB_API_REPLY_MAX 16384 // a reply envelope: {"status","body"}
/** @brief Start the HTTP server on port 80 (UI and JSON API). Does nothing if it is running already.
* Without it the USB config port still works (web_api_call runs the call itself). */
esp_err_t web_start(void);
/**
* @brief Add Access-Control-Allow-Origin for a LAN or localhost page that asked (the Origin header).
* Call before the response is sent. Other origins get no header, so the browser blocks them.
*/
void web_allow_lan_origin(httpd_req_t *req);
/**
* @brief Run one API request without HTTP, as the WebSocket does: msg is
* {"method": "GET" or "POST", "path": "/api/...", "body": ..., "host": optional relay target}.
* out gets the envelope {"status": n, "body": "<JSON text>"}. Used by the USB config port.
*/
void web_api_call(const char *msg, char *out, size_t cap);
#ifdef __cplusplus
}
#endif