Open source video conferencing app powered by LiveKit. Built with Django and React.
♻️(backend) replace LiveKit token metadata with attributes
lebaudantoine126834640580
diff --git a/src/backend/core/utils.py b/src/backend/core/utils.pyindex ce6e17c9..1289cb8d 100644--- a/src/backend/core/utils.py+++ b/src/backend/core/utils.py@@ -110,7 +110,9 @@ def generate_token(.with_grants(video_grants).with_identity(identity).with_name(username or default_username)- .with_metadata(json.dumps({"color": color, "room_admin": is_admin_or_owner}))+ .with_attributes(+ {"color": color, "room_admin": "true" if is_admin_or_owner else "false"}+ ))return token.to_jwt()diff --git a/src/frontend/src/features/rooms/utils/getParticipantColor.ts b/src/frontend/src/features/rooms/utils/getParticipantColor.tsindex b58d43be..72a6e4ef 100644--- a/src/frontend/src/features/rooms/utils/getParticipantColor.ts+++ b/src/frontend/src/features/rooms/utils/getParticipantColor.ts@@ -10,31 +10,16 @@ function isValidHsl(colorString: string) {}export const getParticipantColor = (participant: Participant): string => {- const { metadata } = participant+ const attributes = participant.attributes- if (!metadata) {+ if (!attributes?.color) {return DEFAULT_COLOR}- let parsedMetadata: unknown-- try {- parsedMetadata = JSON.parse(metadata)- } catch (error) {- console.error('Invalid JSON in participant metadata:', error)- return DEFAULT_COLOR- }-- if (!parsedMetadata || typeof parsedMetadata !== 'object') {- return DEFAULT_COLOR- }-- const colorValue = (parsedMetadata as Record<string, unknown>)['color']-- if (typeof colorValue !== 'string' || !isValidHsl(colorValue)) {- console.error('Invalid color value:', colorValue)+ if (!isValidHsl(attributes.color)) {+ console.warn('Invalid color value:', attributes.color)return DEFAULT_COLOR}- return colorValue+ return attributes.color}