diff --git a/app/dictionary.py b/app/dictionary.py index 61472cb..39c4161 100644 --- a/app/dictionary.py +++ b/app/dictionary.py @@ -46,7 +46,7 @@ async def fetch_wiktionary_wikitext(word: str) -> Dict[str, Any]: return { "ipa": ipa_cleaned, - "audio": audio_matches, + "audio": [], "ru_translations": ru_cleaned } except Exception: @@ -232,12 +232,9 @@ async def lookup_term(query: str) -> Dict[str, Any]: elif d_muse.get("ipa"): result["phonetic"] = d_muse["ipa"] - # 2. Audio URL / File - if free_dict.get("audio_url"): - result["audio_url"] = free_dict["audio_url"] - elif w_wiki.get("audio"): - result["audio_file"] = w_wiki["audio"][0] - result["audio_url"] = f"/api/audio?file={urllib.parse.quote(result['audio_file'])}" + # 2. Audio URL / File (Disabled) + result["audio_file"] = "" + result["audio_url"] = "" # 3. Part of Speech if w_defs.get("parts_of_speech"): diff --git a/app/main.py b/app/main.py index 66c3676..7d85a36 100644 --- a/app/main.py +++ b/app/main.py @@ -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) # --------------------------------------------------------------------------- diff --git a/app/static/index.html b/app/static/index.html index 5343b89..f365d7c 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -125,7 +125,7 @@