From cc22f009c293d9213b6762ec446854310e3efac9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 13 Sep 2023 01:04:54 +0300 Subject: [PATCH] redirect new chat entrants to /orgy when an orgy is active and display number of ppl in the orgy --- files/routes/chat.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/files/routes/chat.py b/files/routes/chat.py index 7e95d82bd..e2e5241c5 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -71,6 +71,10 @@ def chat(v): if not v.allowed_in_chat: abort(403, CHAT_ERROR_MESSAGE) + orgy = get_orgy() + if orgy: + return redirect('/orgy') + displayed_messages = {k: val for k, val in messages[f"{SITE_FULL}/chat"].items() if val["user_id"] not in v.userblocks} return render_template("chat.html", v=v, messages=displayed_messages) @@ -188,8 +192,13 @@ def speak(data, v): def refresh_online(): emit("online", [online[request.referrer], muted], room=request.referrer, broadcast=True) - if request.referrer == f'{SITE_FULL}/chat': - cache.set(CHAT_ONLINE_CACHE_KEY, len(online[f'{SITE_FULL}/chat']), timeout=0) + + if get_orgy(): + key = f'{SITE_FULL}/orgy' + else: + key = f'{SITE_FULL}/chat' + + cache.set(CHAT_ONLINE_CACHE_KEY, len(online[key]), timeout=0) @socketio.on('connect') @is_not_permabanned_socketio