forked from rDrama/rDrama
users here now
parent
ca18dc8bdd
commit
2b9dcb0c6a
|
@ -5,6 +5,21 @@ from files.__main__ import db_session
|
|||
from random import randint
|
||||
|
||||
def get_logged_in_user():
|
||||
|
||||
if not session.get("session_id"):
|
||||
session["session_id"] = secrets.token_hex(49)
|
||||
|
||||
sessions = cache.get(f'{SITE}_sessions') or {}
|
||||
sessions[session["session_id"]] = g.timestamp
|
||||
|
||||
counter = 0
|
||||
for val in sessions.values():
|
||||
if g.timestamp - val < 60:
|
||||
counter += 1
|
||||
g.counter = counter
|
||||
|
||||
cache.set(f'{SITE}_sessions', sessions)
|
||||
|
||||
if not (hasattr(g, 'db') and g.db): g.db = db_session()
|
||||
|
||||
v = None
|
||||
|
|
|
@ -169,9 +169,6 @@ def notifications(v):
|
|||
@auth_desired
|
||||
def front_all(v, sub=None, subdomain=None):
|
||||
|
||||
if g.webview and not session.get("session_id"):
|
||||
session["session_id"] = secrets.token_hex(49)
|
||||
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
|
||||
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out',''))
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
|
||||
{% endif %}
|
||||
|
||||
{{g.counter}} USERS HERE NOW<br><br>
|
||||
|
||||
{% if sub %}
|
||||
{% if sub.sidebar_html %}
|
||||
<div class="mb-4">{{sub.sidebar_html|safe}}</div>
|
||||
|
|
Loading…
Reference in New Issue