From 77c9a1b6d4a83f0f023ffa68489d515d51c64407 Mon Sep 17 00:00:00 2001
From: Yannik Schmidt
Date: Tue, 27 Jun 2023 16:03:42 +0200
Subject: [PATCH] feat: improve display of non-image entities
---
server.py | 7 ++++++-
templates/index.html | 18 +++++++++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/server.py b/server.py
index 8969d8b..1cb3630 100755
--- a/server.py
+++ b/server.py
@@ -140,7 +140,12 @@ def list():
for f in files:
retStringArr += [os.path.join(os.path.basename(root), f)]
- return flask.render_template("index.html", paths=retStringArr)
+ isPictureDict = dict()
+ for p in retStringArr:
+ isPicture = any([x in p for x in ["jpg", "png", "wep", "svg"]])
+ isPictureDict.update({ p : isPicture })
+
+ return flask.render_template("index.html", paths=retStringArr, isPictureDict=isPictureDict)
@app.route("/upload", methods = ['GET', 'POST'])
def upload():
diff --git a/templates/index.html b/templates/index.html
index 8735fb0..d274d68 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -20,16 +20,28 @@
Public Images List: