forked from rDrama/rDrama
fsdsdf
parent
2f6932872c
commit
106a0305fa
|
@ -89,7 +89,8 @@ mail = Mail(app)
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def 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)
|
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)
|
url = request.url.replace("http://", "https://", 1)
|
||||||
return redirect(url, code=301)
|
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
|
@app.teardown_appcontext
|
||||||
def teardown_request(error):
|
def teardown_request(error):
|
||||||
if hasattr(g, 'db') and g.db:
|
if hasattr(g, 'db') and g.db:
|
||||||
|
|
|
@ -33,6 +33,10 @@ tiers={
|
||||||
"(Rich Bich)": 5,
|
"(Rich Bich)": 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@app.get("/useragent")
|
||||||
|
def useragent():
|
||||||
|
return request.headers.get("User-Agent","")
|
||||||
|
|
||||||
@app.post("/settings/removebackground")
|
@app.post("/settings/removebackground")
|
||||||
@limiter.limit("1/second")
|
@limiter.limit("1/second")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
Loading…
Reference in New Issue