From d16715dbf5f7fbd490f9e7b35fc13932f265de71 Mon Sep 17 00:00:00 2001 From: piair Date: Fri, 25 Aug 2023 13:20:51 +0200 Subject: [PATCH] =?UTF-8?q?u=C3=A9u=C3=A9u=C3=A9=20ca=20test=20des=20trucs?= =?UTF-8?q?=20(un=20viewer=20de=20logs)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Flask/app.py | 11 +++++---- Flask/static/logs/.gitignore | 1 + Flask/templates/logs.html | 45 ++++++++++++++++++++++++++++++++++- Flask/templates/settings.html | 8 ++++--- 4 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 Flask/static/logs/.gitignore diff --git a/Flask/app.py b/Flask/app.py index 3b3d572..f13e22d 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -48,7 +48,7 @@ scheduler.add_job( # on relance le job def start_ms(i): print("\033[32m" + f"Starting config {i}" + "\033[0m") - log = open(f"/app/MsRewards-Reborn/user_data/logs/{i}.txt", 'a') # so that data written to it will be appended + log = open(f"/app/MsRewards-Reborn/Flask/static/logs/{i}.txt", 'a') # so that data written to it will be appended subprocess.Popen([f"python3 -u /app/MsRewards-Reborn/V6.py -c {i}"], stdout=log, stderr=log, shell=True) log.close() @@ -137,13 +137,16 @@ def login(): user = User(id) login_user(user) if password == "ChangeMe": - return(render_template("change_password.html")) - return(redirect('override')) + return(redirect('/change_password')) + return(redirect('/override')) else: return abort(401) else: return(render_template("login.html")) +@app.route("/logs/", methods=["GET"]) +def login(): + return(render_template("logs.html")) @app.route("/change_password/", methods=["GET", "POST"]) @login_required @@ -157,7 +160,7 @@ def change_password(): "secret": secret } json.dump(data, inFile) - return(render_template("override.html")) + return(render_template("change_password.html")) # handle login failed diff --git a/Flask/static/logs/.gitignore b/Flask/static/logs/.gitignore new file mode 100644 index 0000000..314f02b --- /dev/null +++ b/Flask/static/logs/.gitignore @@ -0,0 +1 @@ +*.txt \ No newline at end of file diff --git a/Flask/templates/logs.html b/Flask/templates/logs.html index b29fe91..c2f173e 100644 --- a/Flask/templates/logs.html +++ b/Flask/templates/logs.html @@ -1 +1,44 @@ -