From 67796acc11f848789c30edc10e19fd9d77083c00 Mon Sep 17 00:00:00 2001 From: TLSM Date: Wed, 25 May 2022 06:49:02 -0400 Subject: [PATCH] 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. --- files/helpers/wrappers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 963ef61092..2b314eee57 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -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)