mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
🐛 WebUI初始化逻辑修改 (#1574)
This commit is contained in:
parent
69f09b92d3
commit
65a6f608e6
@ -2,6 +2,7 @@ import asyncio
|
||||
|
||||
import nonebot
|
||||
from fastapi import APIRouter, FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from nonebot.log import default_filter, default_format
|
||||
from nonebot.plugin import PluginMetadata
|
||||
|
||||
@ -21,6 +22,7 @@ from .api.tabs.plugin_manage import router as plugin_router
|
||||
from .api.tabs.system import router as system_router
|
||||
from .auth import router as auth_router
|
||||
from .public import init_public
|
||||
from .config import origins
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="WebUi",
|
||||
@ -79,6 +81,13 @@ async def _():
|
||||
)
|
||||
|
||||
app: FastAPI = nonebot.get_app()
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
app.include_router(BaseApiRouter)
|
||||
app.include_router(WsApiRouter)
|
||||
await init_public(app)
|
||||
|
||||
@ -1,21 +1,7 @@
|
||||
import nonebot
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from pydantic import BaseModel
|
||||
from strenum import StrEnum
|
||||
|
||||
app = nonebot.get_app()
|
||||
|
||||
origins = ["*"]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
|
||||
AVA_URL = "http://q1.qlogo.cn/g?b=qq&nk={}&s=160"
|
||||
|
||||
GROUP_AVA_URL = "http://p.qlogo.cn/gh/{}/{}/640/"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user