diff --git a/Flask/app.py b/Flask/app.py index 706a18a..5ee0ca7 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -90,25 +90,16 @@ 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('', f'', i) - f.write(i) - f.close() - - """ #Flask app """ app = Flask(__name__) +@app.context_processor +def inject_default_variables(): + version = f.readline().replace("\n", '') + return dict(version=version) """ #Login stuff """ @@ -292,7 +283,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 +290,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) @@ -418,5 +407,4 @@ def maxi(dict): update_jobs() -edit_version() subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh']) diff --git a/Flask/templates/base.html b/Flask/templates/base.html index 0ab36a3..5fb9d51 100644 --- a/Flask/templates/base.html +++ b/Flask/templates/base.html @@ -32,7 +32,7 @@ {% endblock %} - +