update to fix vercel and cloudflare errors
This commit is contained in:
parent
3c72aecb80
commit
3df4b5530b
|
|
@ -130,6 +130,8 @@ The Fathom transcript shape includes:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ You can also manually edit the environment by:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ export class CloudflareNetworkAdapter extends NetworkAdapter {
|
||||||
private workerUrl: string
|
private workerUrl: string
|
||||||
private websocket: WebSocket | null = null
|
private websocket: WebSocket | null = null
|
||||||
private roomId: string | null = null
|
private roomId: string | null = null
|
||||||
private peerId: PeerId | null = null
|
public peerId: PeerId | undefined = undefined
|
||||||
private readyPromise: Promise<void>
|
private readyPromise: Promise<void>
|
||||||
private readyResolve: (() => void) | null = null
|
private readyResolve: (() => void) | null = null
|
||||||
private keepAliveInterval: NodeJS.Timeout | null = null
|
private keepAliveInterval: NodeJS.Timeout | null = null
|
||||||
|
|
@ -225,22 +225,24 @@ export class CloudflareNetworkAdapter extends NetworkAdapter {
|
||||||
console.log('🔌 CloudflareAdapter: Received binary message (Automerge protocol)')
|
console.log('🔌 CloudflareAdapter: Received binary message (Automerge protocol)')
|
||||||
// Handle binary Automerge sync messages - convert ArrayBuffer to Uint8Array
|
// Handle binary Automerge sync messages - convert ArrayBuffer to Uint8Array
|
||||||
// Automerge Repo expects binary sync messages as Uint8Array
|
// Automerge Repo expects binary sync messages as Uint8Array
|
||||||
this.emit('message', {
|
const message: Message = {
|
||||||
type: 'sync',
|
type: 'sync',
|
||||||
data: new Uint8Array(event.data),
|
data: new Uint8Array(event.data),
|
||||||
senderId: this.peerId || 'unknown' as PeerId,
|
senderId: this.peerId || ('unknown' as PeerId),
|
||||||
targetId: this.peerId || 'unknown' as PeerId
|
targetId: this.peerId || ('unknown' as PeerId)
|
||||||
} as Message)
|
}
|
||||||
|
this.emit('message', message)
|
||||||
} else if (event.data instanceof Blob) {
|
} else if (event.data instanceof Blob) {
|
||||||
// Handle Blob messages (convert to Uint8Array)
|
// Handle Blob messages (convert to Uint8Array)
|
||||||
event.data.arrayBuffer().then((buffer) => {
|
event.data.arrayBuffer().then((buffer) => {
|
||||||
console.log('🔌 CloudflareAdapter: Received Blob message, converted to Uint8Array')
|
console.log('🔌 CloudflareAdapter: Received Blob message, converted to Uint8Array')
|
||||||
this.emit('message', {
|
const message: Message = {
|
||||||
type: 'sync',
|
type: 'sync',
|
||||||
data: new Uint8Array(buffer),
|
data: new Uint8Array(buffer),
|
||||||
senderId: this.peerId || 'unknown' as PeerId,
|
senderId: this.peerId || ('unknown' as PeerId),
|
||||||
targetId: this.peerId || 'unknown' as PeerId
|
targetId: this.peerId || ('unknown' as PeerId)
|
||||||
} as Message)
|
}
|
||||||
|
this.emit('message', message)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Handle text messages (our custom protocol for backward compatibility)
|
// Handle text messages (our custom protocol for backward compatibility)
|
||||||
|
|
@ -266,15 +268,15 @@ export class CloudflareNetworkAdapter extends NetworkAdapter {
|
||||||
storeKeys: message.data.store ? Object.keys(message.data.store).length : 0
|
storeKeys: message.data.store ? Object.keys(message.data.store).length : 0
|
||||||
})
|
})
|
||||||
// For backward compatibility, handle JSON sync data
|
// For backward compatibility, handle JSON sync data
|
||||||
this.emit('message', {
|
const syncMessage: Message = {
|
||||||
type: 'sync',
|
type: 'sync',
|
||||||
senderId: message.senderId,
|
senderId: message.senderId || this.peerId || ('unknown' as PeerId),
|
||||||
targetId: message.targetId,
|
targetId: message.targetId || this.peerId || ('unknown' as PeerId),
|
||||||
documentId: message.documentId,
|
|
||||||
data: message.data
|
data: message.data
|
||||||
})
|
}
|
||||||
} else {
|
this.emit('message', syncMessage)
|
||||||
this.emit('message', message)
|
} else if (message.senderId && message.targetId) {
|
||||||
|
this.emit('message', message as Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -140,18 +140,8 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus
|
||||||
// Get the store with status
|
// Get the store with status
|
||||||
const storeWithStatus = useMemo((): TLStoreWithStatus => {
|
const storeWithStatus = useMemo((): TLStoreWithStatus => {
|
||||||
if (!store) {
|
if (!store) {
|
||||||
if (isLoading) {
|
return {
|
||||||
return {
|
status: 'loading' as const
|
||||||
status: 'loading' as const,
|
|
||||||
connectionStatus: 'offline' as const,
|
|
||||||
store: undefined
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
status: 'not-synced' as const,
|
|
||||||
connectionStatus: 'offline' as const,
|
|
||||||
store: undefined
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,10 +153,25 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus
|
||||||
}, [store, isLoading])
|
}, [store, isLoading])
|
||||||
|
|
||||||
// Get presence data (only when handle is ready)
|
// Get presence data (only when handle is ready)
|
||||||
|
const userMetadata: { userId: string; name: string; color: string } = (() => {
|
||||||
|
if (user && 'userId' in user) {
|
||||||
|
return {
|
||||||
|
userId: (user as { userId: string; name: string; color?: string }).userId,
|
||||||
|
name: (user as { userId: string; name: string; color?: string }).name,
|
||||||
|
color: (user as { userId: string; name: string; color?: string }).color || '#000000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
userId: user?.id || 'anonymous',
|
||||||
|
name: user?.name || 'Anonymous',
|
||||||
|
color: '#000000'
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
const presence = useAutomergePresence({
|
const presence = useAutomergePresence({
|
||||||
handle: handle || null,
|
handle: handle || null,
|
||||||
store: store || null,
|
store: store || null,
|
||||||
userMetadata: user && 'userId' in user ? user : { userId: user?.id || 'anonymous', name: user?.name || 'Anonymous', color: '#000000' }
|
userMetadata
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,8 @@ export const LocationDashboard: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,8 @@ export const LocationMap: React.FC<LocationMapProps> = ({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,8 @@ export const LocationViewer: React.FC<LocationViewerProps> = ({ shareToken }) =>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ export const ShareSettingsComponent: React.FC<ShareSettingsProps> = ({ onSetting
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ export const useWebSpeechTranscription = ({
|
||||||
const speakerChangeThreshold = 0.3 // Threshold for detecting speaker changes
|
const speakerChangeThreshold = 0.3 // Threshold for detecting speaker changes
|
||||||
|
|
||||||
// Function to add line breaks after pauses and improve punctuation
|
// Function to add line breaks after pauses and improve punctuation
|
||||||
const processTranscript = useCallback((text: string, isFinal: boolean = false, _confidence?: number) => {
|
const processTranscript = useCallback((text: string, isFinal: boolean = false) => {
|
||||||
if (!text.trim()) return text
|
if (!text.trim()) return text
|
||||||
|
|
||||||
let processedText = text.trim()
|
let processedText = text.trim()
|
||||||
|
|
@ -216,7 +216,7 @@ export const useWebSpeechTranscription = ({
|
||||||
speakerPrefix = '\n[Speaker Change]\n'
|
speakerPrefix = '\n[Speaker Change]\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
const processedFinal = processTranscript(finalTranscript, true, confidence)
|
const processedFinal = processTranscript(finalTranscript, true)
|
||||||
const newText = speakerPrefix + processedFinal
|
const newText = speakerPrefix + processedFinal
|
||||||
finalTranscriptRef.current += newText
|
finalTranscriptRef.current += newText
|
||||||
setTranscript(finalTranscriptRef.current)
|
setTranscript(finalTranscriptRef.current)
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,9 @@ export class HoloSphereService {
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(`❌ Error in subscribe promise for ${lens}:`, err)
|
console.error(`❌ Error in subscribe promise for ${lens}:`, err)
|
||||||
})
|
})
|
||||||
} else {
|
} else if (subscribeResult && typeof subscribeResult === 'object' && subscribeResult !== null) {
|
||||||
unsubscribe = (subscribeResult as any)?.unsubscribe || undefined
|
const result = subscribeResult as { unsubscribe?: () => void }
|
||||||
|
unsubscribe = result?.unsubscribe || undefined
|
||||||
console.log(`✅ Subscribe called successfully for ${lens}`)
|
console.log(`✅ Subscribe called successfully for ${lens}`)
|
||||||
}
|
}
|
||||||
} catch (subError) {
|
} catch (subError) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ export interface GeolocationPosition {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ export const LocationDashboardRoute: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ export const LocationShareCreate: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ export const LocationShareView: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export function resolveOverlaps(editor: Editor, shapeId: string): void {
|
||||||
]
|
]
|
||||||
|
|
||||||
const shape = editor.getShape(shapeId as TLShapeId)
|
const shape = editor.getShape(shapeId as TLShapeId)
|
||||||
if (!shape || !customShapeTypes.includes(shape.type)) return
|
if (!shape || !customShapeTypes.includes(shape.type as string)) return
|
||||||
|
|
||||||
const shapeBounds = getShapeBounds(editor, shape)
|
const shapeBounds = getShapeBounds(editor, shape)
|
||||||
if (!shapeBounds) return
|
if (!shapeBounds) return
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ echo " npm run dev"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue