Initial commit

This commit is contained in:
2026-02-25 15:22:23 +08:00
commit c7138dab9e
84 changed files with 14690 additions and 0 deletions

23
plugin/cors/cors.py Normal file
View File

@@ -0,0 +1,23 @@
from fastapi import FastAPI
from plugin.base import Plugin
class CorsPlugin(Plugin):
def __init__(self, app: FastAPI):
self.name = "CorsPlugin"
self.description = "Enable Cross-Origin Resource Sharing (CORS)"
self.version = "1.0.0"
self.app = app
def install(self):
from fastapi.middleware.cors import CORSMiddleware
# 添加CORS中间件解决跨域问题
self.app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)