From f6b312478e634f52a5830641e23ca39b6029b35c Mon Sep 17 00:00:00 2001 From: Ramforth Date: Fri, 31 Oct 2025 19:00:00 +0100 Subject: [PATCH] Add CORS middleware to main.py for weather_overlay --- weather_overlay/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/weather_overlay/main.py b/weather_overlay/main.py index 8cd6ef6..14c7125 100644 --- a/weather_overlay/main.py +++ b/weather_overlay/main.py @@ -1,9 +1,18 @@ from fastapi import FastAPI, WebSocket, WebSocketDisconnect +from starlette.middleware.cors import CORSMiddleware import httpx import json app = FastAPI() +app.add_middleware( + CORSMiddleware, + allow_origins=["https://overlays.ramforth.net"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + # OpenWeatherMap API Configuration OPENWEATHERMAP_API_KEY = "88764d3fd0fec25358ebce447f9f8d0b" OPENWEATHERMAP_URL = "http://api.openweathermap.org/data/2.5/weather"