diff --git a/app/routers/router_downloads.py b/app/routers/router_downloads.py index e5c1779..c4ecfcb 100644 --- a/app/routers/router_downloads.py +++ b/app/routers/router_downloads.py @@ -27,14 +27,15 @@ async def get_downloads( """Get list of all download tasks. Returns HTML for HTMX.""" tasks = download_manager.get_all_tasks() - # Check for HTMX or explicit HTML request + # Force HTML if requested or via HTMX if html or request.headers.get("HX-Request"): - print(f"[DOWNLOADS] Returning HTML list for {len(tasks)} tasks") + print(f"[DOWNLOADS] HTMX Request detected. Returning HTML for {len(tasks)} tasks.") return templates.TemplateResponse( "components/downloads_list.html", {"request": request, "tasks": tasks} ) + print(f"[DOWNLOADS] API Request detected. Returning JSON.") return {"downloads": tasks} diff --git a/templates/components/downloads_list.html b/templates/components/downloads_list.html index c6bdce3..181a44b 100644 --- a/templates/components/downloads_list.html +++ b/templates/components/downloads_list.html @@ -1,8 +1,5 @@ -
Aucun téléchargement en cours
-Aucun téléchargement en cours
+