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