This commit is contained in:
2026-04-18 14:01:04 +09:00
parent 08a33eb529
commit 971291f650
6 changed files with 126 additions and 110 deletions
+2 -2
View File
@@ -101,7 +101,7 @@ welcome to nercone.dev!
async def fake_error_page(request: Request, code: str):
return error_page(templates=templates, request=request, status_code=int(code))
@app.api_route("/assets/thumbnail/{path:path}", methods=["GET"])
@app.api_route("/assets/images/thumbnail/{path:path}", methods=["GET"])
async def thumbnail(request: Request, path: str) -> Response:
title = request.query_params.get("title", "Untitled Page")
description = request.query_params.get("description", "No description.")
@@ -113,7 +113,7 @@ async def thumbnail(request: Request, path: str) -> Response:
svg_filename = "error.svg" if template_type == "error" else "normal.svg"
fonts_dir = Path.cwd().joinpath("public", "assets", "fonts")
svg_path = Path.cwd().joinpath("public", "assets", "thumbnails", svg_filename)
svg_path = Path.cwd().joinpath("public", "assets", "images", "thumbnail", svg_filename)
svg = svg_path.read_text(encoding="utf-8")
svg = svg.replace("__PATH__", escape(path_display))
svg = svg.replace("__TITLE__", escape(title))