removed database configuration page, using instead SQlite, and integrated grafana interface

This commit is contained in:
piair 2023-08-24 21:18:36 +02:00
parent 1befff788d
commit 5c2fa42f51
11 changed files with 7 additions and 191 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
dev_build.sh
geckodriver.log geckodriver.log
.vscode/ .vscode/
/Git /Git

View File

@ -31,10 +31,9 @@ if secret == "":
""" """
def daily_command(): def daily_command():
subprocess.Popen(["git",'pull']) subprocess.Popen(["git",'pull'])
subprocess.Popen(["pkill -9 chrome"]) subprocess.Popen(["pkill","-9","chrome"])
subprocess.Popen(["pkill -9 Xvfb"]) subprocess.Popen(["pkill","-9","Xvfb"])
subprocess.Popen(["pkill -9 undetected_chromedriver"]) subprocess.Popen(["pkill","-9", "undetected_chromedriver"])
scheduler = BackgroundScheduler() scheduler = BackgroundScheduler()
scheduler.start() scheduler.start()
@ -54,8 +53,6 @@ def start_ms(i):
log.close() log.close()
TriggerDict = {} TriggerDict = {}
def update_jobs(): def update_jobs():
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
@ -178,15 +175,6 @@ def load_user(userid):
#end of login stuff #end of login stuff
""" """
@app.route("/", methods=["post"])
def dev():
action = request.form
print(action)
if action == "dev":
print("dev action test")
return(f"<h1> TO IMPLEMENT - {action}</h1>")
@app.route("/") @app.route("/")
def main(): def main():
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
@ -329,36 +317,6 @@ def override_post():
return(render_template("override.html", data=configs)) return(render_template("override.html", data=configs))
@app.route("/database/")
def database_get():
with open("/app/MsRewards-Reborn/user_data/database.json", "r") as inFile:
database = json.load(inFile)
return(render_template("database.html", data = database))
@app.route("/database/", methods=["post"])
def database_post():
action = request.form
data = {
"host": action['address'],
"table": action['table'],
"usr": action['user'],
"pwd": action['password'],
"checked": ""
}
try :
if action["switch"] :
data['checked'] = "checked"
except:
pass
with open("/app/MsRewards-Reborn/user_data/database.json", "w") as inFile:
json.dump(data, inFile)
return(render_template("database.html", data = data))
@app.route("/config/") @app.route("/config/")
def config_get(): def config_get():
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
@ -413,7 +371,6 @@ def logs():
@app.route('/download/<path:filename>', methods=['GET', 'POST']) @app.route('/download/<path:filename>', methods=['GET', 'POST'])
@login_required @login_required
def download(filename): def download(filename):
print("file send !")
return send_from_directory(directory='/app/MsRewards-Reborn/user_data/', path=filename, as_attachment=True) return send_from_directory(directory='/app/MsRewards-Reborn/user_data/', path=filename, as_attachment=True)
@ -453,12 +410,6 @@ def maxi(dict):
return(m+1) return(m+1)
update_jobs()
edit_version()
subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh']) subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh'])
#if __name__ == '__main__':
# print("this is launched")
# setup_grafana()
# update_jobs()
# edit_version()
# app.run(host='0.0.0.0', port=1234, debug=True)
#

View File

@ -17,11 +17,6 @@
<button class="unselected" onclick="location.href = '/discord';">discord</button> <button class="unselected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button> <button class="unselected" onclick="location.href = '/proxy';">proxy</button>
@ -44,7 +39,6 @@
{%if not current_user.is_authenticated %} {%if not current_user.is_authenticated %}
<h1>Already logged in</h1> <h1>Already logged in</h1>
{% else %} {% else %}
<form method="post" action="/change_password/"> <form method="post" action="/change_password/">
<table> <table>
<tr> <tr>

View File

@ -16,11 +16,6 @@
<button class="unselected" onclick="location.href = '/discord';">discord</button> <button class="unselected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button> <button class="unselected" onclick="location.href = '/proxy';">proxy</button>

View File

@ -1,99 +0,0 @@
{% 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="selected" onclick="location.href = '/database';">database</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 %}
<button class="unselected" onclick="location.href = '/login';">login</button>
{% else %}
<form method="post" action="/database/">
<table>
<tr>
<td class="comlumn-name"></td>
<td><input type="checkbox" id="switch" name="switch" {{data['checked']}} /><label for="switch">Toggle</label></td>
</tr>
<tr>
<td class="comlumn-name">address : </td>
<td><input type="text" name="address" value="{{ data['host']}}"></td>
</tr>
<tr>
<td class="comlumn-name">table : </td>
<td><input type="text" name="table" value="{{ data['table']}}"></td>
</tr>
<tr>
<td class="comlumn-name">user : </td>
<td><input type="text" name="user" value="{{ data['usr']}}"></td>
</tr>
<tr>
<td class="comlumn-name">password : </td>
<td><input type="text" name="password" value="{{ data['pwd']}}"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="data" value="Update !" class="button"/></td>
</tr>
</table>
</form>
<script>
function changecat(value) {
if (value == "new"){
document.getElementById("address").value = value;
document.getElementById("port").value = value;
document.getElementById("name").value = value;
}
else {
document.getElementById("address").value = value;
document.getElementById("port").value = value;
document.getElementById("name").value = value;
}
}
</script>
{% endif %}
{% endblock %}

View File

@ -17,11 +17,6 @@
<button class="selected" onclick="location.href = '/discord';">discord</button> <button class="selected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button> <button class="unselected" onclick="location.href = '/proxy';">proxy</button>

View File

@ -17,11 +17,6 @@
<button class="unselected" onclick="location.href = '/discord';">discord</button> <button class="unselected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button> <button class="unselected" onclick="location.href = '/proxy';">proxy</button>

View File

@ -17,11 +17,6 @@
<button class="unselected" onclick="location.href = '/discord';">discord</button> <button class="unselected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button> <button class="unselected" onclick="location.href = '/proxy';">proxy</button>

View File

@ -17,11 +17,6 @@
<button class="unselected" onclick="location.href = '/discord';">discord</button> <button class="unselected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="selected" onclick="location.href = '/proxy';">proxy</button> <button class="selected" onclick="location.href = '/proxy';">proxy</button>

View File

@ -17,11 +17,6 @@
<button class="unselected" onclick="location.href = '/discord';">discord</button> <button class="unselected" onclick="location.href = '/discord';">discord</button>
</td> </td>
</tr> </tr>
<tr>
<td>
<button class="unselected" onclick="location.href = '/database';">database</button>
</td>
</tr>
<tr> <tr>
<td> <td>
<button class="unselected" onclick="location.href = '/proxy';">proxy</button> <button class="unselected" onclick="location.href = '/proxy';">proxy</button>

View File

@ -1 +1 @@
v6.1.0 v6.2.0