more changes from bot review

This commit is contained in:
Georges-Antoine Assi
2025-12-07 16:34:22 -05:00
parent 2c93717df6
commit 86098ef1d9
3 changed files with 6 additions and 7 deletions

View File

@@ -48,17 +48,17 @@ class RoomsResponse(TypedDict):
@protected_route(router.get, "/list", [Scope.ASSETS_READ])
async def get_rooms(request: Request, game_id: str) -> Dict[str, RoomsResponse]:
netplay_rooms = await netplay_handler.get_all()
open_rooms: Dict[str, RoomsResponse] = {}
for session_id, room in netplay_rooms.items():
if not _is_room_open(room, game_id):
continue
open_rooms[session_id] = RoomsResponse(
open_rooms: Dict[str, RoomsResponse] = {
session_id: RoomsResponse(
room_name=room["room_name"],
current=len(room["players"]),
max=room["max_players"],
player_name=_get_owner_player_name(room),
hasPassword=bool(room["password"]),
)
for session_id, room in netplay_rooms.items()
if _is_room_open(room, game_id)
}
return open_rooms

View File

@@ -120,7 +120,6 @@ async def _handle_leave(sid: str, session_id: str, player_id: str):
if not current_room["players"]:
await netplay_handler.delete([session_id])
await netplay_handler.set(session_id, current_room)
# Notify clients that the room is now empty
await netplay_socket_handler.socket_server.emit(
"users-updated", {}, room=session_id

View File

@@ -397,7 +397,7 @@ window.EJS_onGameStart = async () => {
window.EJS_emulator.netplayGetOpenRooms = async () => {
try {
const response = await fetch(
`/api/netplay/list?&game_id=${window.EJS_gameID}`,
`/api/netplay/list?game_id=${window.EJS_gameID}`,
);
return await response.json();
} catch (error) {