""" Cache and media routes for L1 server. Handles content retrieval, metadata, media preview, and publishing. """ from fastapi import APIRouter, Request, Depends, HTTPException from fastapi.responses import HTMLResponse, FileResponse from artdag_common.middleware import UserContext, wants_html from ..dependencies import require_auth, get_templates, get_current_user router = APIRouter() # TODO: Migrate routes from server.py lines 2767-4200 # - GET /cache/{content_hash} - Get content details # - GET /cache/{content_hash}/raw - Download raw file # - GET /cache/{content_hash}/mp4 - Video conversion # - GET /cache/{content_hash}/meta - Get metadata # - PATCH /cache/{content_hash}/meta - Update metadata # - POST /cache/{content_hash}/publish - Publish to L2 # - PATCH /cache/{content_hash}/republish - Republish # - DELETE /cache/{content_hash} - Delete content # - POST /cache/import - Import from IPFS # - POST /cache/upload - Upload content # - GET /media - Media list @router.get("/cache/{content_hash}") async def get_cache_item( content_hash: str, request: Request, ): """Get cached content details or serve the file.""" # TODO: Implement with content negotiation raise HTTPException(501, "Not yet migrated") @router.get("/cache/{content_hash}/raw") async def download_raw(content_hash: str): """Download the raw cached file.""" # TODO: Implement raise HTTPException(501, "Not yet migrated") @router.get("/media") async def list_media( request: Request, user: UserContext = Depends(require_auth), ): """List all media in cache.""" # TODO: Implement raise HTTPException(501, "Not yet migrated")