api: don't hit calc_users if this is the API

sometimes we render HTML where we probably... shouldn't. in most cases
this is fine, but if API clients hit it it can errenously set
pull/24/head
justcool393 2022-11-25 14:31:07 -06:00 committed by geese_suck
parent 3cbaf7f69f
commit 98d53f217f
Signed by: geese_suck
GPG Key ID: 4D09E4B0A7264746
1 changed files with 1 additions and 0 deletions

View File

@ -18,6 +18,7 @@ def session_init():
session["session_id"] = secrets.token_hex(49)
def calc_users(v):
if g.is_api_or_xhr: return
loggedin = cache.get(f'{SITE}_loggedin') or {}
loggedout = cache.get(f'{SITE}_loggedout') or {}
timestamp = int(time.time())