feat: 打开时提示新版本并自动更新
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from server.services import updater
|
||||
|
||||
router = APIRouter(prefix="/api/update")
|
||||
|
||||
|
||||
@router.get("")
|
||||
def check_update():
|
||||
return updater.check()
|
||||
|
||||
|
||||
@router.get("/status")
|
||||
def update_status():
|
||||
return updater.status()
|
||||
|
||||
|
||||
@router.post("/apply")
|
||||
def apply_update():
|
||||
try:
|
||||
return updater.start()
|
||||
except RuntimeError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
Reference in New Issue
Block a user