Merge branch 'master' into fix-edit-config
This commit is contained in:
commit
f6623df20f
27
Flask/app.py
27
Flask/app.py
@ -90,25 +90,17 @@ def update_jobs():
|
||||
print(e)
|
||||
|
||||
|
||||
def edit_version():
|
||||
with open("/app/MsRewards-Reborn/version", "r") as f:
|
||||
version = f.readline().replace("\n", '')
|
||||
f = open("/app/MsRewards-Reborn/Flask/templates/base.html", "r")
|
||||
txt = f.readlines()
|
||||
f.close()
|
||||
f = open("/app/MsRewards-Reborn/Flask/templates/base.html", "w")
|
||||
for i in txt:
|
||||
i = re.sub('<div class="footer">([^<]+)</div>', f'<div class="footer">{version}</div>', i)
|
||||
f.write(i)
|
||||
f.close()
|
||||
|
||||
|
||||
"""
|
||||
#Flask app
|
||||
"""
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.context_processor
|
||||
def inject_default_variables():
|
||||
with open("/app/MsRewards-Reborn/version", "r") as f:
|
||||
version = f.readline().replace("\n", '')
|
||||
return dict(version=version)
|
||||
"""
|
||||
#Login stuff
|
||||
"""
|
||||
@ -167,7 +159,7 @@ def change_password():
|
||||
# handle login failed
|
||||
@app.errorhandler(401)
|
||||
def unauthorized(e):
|
||||
return(render_template("login.html"))
|
||||
return(redirect("login"))
|
||||
|
||||
|
||||
# callback to reload the user object
|
||||
@ -292,7 +284,6 @@ def proxy_post():
|
||||
|
||||
@app.route("/override/")
|
||||
def override_get():
|
||||
edit_version()
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
return(render_template("override.html", data=configs))
|
||||
@ -300,7 +291,6 @@ def override_get():
|
||||
|
||||
@app.route("/override/", methods=["post"])
|
||||
def override_post():
|
||||
edit_version()
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
|
||||
@ -373,6 +363,10 @@ def logs():
|
||||
print(configs)
|
||||
return(render_template("logs.html", data=configs))
|
||||
|
||||
@app.route("/stats/", methods=["GET", "POST"])
|
||||
def stats():
|
||||
return(render_template("stats.html"))
|
||||
|
||||
|
||||
|
||||
@app.route('/download/<path:filename>', methods=['GET', 'POST'])
|
||||
@ -418,5 +412,4 @@ def maxi(dict):
|
||||
|
||||
|
||||
update_jobs()
|
||||
edit_version()
|
||||
subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh'])
|
||||
|
@ -26,7 +26,7 @@
|
||||
html {
|
||||
text-align: center;
|
||||
font-family: Montserrat;
|
||||
height: 90%;
|
||||
height: 95%;
|
||||
}
|
||||
|
||||
form {
|
||||
@ -195,7 +195,7 @@ body {
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
height: 90%;
|
||||
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ body {
|
||||
border: 1px solid var(--color-border0);
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
height: 80%;
|
||||
height: 90%;
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">Version not detected yet</div>
|
||||
<div class="footer">{{version}}</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -28,7 +28,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
|
||||
<button class="unselected" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
|
||||
<button class="unselected" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
|
||||
<button class="unselected" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
|
||||
<button class="unselected" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
|
||||
<button class="unselected" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" onclick="location.href = '/grafana';">stats</button>
|
||||
<button class="unselected" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -61,10 +61,8 @@
|
||||
|
||||
<h2>TODO</h2>
|
||||
<ul>
|
||||
<li>reorder config</li>
|
||||
<li>real override</li>
|
||||
<li>ban button</li>
|
||||
<li>pourquoi tout ne se lance pas bien ?</li>
|
||||
<li>synchroniser le mot de passe de grafana et celui du bot</li>
|
||||
</ul>
|
||||
<br><br>
|
||||
|
51
Flask/templates/stats.html
Normal file
51
Flask/templates/stats.html
Normal file
@ -0,0 +1,51 @@
|
||||
{% 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 = '/logs';">logs</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="selected" 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 %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<iframe src="/grafana?orgId=1&kiosk" width="100%" height="100%" frameborder="0"></iframe>
|
||||
{% endif %}
|
||||
|
||||
{%endblock %}
|
@ -328,7 +328,7 @@ root_url = %(protocol)s://localhost:3000/grafana/
|
||||
;cookie_samesite = lax
|
||||
|
||||
# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
|
||||
;allow_embedding = false
|
||||
allow_embedding = true
|
||||
|
||||
# Set to true if you want to enable http strict transport security (HSTS) response header.
|
||||
# HSTS tells browsers that the site should only be accessed using HTTPS.
|
||||
|
Loading…
Reference in New Issue
Block a user