okay normalement le numero de version marche

This commit is contained in:
piair 2023-08-29 18:34:19 +02:00
parent 2433609cd8
commit 15103b7905
2 changed files with 5 additions and 17 deletions

View File

@ -90,25 +90,16 @@ def update_jobs():
print(e) 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 #Flask app
""" """
app = Flask(__name__) app = Flask(__name__)
@app.context_processor
def inject_default_variables():
version = f.readline().replace("\n", '')
return dict(version=version)
""" """
#Login stuff #Login stuff
""" """
@ -292,7 +283,6 @@ def proxy_post():
@app.route("/override/") @app.route("/override/")
def override_get(): def override_get():
edit_version()
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)
return(render_template("override.html", data=configs)) return(render_template("override.html", data=configs))
@ -300,7 +290,6 @@ def override_get():
@app.route("/override/", methods=["post"]) @app.route("/override/", methods=["post"])
def override_post(): def override_post():
edit_version()
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)
@ -418,5 +407,4 @@ def maxi(dict):
update_jobs() update_jobs()
edit_version()
subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh']) subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh'])

View File

@ -32,7 +32,7 @@
{% endblock %} {% endblock %}
</div> </div>
</div> </div>
<div class="footer">Version not detected yet</div> <div class="footer">{{version}}</div>
</body> </body>
</html> </html>