soulsync/core/webui/spa.py
Antti Kettunen 32bf52cc18
Extract WebUI asset helpers
- move Vite manifest handling and SPA route rules into core/webui
- keep web_server.py focused on Flask route wiring
- add tests for asset rendering and manifest reload behavior
- keep image URL normalization coverage alongside the metadata helpers
2026-05-13 22:26:25 +03:00

23 lines
564 B
Python

"""WebUI SPA routing helpers."""
from __future__ import annotations
EXACT_EXCLUDED_PATHS = {"/callback", "/status"}
PREFIX_EXCLUDED_PATHS = (
"/api",
"/auth",
"/callback/",
"/deezer/",
"/socket.io",
"/static",
"/stream",
"/tidal/",
)
def should_serve_webui_spa(pathname: str) -> bool:
"""Return True when a request path should fall through to the SPA."""
normalized = pathname.rstrip("/") or "/"
if normalized in EXACT_EXCLUDED_PATHS:
return False
return not normalized.startswith(PREFIX_EXCLUDED_PATHS)