Spaces:
Running
Running
FireFlix commited on
Commit ·
302a043
1
Parent(s): e1c936b
feat: add AniList OAuth token exchange proxy
Browse files2657 unmodified lines2658265926602657 unmodified linesexcept Exception as e:return {'success': False, 'error': str(e)[:200]}2657 unmodified lines2658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842657 unmodified linesexcept Exception as e:return {'success': False, 'error': str(e)[:200]}# ─── AniList OAuth token exchange proxy ───────────────────────────────────────from fastapi import Request as FastAPIRequest@app.post('/oauth/anilist-token')async def anilist_token_exchange(request: FastAPIRequest):'''Proxy AniList's OAuth token exchange (bypasses CORS + IP blocking).Only used for the OAuth login step — all other AniList API requests go client-side.'''try:body = await request.json()async with httpx.AsyncClient(timeout=15.0) as client:r = await client.post('https://anilist.co/api/v2/oauth/token',json=body,headers={'Content-Type': 'application/json','Accept': 'application/json','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',})return r.json()except Exception as e:return {'error': str(e)[:200]}
main.py+24