forked from rDrama/rDrama
1
0
Fork 0

Fix chat by setting g.timestamp.

The users online count recently added to wrappers.py:get_logged_in_user
uses g.timestamp for its calculations. This is primarily set in
__main__.py:before_request. However, chat has requests which do not
trigger @app.before_request. To resolve this, we now set g.timestamp
in the auth_required wrapper before calling get_logged_in_user().

I think this is safe in general; there's no particular harm to setting
the timestamp _more_ frequently.
master
Snakes 2022-05-25 06:49:02 -04:00
parent 42d810a5e7
commit 67796acc11
1 changed files with 1 additions and 1 deletions

View File

@ -75,7 +75,7 @@ def auth_desired(f):
def auth_required(f):
def wrapper(*args, **kwargs):
g.timestamp = int(time.time())
v = get_logged_in_user()
if not v: abort(401)