Added server status and server selection dropdown.

This commit is contained in:
2026-08-30 22:15:32 +02:00
parent 562c924809
commit bc87f10661
3 changed files with 513 additions and 50 deletions

View File

@@ -19,6 +19,7 @@ SETTINGS_SCHEMA = 1
@dataclass(frozen=True)
class Settings:
realm: str = "Babel"
width: int = 1600
height: int = 900
output_width: int = 1600
@@ -133,6 +134,7 @@ def _read_settings_object(path: Path) -> dict[str, object] | None:
def _settings_from_object(value: dict[str, object]) -> Settings:
settings = Settings(
realm=_string(value, "realm", "Babel").strip(),
width=_integer(value, "width", 1600),
height=_integer(value, "height", 900),
output_width=_integer(value, "output_width", 1600),
@@ -215,6 +217,12 @@ def _fsync_directory(path: Path) -> None:
def _validate(settings: Settings) -> None:
if (
len(settings.realm) > 64
or not settings.realm.strip()
or any(ord(character) < 32 for character in settings.realm)
):
raise ValueError("realm must be a non-empty display name")
for name, value in (
("width", settings.width),
("height", settings.height),