mirror of https://github.com/Nezreka/SoulSync.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
564 B
24 lines
564 B
"""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)
|