uéuéué ca test des trucs (un viewer de logs)

This commit is contained in:
piair 2023-08-25 13:20:51 +02:00
parent 466ab6d880
commit d16715dbf5
4 changed files with 57 additions and 8 deletions

View File

@ -48,7 +48,7 @@ scheduler.add_job( # on relance le job
def start_ms(i): def start_ms(i):
print("\033[32m" + f"Starting config {i}" + "\033[0m") 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) subprocess.Popen([f"python3 -u /app/MsRewards-Reborn/V6.py -c {i}"], stdout=log, stderr=log, shell=True)
log.close() log.close()
@ -137,13 +137,16 @@ def login():
user = User(id) user = User(id)
login_user(user) login_user(user)
if password == "ChangeMe": if password == "ChangeMe":
return(render_template("change_password.html")) return(redirect('/change_password'))
return(redirect('override')) return(redirect('/override'))
else: else:
return abort(401) return abort(401)
else: else:
return(render_template("login.html")) return(render_template("login.html"))
@app.route("/logs/", methods=["GET"])
def login():
return(render_template("logs.html"))
@app.route("/change_password/", methods=["GET", "POST"]) @app.route("/change_password/", methods=["GET", "POST"])
@login_required @login_required
@ -157,7 +160,7 @@ def change_password():
"secret": secret "secret": secret
} }
json.dump(data, inFile) json.dump(data, inFile)
return(render_template("override.html")) return(render_template("change_password.html"))
# handle login failed # handle login failed

1
Flask/static/logs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.txt

View File

@ -1 +1,44 @@
<iframe src="../user_data/log1.txt" width=200 height=200 frameborder=0 id="frame"> {% extends "base.html" %}
{% block left_pannel %}
<table>
<tr>
<td>
<button class="unselected" onclick="location.href = '/override';">override</button>
</td>
</tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/config';">config</button>
</td>
</tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/discord';">discord</button>
</td>
</tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button>
</td>
</tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
</td>
</tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/settings';">settings</button>
</td>
</tr>
</table>
{% endblock %}
{% block content %}
{%if not current_user.is_authenticated %}
<h1>Already logged in</h1>
{% else %}
<embed type="text/html" src="https://piair.xyz/download/1.log">
{% endif %}
{% endblock %}

View File

@ -59,10 +59,12 @@
<li>reorder config</li> <li>reorder config</li>
<li>real override</li> <li>real override</li>
<li>ban button</li> <li>ban button</li>
<li>pourquoi tout ne se lance pas bien ?</li> <li>pourquoi tout ne se lance pas bien ? - </li>
<li>logs viewer</li> <li>avoir un afficheur de logs</li>
<li>permettre de changer le mot de passe</li>
<li>synchroniser le mot de passe de grafana et celui du bot</li>
</ul> </ul>
<br> <br><br>
<h2>Backup config files</h2> <h2>Backup config files</h2>
<ul> <ul>
<li><a href="/download/configs.json">download account config</a></li> <li><a href="/download/configs.json">download account config</a></li>