forked from rDrama/rDrama
1
0
Fork 0

fix user counts being 0 in error pages

master
Aevann 2023-07-13 17:02:58 +03:00
parent ff67e30949
commit 1d726ebd77
2 changed files with 31 additions and 32 deletions

View File

@ -32,7 +32,7 @@ def calc_users():
g.loggedout_counter = 0
g.loggedin_chat = 0
v = getattr(g, 'v', None) if g else None
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 {}
g.loggedin_chat = cache.get(CHAT_ONLINE_CACHE_KEY) or 0
@ -65,6 +65,7 @@ def calc_users():
if get_setting('ddos_detected'):
toggle_setting('ddos_detected')
set_security_level('high')
return ''
def get_logged_in_user():

View File

@ -7,7 +7,7 @@
<div class="srd">
{{calc_users()}}
{% if SITE_NAME == 'rDrama' %}
{% if not hasattr(g, "loggedin_counter") or (range(1,5) | random == 1 and not (v and v.truescore > 1000)) %}
{% if (range(1,5) | random == 1 and not (v and v.truescore > 1000)) %}
{% include "journoid_banner.html" %}
{% else %}
{% if IS_DKD() %}
@ -69,8 +69,6 @@
{% endif %}
{% elif hasattr(g, "loggedin_counter") %}
{{g.loggedin_counter+g.loggedout_counter}} people here now ({{g.loggedin_counter}} logged in)
{% else %}
Don't make the mistakes seen here.
{% endif %}
</div>