From 1d16294c041ba4c667bb02dec4ddec3bbd9d8fe6 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Wed, 3 Apr 2024 15:34:46 +0200 Subject: [PATCH] Add more logs (custom.txt..) to logs view --- Flask/app.py | 14 ++++++++++++-- Flask/templates/logs.html | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Flask/app.py b/Flask/app.py index bf55f0a..ea4ea22 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -373,8 +373,18 @@ def config_post(): def logs(): with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: configs = json.load(inFile) - print(configs) - return(render_template("logs.html", data=configs)) + + files = [(configs[i]["name"], i) for i in configs] + config_files = [i[1] for i in files] + for f in os.listdir("/app/MsRewards-Reborn/Flask/static/logs"): + fid = ".".join(f.split(".")[:-1]) # filename without .txt + if f != ".gitignore" and fid not in config_files: + files.append((f, fid)) + + return render_template( + "logs.html", + files=files + ) @app.route("/stats/", methods=["GET", "POST"]) diff --git a/Flask/templates/logs.html b/Flask/templates/logs.html index c034d57..c459adb 100644 --- a/Flask/templates/logs.html +++ b/Flask/templates/logs.html @@ -8,8 +8,8 @@