Update server information
This commit is contained in:
9
main.py
9
main.py
@@ -14,6 +14,7 @@ from tjnetwork import *
|
||||
import asyncio
|
||||
import threading
|
||||
from multiprocessing import Value
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
JUNCTION = 0
|
||||
RESERVOIR = 1
|
||||
@@ -36,6 +37,14 @@ if not os.path.exists(tmpDir):
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# 配置 CORS 中间件
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"], # 允许所有来源
|
||||
allow_credentials=True, # 允许传递凭证(Cookie、HTTP 头等)
|
||||
allow_methods=["*"], # 允许所有 HTTP 方法
|
||||
allow_headers=["*"], # 允许所有 HTTP 头
|
||||
)
|
||||
# 定义一个共享变量
|
||||
lock_simulation = Value('i', 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user