- FastAPI backend with build queue, WebSocket logs, task management - Vue 3 frontend with build/config/history views - Xcode project build automation with IPA export - Fix: initialize build_dir before try block to ensure cleanup on early failure
20 lines
659 B
Python
20 lines
659 B
Python
"""认证 API"""
|
|
from fastapi import APIRouter
|
|
from ..schemas import LoginRequest, LoginResponse
|
|
from ..config import ADMIN_USERNAME, ADMIN_PASSWORD
|
|
|
|
router = APIRouter(prefix="/api/auth", tags=["auth"])
|
|
|
|
|
|
@router.post("/login", response_model=LoginResponse)
|
|
async def login(request: LoginRequest):
|
|
"""管理员登录"""
|
|
if request.username == ADMIN_USERNAME and request.password == ADMIN_PASSWORD:
|
|
return LoginResponse(
|
|
token="admin-token",
|
|
username=request.username,
|
|
is_admin=True
|
|
)
|
|
from fastapi import HTTPException
|
|
raise HTTPException(status_code=401, detail="用户名或密码错误")
|