"""Subsonic system endpoints: ping and license.""" from fastapi import APIRouter, Response from app.api.deps import SubsonicFormat, SubsonicUser from app.api.rest.envelope import subsonic_response router = APIRouter() @router.api_route("/ping", methods=["GET", "POST"]) @router.api_route("/ping.view", methods=["GET", "POST"]) async def ping(_user: SubsonicUser, fmt: SubsonicFormat) -> Response: # Requiring auth makes ping a credential check — exactly how clients use it. return subsonic_response(fmt=fmt) @router.api_route("/getLicense", methods=["GET", "POST"]) @router.api_route("/getLicense.view", methods=["GET", "POST"]) async def get_license(_user: SubsonicUser, fmt: SubsonicFormat) -> Response: # Self-hosted and free — the license is always valid. return subsonic_response({"license": {"valid": True}}, fmt=fmt)