PagerMaid-Pyro/pagermaid/modules/web.py
xtaodada 5a49bec540
🔖 Update to v1.2.31
support empty secret key
2023-02-01 00:46:26 +08:00

19 lines
562 B
Python

from pagermaid import logs
from pagermaid.config import Config
from pagermaid.hook import Hook
from pagermaid.services import bot
@Hook.on_startup()
async def init_web():
if not Config.WEB_ENABLE:
return
if not Config.WEB_SECRET_KEY:
logs.warn("未设置 WEB_SECRET_KEY ,请勿将 PagerMaid-Pyro 暴露在公网")
import uvicorn
from pagermaid.web import app, init_web
init_web()
server = uvicorn.Server(config=uvicorn.Config(app, host=Config.WEB_HOST, port=Config.WEB_PORT))
bot.loop.create_task(server.serve())