Skip to content

Commit

Permalink
fix: fix file routes
Browse files Browse the repository at this point in the history
  • Loading branch information
EstrellaXD committed Jun 1, 2023
1 parent e647327 commit 660eb7d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/module/api/web.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi import Request
from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.responses import HTMLResponse, RedirectResponse, FileResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates

Expand All @@ -12,6 +12,19 @@
router.mount("/assets", StaticFiles(directory="templates/assets"), name="assets")
templates = Jinja2Templates(directory="templates")

# Resource
@router.get("/favicon.svg", tags=["html"])
def favicon():
return FileResponse("templates/favicon.svg")

@router.get("/AutoBangumi.svg", tags=["html"])
def logo():
return FileResponse("templates/AutoBangumi.svg")

@router.get("/favicon-light.svg", tags=["html"])
def favicon_light():
return FileResponse("templates/favicon-light.svg")

# HTML Response
@router.get("/{full_path:path}", response_class=HTMLResponse, tags=["html"])
def index(request: Request):
Expand Down

0 comments on commit 660eb7d

Please sign in to comment.