chore: disable legacy audio proxy and hide audio controls
This commit is contained in:
+3
-23
@@ -285,29 +285,9 @@ async def api_lookup(
|
||||
|
||||
|
||||
@app.api_route("/api/audio", methods=["GET", "HEAD"])
|
||||
async def api_audio_proxy(url: str = Query(..., min_length=1), user: dict = Depends(require_user)):
|
||||
try:
|
||||
parsed = urllib.parse.urlparse(url)
|
||||
if parsed.scheme not in ("http", "https"):
|
||||
raise HTTPException(status_code=400, detail="Invalid audio URL scheme")
|
||||
if not parsed.netloc:
|
||||
raise HTTPException(status_code=400, detail="Invalid audio host")
|
||||
except Exception:
|
||||
raise HTTPException(status_code=400, detail="Malformed audio URL")
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client:
|
||||
audio_resp = await client.get(url, headers={"User-Agent": USER_AGENT})
|
||||
if audio_resp.status_code != 200:
|
||||
raise HTTPException(status_code=audio_resp.status_code, detail="Audio upstream error")
|
||||
media_type = audio_resp.headers.get("Content-Type", "audio/mpeg")
|
||||
return Response(
|
||||
content=audio_resp.content,
|
||||
media_type=media_type,
|
||||
headers={"Cache-Control": "public, max-age=604800"},
|
||||
)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=502, detail=f"Failed to fetch audio: {str(e)}")
|
||||
async def api_audio_proxy():
|
||||
# Audio feature disabled
|
||||
return Response(status_code=204)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user