Rework error system a bit to remove a bunch of duplicated code (#434)

This commit is contained in:
justcool393 2022-12-01 18:58:27 -08:00 committed by GitHub
parent 08602b4279
commit 0c632d73b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 197 additions and 350 deletions

View file

@ -161,10 +161,10 @@ def before_request():
app.config['SETTINGS'] = json.load(f)
if request.host != app.config["SERVER_NAME"]:
return {"error": "Unauthorized host provided."}, 401
return {"error": "Unauthorized host provided."}, 403
if not app.config['SETTINGS']['Bots'] and request.headers.get("Authorization"):
abort(503)
abort(403, "Bots are currently not allowed")
g.db = db_session()