This commit is contained in:
Aevann1 2022-01-21 13:14:24 +02:00
parent 35dddec8f9
commit 6954bc75c1
7 changed files with 24 additions and 13 deletions

View file

@ -17,6 +17,7 @@ import redis
import time
from sys import stdout
import faulthandler
import atexit
app = Flask(__name__, template_folder='templates')
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
@ -84,6 +85,8 @@ mail = Mail(app)
@app.before_request
def before_request():
print(request.access_route[0])
print(request.remote_addr)
if request.method.lower() != "get" and app.config["READ_ONLY"]:
return {"error":f"{app.config['SITE_NAME']} is currently in read-only mode."}, 500
@ -109,4 +112,13 @@ def after_request(response):
response.headers.add("X-Frame-Options", "deny")
return response
from files.routes import *
from files.routes import *
def close_running_threads():
with open("marsey_count.json", 'r') as f: marsey_file = loads(f.read())
print(marsey_count['marseylove'])
if marsey_file != marsey_count:
with open('marsey_count.json', 'w') as f: dump(marsey_count, f)
print("Marsey count saved!")
stdout.flush()
atexit.register(close_running_threads)