enable CORS for web server

This commit is contained in:
gebeto 2025-12-23 14:34:40 +02:00
parent 1107590b56
commit b6f8bd93ef

View File

@ -166,6 +166,7 @@ void CrossPointWebServer::handleStatus() const {
json += "\"uptime\":" + String(millis() / 1000); json += "\"uptime\":" + String(millis() / 1000);
json += "}"; json += "}";
server->sendHeader("Access-Control-Allow-Origin", "*");
server->send(200, "application/json", json); server->send(200, "application/json", json);
} }
@ -246,6 +247,7 @@ void CrossPointWebServer::handleFileListData() const {
} }
} }
server->sendHeader("Access-Control-Allow-Origin", "*");
server->setContentLength(CONTENT_LENGTH_UNKNOWN); server->setContentLength(CONTENT_LENGTH_UNKNOWN);
server->send(200, "application/json", ""); server->send(200, "application/json", "");
server->sendContent("["); server->sendContent("[");