24 lines
451 B
Python
24 lines
451 B
Python
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
|