From b913682866bd1083831e05ac217fdae524569f38 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 27 May 2025 02:01:30 +0800 Subject: [PATCH] :bug: Fix update participant can't get account id --- DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs b/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs index 63a3219..ca6b082 100644 --- a/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs +++ b/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs @@ -125,7 +125,7 @@ public class LivekitRealtimeService : IRealtimeService RoomAdmin = isAdmin, Room = sessionId }) - .WithAttributes(new Dictionary { { "account_id", account.Id.ToString() } }) + .WithMetadata(JsonSerializer.Serialize(new Dictionary { { "account_id", account.Id.ToString() } })) .WithTtl(TimeSpan.FromHours(1)); return token.ToJwt(); } @@ -199,7 +199,7 @@ public class LivekitRealtimeService : IRealtimeService // Get the current participants list var participants = await _cache.GetAsync>(participantsKey) ?? - new List(); + []; // Check if the participant already exists var existingIndex = participants.FindIndex(p => p.Identity == participant.Identity); @@ -253,7 +253,7 @@ public class LivekitRealtimeService : IRealtimeService public async Task> GetRoomParticipantsAsync(string roomName) { var participantsKey = _GetParticipantsKey(roomName); - return await _cache.GetAsync>(participantsKey) ?? new List(); + return await _cache.GetAsync>(participantsKey) ?? []; } // Class to represent a participant in the cache