mirror of
https://github.com/sfiorini/iptv-server.git
synced 2026-04-09 07:40:43 +00:00
25 lines
946 B
Python
25 lines
946 B
Python
from utils.database import get_blob_by_path
|
|
from fastapi import APIRouter, Depends, Path
|
|
from fastapi.responses import RedirectResponse
|
|
from src.utils.auth import authenticate_user_query
|
|
|
|
router = APIRouter(prefix="/content", tags=["content"])
|
|
|
|
@router.get("/playlist/{filename}")
|
|
async def serve_content(
|
|
username: str = Depends(authenticate_user_query),
|
|
filename: str = Path(..., min_length=1),
|
|
):
|
|
"""Redirect to the Vercel Blob URL for the requested playlist file"""
|
|
matching_blob = get_blob_by_path('playlists', filename)
|
|
return RedirectResponse(url=matching_blob['url'])
|
|
|
|
@router.get("/epg/{filename}")
|
|
async def serve_content(
|
|
username: str = Depends(authenticate_user_query),
|
|
filename: str = Path(..., min_length=1),
|
|
):
|
|
"""Redirect to the Vercel Blob URL for the requested playlist file"""
|
|
matching_blob = get_blob_by_path('epgs', filename)
|
|
return RedirectResponse(url=matching_blob['url'])
|