2023-01-31 16:46:26 +00:00
|
|
|
from pagermaid import logs
|
2023-01-31 16:24:56 +00:00
|
|
|
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
|
2023-01-31 16:46:26 +00:00
|
|
|
if not Config.WEB_SECRET_KEY:
|
2023-01-31 17:07:21 +00:00
|
|
|
logs.warning("未设置 WEB_SECRET_KEY ,请勿将 PagerMaid-Pyro 暴露在公网")
|
2023-01-31 16:24:56 +00:00
|
|
|
import uvicorn
|
|
|
|
from pagermaid.web import app, init_web
|
|
|
|
|
|
|
|
init_web()
|
2023-03-12 03:56:01 +00:00
|
|
|
server = uvicorn.Server(
|
|
|
|
config=uvicorn.Config(app, host=Config.WEB_HOST, port=Config.WEB_PORT)
|
|
|
|
)
|
2023-01-31 16:24:56 +00:00
|
|
|
bot.loop.create_task(server.serve())
|