From 84b97fdc7a344eb650a93adda966795b5162e65f Mon Sep 17 00:00:00 2001 From: z2_ <88509734+z2-2z@users.noreply.github.com> Date: Sat, 23 Dec 2023 19:35:14 +0100 Subject: [PATCH] Removed ende template --- main.py | 13 +++++++++---- templates/ende.html | 10 ---------- templates/index.html | 11 +++++++++-- 3 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 templates/ende.html diff --git a/main.py b/main.py index b5dfc5b..8511a15 100755 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import sys import os +import json from flask import Flask, render_template, request, send_from_directory @@ -16,10 +17,14 @@ def custom_static(filename): def index(): global files idx = int(request.args.get("image", 0)) - if idx >= 0 and idx < len(files): - return render_template("index.html", img=files[idx], pageno=idx + 1) - else: - return render_template("ende.html") + if idx >= len(files): + idx = len(files) - 1 + if idx < 0: + idx = 0 + pageno = None + if idx >= 0 and idx < len(files) - 1: + pageno = idx + 1 + return render_template("index.html", img=files[idx], pageno=json.dumps(pageno)) def main(): global files diff --git a/templates/ende.html b/templates/ende.html deleted file mode 100644 index 7623193..0000000 --- a/templates/ende.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - Dalli-Klick - - - - Ende - - \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index c1460f3..aed9788 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,8 +7,15 @@