mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-08-10 07:16:37 +02:00
removed database configuration page, using instead SQlite, and integrated grafana interface
This commit is contained in:
59
Flask/app.py
59
Flask/app.py
@ -31,10 +31,9 @@ if secret == "":
|
||||
"""
|
||||
def daily_command():
|
||||
subprocess.Popen(["git",'pull'])
|
||||
subprocess.Popen(["pkill -9 chrome"])
|
||||
subprocess.Popen(["pkill -9 Xvfb"])
|
||||
subprocess.Popen(["pkill -9 undetected_chromedriver"])
|
||||
|
||||
subprocess.Popen(["pkill","-9","chrome"])
|
||||
subprocess.Popen(["pkill","-9","Xvfb"])
|
||||
subprocess.Popen(["pkill","-9", "undetected_chromedriver"])
|
||||
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.start()
|
||||
@ -54,8 +53,6 @@ def start_ms(i):
|
||||
log.close()
|
||||
|
||||
|
||||
|
||||
|
||||
TriggerDict = {}
|
||||
def update_jobs():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
@ -178,15 +175,6 @@ def load_user(userid):
|
||||
#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("/")
|
||||
def main():
|
||||
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))
|
||||
|
||||
|
||||
@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/")
|
||||
def config_get():
|
||||
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'])
|
||||
@login_required
|
||||
def download(filename):
|
||||
print("file send !")
|
||||
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)
|
||||
|
||||
|
||||
update_jobs()
|
||||
edit_version()
|
||||
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)
|
||||
#
|
Reference in New Issue
Block a user