From 1b68115e1a9ad491acdf35e3b34870c9860b7652 Mon Sep 17 00:00:00 2001 From: Nex Sabre Date: Sat, 2 Jul 2022 14:42:24 +0200 Subject: [PATCH] feat: Open PacketHelper API (#78) * feat: Open PacketHelper API --- ph/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ph/main.py b/ph/main.py index 5707374..e19efac 100644 --- a/ph/main.py +++ b/ph/main.py @@ -1,4 +1,5 @@ from fastapi import FastAPI, Request, status +from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates @@ -15,6 +16,13 @@ "url": "https://github.com/PacketHelper/packet-helper-next/blob/main/LICENSE", }, ) +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) app.mount("/static", StaticFiles(directory="static"), name="static") app.include_router(api, prefix="/api", tags=["api"])