private shares and revokation works

This commit is contained in:
2025-12-13 00:34:38 +05:00
parent f5370aa7f9
commit 4007445396
13 changed files with 307 additions and 96 deletions

View File

@@ -63,7 +63,7 @@ async def revoke_map_share(
current_user: User = Depends(get_current_user)
):
"""Revoke map share from a user."""
map_share_service.delete_map_share(db, map_id, share_id, current_user)
await map_share_service.delete_map_share(db, map_id, share_id, current_user)
return None

View File

@@ -60,9 +60,20 @@ async def websocket_endpoint(
# CRITICAL: Close the DB session immediately after authentication
db.close()
# Add to connection manager (don't call accept again)
manager.active_connections.setdefault(str(map_id), set()).add(websocket)
logger.info(f"Client connected to map {map_id}. Total connections: {len(manager.active_connections[str(map_id)])}")
# Add to connection manager (don't call accept again, connect method will accept)
# Note: We need to call connect but it will try to accept again, so we skip it
# Instead, manually add the connection
user_id = user.id if user else None
map_key = str(map_id)
if map_key not in manager.active_connections:
manager.active_connections[map_key] = set()
manager.active_connections[map_key].add((websocket, user_id))
manager.websocket_to_map[websocket] = map_key
user_info = f"user {user_id}" if user_id else "guest"
logger.info(f"Client ({user_info}) connected to map {map_id}. Total connections: {len(manager.active_connections[map_key])}")
try:
# Send initial connection message