remotes/1693045480750635534/spooky-22
Aevann1 2021-12-29 10:06:40 +02:00
parent 2f6932872c
commit 106a0305fa
2 changed files with 6 additions and 7 deletions

View File

@ -89,7 +89,8 @@ mail = Mail(app)
@app.before_request
def before_request():
if request.method.lower() != "get" and app.config["READ_ONLY"]: return {"error":f"{app.config['SITE_NAME']} is currently in read-only mode."}, 500
if request.method.lower() != "get" and app.config["READ_ONLY"]:
return {"error":f"{app.config['SITE_NAME']} is currently in read-only mode."}, 500
if app.config["BOT_DISABLE"] and request.headers.get("Authorization"): abort(503)
@ -101,12 +102,6 @@ def before_request():
url = request.url.replace("http://", "https://", 1)
return redirect(url, code=301)
g.system = 'desktop'
ua = request.headers.get("User-Agent","")
for i in ('Version','Android','webOS','iPhone','iPad','iPod','BlackBerry','IEMobile','Opera Mini','Mobile','mobile','CriOS'):
if i in ua: g.system = 'mobile'
@app.teardown_appcontext
def teardown_request(error):
if hasattr(g, 'db') and g.db:

View File

@ -33,6 +33,10 @@ tiers={
"(Rich Bich)": 5,
}
@app.get("/useragent")
def useragent():
return request.headers.get("User-Agent","")
@app.post("/settings/removebackground")
@limiter.limit("1/second")
@auth_required