add 404.html and new upload page
This commit is contained in:
+6
-2
@@ -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)
|
||||
Reference in New Issue
Block a user