forked from MarseyWorld/MarseyWorld
fix chat
parent
484cac64f0
commit
38b5492b30
|
@ -91,9 +91,9 @@ def connect(v):
|
|||
if v.username not in online:
|
||||
online.append(v.username)
|
||||
emit("online", online, broadcast=True)
|
||||
online = cache.get(f'{SITE}_online') or 0
|
||||
online += 1
|
||||
cache.set(f'{SITE}_online', online)
|
||||
online_count = cache.get(f'{SITE}_online') or 0
|
||||
online_count += 1
|
||||
cache.set(f'{SITE}_online', online_count)
|
||||
|
||||
emit('typing', typing)
|
||||
return '', 204
|
||||
|
@ -104,9 +104,9 @@ def disconnect(v):
|
|||
if v.username in online:
|
||||
online.remove(v.username)
|
||||
emit("online", online, broadcast=True)
|
||||
online = cache.get(f'{SITE}_online') or 1
|
||||
online -= 1
|
||||
cache.set(f'{SITE}_online', online)
|
||||
online_count = cache.get(f'{SITE}_online') or 1
|
||||
online_count -= 1
|
||||
cache.set(f'{SITE}_online', online_count)
|
||||
|
||||
if v.username in typing: typing.remove(v.username)
|
||||
emit('typing', typing, broadcast=True)
|
||||
|
|
Loading…
Reference in New Issue