forked from rDrama/rDrama
same as last commit
parent
78cdba291d
commit
bf4b4da053
|
@ -83,6 +83,9 @@ def chat(v):
|
|||
@socketio.on('speak')
|
||||
@is_not_banned_socketio
|
||||
def speak(data, v):
|
||||
if not v.allowed_in_chat:
|
||||
return '', 403
|
||||
|
||||
image = None
|
||||
if data['file']:
|
||||
name = f'/chat_images/{time.time()}'.replace('.','') + '.webp'
|
||||
|
@ -90,9 +93,6 @@ def speak(data, v):
|
|||
f.write(data['file'])
|
||||
image = process_image(name, v)
|
||||
|
||||
if not v.allowed_in_chat:
|
||||
return '', 403
|
||||
|
||||
global messages
|
||||
|
||||
text = data['message'][:CHAT_LENGTH_LIMIT]
|
||||
|
@ -188,6 +188,9 @@ def connect(v):
|
|||
if request.referrer == f'{SITE_FULL}/notifications/messages':
|
||||
join_room(v.id)
|
||||
return ''
|
||||
elif request.referrer.startswith(f'{SITE_FULL}/chat/'):
|
||||
join_room(request.referrer)
|
||||
return ''
|
||||
|
||||
join_room("chat")
|
||||
|
||||
|
@ -203,6 +206,9 @@ def disconnect(v):
|
|||
if request.referrer == f'{SITE_FULL}/notifications/messages':
|
||||
leave_room(v.id)
|
||||
return ''
|
||||
elif request.referrer.startswith(f'{SITE_FULL}/chat/'):
|
||||
leave_room(request.referrer)
|
||||
return ''
|
||||
|
||||
online.pop(v.id, None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue