21 lines
673 B
Python
21 lines
673 B
Python
from fastapi import FastAPI, Depends, HTTPException
|
|
from fastapi.responses import RedirectResponse
|
|
from app.cabletv.utils.auth import get_current_user, DOMAIN, CLIENT_ID
|
|
|
|
app = FastAPI()
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"message": "IPTV Updater API"}
|
|
|
|
@app.get("/protected")
|
|
async def protected_route(user = Depends(get_current_user)):
|
|
if isinstance(user, RedirectResponse):
|
|
return user
|
|
return {"message": "Protected content", "user": user['Username']}
|
|
|
|
@app.get("/auth/callback")
|
|
async def auth_callback(code: str):
|
|
# Here you would exchange the code for tokens
|
|
# For now, just redirect to protected route
|
|
return {"auth_code": code} |