Add more logs (custom.txt..) to logs view

This commit is contained in:
augustin64 2024-04-03 15:34:46 +02:00
parent fae2033061
commit 1d16294c04
2 changed files with 14 additions and 4 deletions

View File

@ -373,8 +373,18 @@ def config_post():
def logs(): def logs():
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
configs = json.load(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"]) @app.route("/stats/", methods=["GET", "POST"])

View File

@ -8,8 +8,8 @@
<select name="select" onchange="change_logs(this.value)"> <select name="select" onchange="change_logs(this.value)">
<option id="null" value="0">Choisir une config</option> <option id="null" value="0">Choisir une config</option>
{% for i in data %} {% for file in files %}
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option> <option id="{{ file[0] }}" value="{{ file[1] }}">{{ file[0] }}</option>
{% endfor %} {% endfor %}
</select> </select>
<br><br> <br><br>