- 11.1 MainLayout health indicator: warning MessageBar when fail2ban offline - 11.2 formatDate utility + TimezoneProvider + GET /api/setup/timezone - 11.3 Responsive sidebar: auto-collapse <640px, media query listener - 11.4 PageFeedback (PageLoading/PageError/PageEmpty), BanTable updated - 11.5 prefers-reduced-motion: disable sidebar transition - 11.6 WorldMap ARIA: role/tabIndex/aria-label/onKeyDown for countries - 11.7 Health transition logging (fail2ban_came_online/went_offline) - 11.8 Global handlers: Fail2BanConnectionError/ProtocolError -> 502 - 11.9 379 tests pass, 82% coverage, ruff+mypy+tsc+eslint clean - Timezone endpoint: setup_service.get_timezone, 5 new tests
65 lines
1.7 KiB
Python
65 lines
1.7 KiB
Python
"""Setup wizard Pydantic models.
|
|
|
|
Request, response, and domain models for the first-run configuration wizard.
|
|
"""
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class SetupRequest(BaseModel):
|
|
"""Payload for ``POST /api/setup``."""
|
|
|
|
model_config = ConfigDict(strict=True)
|
|
|
|
master_password: str = Field(
|
|
...,
|
|
min_length=8,
|
|
description="Master password that protects the BanGUI interface.",
|
|
)
|
|
database_path: str = Field(
|
|
default="bangui.db",
|
|
description="Filesystem path to the BanGUI SQLite application database.",
|
|
)
|
|
fail2ban_socket: str = Field(
|
|
default="/var/run/fail2ban/fail2ban.sock",
|
|
description="Path to the fail2ban Unix domain socket.",
|
|
)
|
|
timezone: str = Field(
|
|
default="UTC",
|
|
description="IANA timezone name used when displaying timestamps.",
|
|
)
|
|
session_duration_minutes: int = Field(
|
|
default=60,
|
|
ge=1,
|
|
description="Number of minutes a user session remains valid.",
|
|
)
|
|
|
|
|
|
class SetupResponse(BaseModel):
|
|
"""Response returned after a successful initial setup."""
|
|
|
|
model_config = ConfigDict(strict=True)
|
|
|
|
message: str = Field(
|
|
default="Setup completed successfully. Please log in.",
|
|
)
|
|
|
|
|
|
class SetupTimezoneResponse(BaseModel):
|
|
"""Response for ``GET /api/setup/timezone``."""
|
|
|
|
model_config = ConfigDict(strict=True)
|
|
|
|
timezone: str = Field(..., description="Configured IANA timezone identifier.")
|
|
|
|
|
|
class SetupStatusResponse(BaseModel):
|
|
"""Response indicating whether setup has been completed."""
|
|
|
|
model_config = ConfigDict(strict=True)
|
|
|
|
completed: bool = Field(
|
|
...,
|
|
description="``True`` if the initial setup has already been performed.",
|
|
)
|