diff --git a/frontend.html b/frontend.html index 127b1c0..8e3f370 100644 --- a/frontend.html +++ b/frontend.html @@ -42,7 +42,7 @@
diff --git a/main.py b/main.py index 0a47794..58c8ac2 100644 --- a/main.py +++ b/main.py @@ -186,7 +186,9 @@ def _get_navigation_data(file_hash: str): } -def _render_page(navigation_data: dict, extra_meta: str = "") -> HTMLResponse: +def _render_page( + navigation_data: dict, extra_meta: str = "", image_click_url: str = "" +) -> HTMLResponse: """Render the frontend page with navigation data""" with open("frontend.html", "r") as f: content = f.read() @@ -194,9 +196,8 @@ def _render_page(navigation_data: dict, extra_meta: str = "") -> HTMLResponse: template = string.Template(content) content = template.substitute( img_url="/api/{file_hash}/data".format(file_hash=navigation_data["file_hash"]), - next_random_url="/{next_random_hash}".format( - next_random_hash=navigation_data["next_random_hash"] - ), + image_click_url=image_click_url + or "/{next_random_hash}".format(next_random_hash=navigation_data["next_random_hash"]), next_url="/{next_hash}".format(next_hash=navigation_data["next_hash"]), prev_url="/{prev_hash}".format(prev_hash=navigation_data["prev_hash"]), filename=navigation_data["filename"], @@ -237,8 +238,9 @@ async def hash_page_with_refresh(order: str, delay: int, file_hash: str): ) refresh_meta = f'' + image_click_url = "/{file_hash}".format(file_hash=file_hash) - return _render_page(navigation_data, refresh_meta) + return _render_page(navigation_data, refresh_meta, image_click_url) def _find_indexer_for_hash(file_hash: str):