add 404.html and new upload page

This commit is contained in:
Christian Krakau-Louis
2025-03-25 21:16:02 +01:00
parent ff12e733ea
commit b95d13df1f
3 changed files with 107 additions and 29 deletions
+6 -2
View File
@@ -1,5 +1,5 @@
# app/frontend.py (new file or inline in main.py)
from fastapi import APIRouter, Request
from fastapi import APIRouter, Request, status
from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
from app.auth import require_login
@@ -24,4 +24,8 @@ async def serve_upload(request: Request):
# 3) Serve favicon.ico from the frontend folder
@router.get("/favicon.ico", response_class=FileResponse)
def favicon():
return os.path.join(frontend_folder, "favicon.ico")
return os.path.join(frontend_folder, "favicon.ico")
@app.exception_handler(404)
async def custom_404_handler(request: Request, exc):
return FileResponse("frontend/404.html", status_code=status.HTTP_404_NOT_FOUND)