chore: update py files

This commit is contained in:
retoor 2025-12-17 22:09:54 +01:00
parent c23ce6085a
commit 1eed22de5c
3 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,14 @@
## Version 1.4.0 - 2025-12-17
Updates the socket service to improve connection stability and error handling.
**Changes:** 1 files, 4 lines
**Languages:** Python (4 lines)
## Version 1.3.0 - 2025-12-17 ## Version 1.3.0 - 2025-12-17
Users now receive notifications when other users join or depart the application. Departure notifications are debounced to reduce the frequency of rapid successive alerts. Users now receive notifications when other users join or depart the application. Departure notifications are debounced to reduce the frequency of rapid successive alerts.

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "Snek" name = "Snek"
version = "1.3.0" version = "1.4.0"
readme = "README.md" readme = "README.md"
#license = { file = "LICENSE", content-type="text/markdown" } #license = { file = "LICENSE", content-type="text/markdown" }
description = "Snek Chat Application by Molodetz" description = "Snek Chat Application by Molodetz"

View File

@ -102,7 +102,7 @@ class SocketService(BaseService):
self.users[user_uid].add(s) self.users[user_uid].add(s)
if is_first_connection: if is_first_connection:
await self._broadcast_presence("arrived", user_uid, s.user.get("nick") or s.user.get("username"), s.user_color) await self._broadcast_presence("arrived", user_uid, s.user["nick"] or s.user["username"], s.user_color)
return s return s
@ -138,7 +138,7 @@ class SocketService(BaseService):
for s in [sock for sock in self.sockets if sock.ws == ws]: for s in [sock for sock in self.sockets if sock.ws == ws]:
await s.close() await s.close()
user_uid = s.user_uid user_uid = s.user_uid
user_nick = s.user.get("nick") or s.user.get("username") if s.user else None user_nick = (s.user["nick"] or s.user["username"]) if s.user else None
user_color = s.user_color user_color = s.user_color
logger.info(f"Removed socket for user {s.user['username'] if s.user else 'unknown'}") logger.info(f"Removed socket for user {s.user['username'] if s.user else 'unknown'}")
self.sockets.discard(s) self.sockets.discard(s)