fix missing required context variables on 429 and remove flex tape

pull/1/head
justcool393 2022-11-29 19:12:30 -06:00
parent b6eea4191c
commit f2411415dd
2 changed files with 2 additions and 1 deletions

View File

@ -25,6 +25,7 @@ from files.__main__ import app
@app.errorhandler(418)
@app.errorhandler(429)
def error(e):
g.desires_auth = False
title = ERROR_TITLES.get(e.code, str(e.code))
msg = ERROR_MSGS.get(e.code, str(e.code))
details = e.description

View File

@ -49,7 +49,7 @@ def calc_users():
loggedout_counter = 0
loggedin_chat = 0
v = getattr(g, 'v', None) if g else None
if has_request_context and g and getattr(g, 'desires_auth', False) and not getattr(g, 'is_api_or_xhr', True):
if has_request_context and g and g.desires_auth and not g.is_api_or_xhr:
loggedin = cache.get(LOGGED_IN_CACHE_KEY) or {}
loggedout = cache.get(LOGGED_OUT_CACHE_KEY) or {}
loggedin_chat = cache.get(CHAT_ONLINE_CACHE_KEY) or 0