feat: inject sessionKey for remote federation sessions
- Remote sessions now include sessionKey field formatted as 'remoteId:name'
- Local sessions are unchanged (no sessionKey) as they never collide
- Prevents name collisions between local and remote sessions with identical names
- Added tests: test_federation_sessions_local_sessions_have_no_session_key
test_federation_sessions_remote_sessions_have_session_key
This commit is contained in:
+7
-2
@@ -913,9 +913,14 @@ async def federation_sessions(request: Request) -> list[dict]:
|
||||
]
|
||||
resp.raise_for_status()
|
||||
sessions = resp.json()
|
||||
# Tag each session with deviceName and remoteId
|
||||
# Tag each session with deviceName, remoteId, and unique sessionKey
|
||||
return [
|
||||
{**s, "deviceName": remote_name, "remoteId": remote_id}
|
||||
{
|
||||
**s,
|
||||
"deviceName": remote_name,
|
||||
"remoteId": remote_id,
|
||||
"sessionKey": f"{remote_id}:{s.get('name', '')}",
|
||||
}
|
||||
for s in sessions
|
||||
]
|
||||
except httpx.HTTPStatusError:
|
||||
|
||||
Reference in New Issue
Block a user