mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 03:37:28 -03:00
Merge branch 'main' of github.com:onionshare/onionshare-ghsa-r78w-rpvr-g57q into release-2.6.2
This commit is contained in:
commit
c0e7a4a0f4
1 changed files with 11 additions and 7 deletions
|
@ -76,12 +76,16 @@ class ChatModeWeb:
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate_username(self, username):
|
def validate_username(self, username):
|
||||||
username = self.remove_unallowed_characters(username.strip())
|
try:
|
||||||
return (
|
username = self.remove_unallowed_characters(username.strip())
|
||||||
username
|
return (
|
||||||
and username not in self.connected_users
|
username
|
||||||
and len(username) < 128
|
and username not in self.connected_users
|
||||||
)
|
and len(username) < 128
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
self.common.log("ChatModeWeb", "validate_username", e)
|
||||||
|
return False
|
||||||
|
|
||||||
def define_routes(self):
|
def define_routes(self):
|
||||||
"""
|
"""
|
||||||
|
@ -160,7 +164,7 @@ class ChatModeWeb:
|
||||||
broadcast=True,
|
broadcast=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ConnectionRefusedError('You are active from another session!')
|
raise ConnectionRefusedError('Invalid session')
|
||||||
|
|
||||||
@self.web.socketio.on("text", namespace="/chat")
|
@self.web.socketio.on("text", namespace="/chat")
|
||||||
def text(message):
|
def text(message):
|
||||||
|
|
Loading…
Reference in a new issue