Files

29 lines
753 B
Python

from fastapi import APIRouter
from server.errors import call
from server.schemas import AdbBody, GuestBody, PasswordBody, device_payload
from server.services.login import login
router = APIRouter(prefix="/api/login")
@router.post("/guest")
def login_guest(body: GuestBody | None = None):
raw = device_payload(body.device) if body else None
return call(lambda: login.guest(raw))
@router.post("/password")
def login_password(body: PasswordBody):
return call(lambda: login.password(body.email, body.password, device_payload(body.device)))
@router.post("/adb")
def login_adb(body: AdbBody):
return call(lambda: login.adb(
body.serial,
body.adb,
body.device_source,
device_payload(body.device),
))