diff --git a/src/services/tldraw/syncService.ts b/src/services/tldraw/syncService.ts index 655cd2b..21c31e2 100644 --- a/src/services/tldraw/syncService.ts +++ b/src/services/tldraw/syncService.ts @@ -66,14 +66,17 @@ export function createSyncConnectionOptions(options: SyncConnectionOptions) { } }; - logger.info('sync-service', '🔄 Creating sync connection', { - userId, - displayName, - roomId: effectiveRoomId + logger.info('sync-service', '🔄 Creating sync connection', { + userId, + displayName, + roomId: effectiveRoomId }); + const token = import.meta.env.VITE_TLSYNC_SECRET ?? '' + const tokenParam = token ? `?token=${encodeURIComponent(token)}` : '' + return { - uri: `${baseUrl}/connect/${effectiveRoomId}`, + uri: `${baseUrl}/connect/${effectiveRoomId}${tokenParam}`, assets: multiplayerAssets, roomId: effectiveRoomId }; @@ -114,4 +117,3 @@ export function generateSharedRoomId(path: string): string { const sanitizedPath = path.replace(/[^a-zA-Z0-9]/g, '-'); return `shared-${sanitizedPath}`; } -