2023-01-31 16:24:56 +00:00
|
|
|
from fastapi import APIRouter
|
|
|
|
from fastapi.responses import JSONResponse
|
|
|
|
|
|
|
|
from pagermaid.web.api.utils import authentication
|
|
|
|
from pagermaid.common.update import update
|
|
|
|
|
|
|
|
route = APIRouter()
|
|
|
|
|
|
|
|
|
2023-03-12 03:56:01 +00:00
|
|
|
@route.post("/bot_update", response_class=JSONResponse, dependencies=[authentication()])
|
2023-01-31 16:24:56 +00:00
|
|
|
async def bot_update():
|
|
|
|
await update()
|
2023-03-12 03:56:01 +00:00
|
|
|
return {"status": 0, "msg": "更新成功,请重启 PagerMaid-Pyro 以应用更新。"}
|
2023-01-31 16:24:56 +00:00
|
|
|
|
|
|
|
|
2023-03-12 03:56:01 +00:00
|
|
|
@route.post(
|
|
|
|
"/bot_restart", response_class=JSONResponse, dependencies=[authentication()]
|
|
|
|
)
|
2023-01-31 16:24:56 +00:00
|
|
|
async def bot_restart():
|
2023-06-18 03:13:16 +00:00
|
|
|
from pagermaid.web import web
|
|
|
|
|
|
|
|
web.stop()
|
2023-01-31 17:28:04 +00:00
|
|
|
return {}
|