fix: multiple bug fixes

isolated users, db backup, weird disconnect issues for long voice sessions,
This commit is contained in:
2026-04-24 22:19:57 +02:00
parent 44588e8789
commit bc2fa7de22
56 changed files with 1861 additions and 133 deletions

View File

@@ -538,12 +538,14 @@ function handleSyncSummary(
event: IncomingMessageEvent,
{ db, webrtc, currentRoom }: IncomingMessageContext
): Observable<Action> {
if (!currentRoom)
const targetRoomId = event.roomId || currentRoom?.id;
if (!targetRoomId)
return EMPTY;
return from(
(async () => {
const local = await db.getMessages(currentRoom.id, FULL_SYNC_LIMIT, 0);
const local = await db.getMessages(targetRoomId, FULL_SYNC_LIMIT, 0);
const localCount = local.length;
const localLastUpdated = local.reduce(
(maxTimestamp, message) => Math.max(maxTimestamp, message.editedAt || message.timestamp || 0),
@@ -561,7 +563,7 @@ function handleSyncSummary(
if (!identical && needsSync && fromPeerId) {
const syncRequestEvent: ChatEvent = {
type: 'chat-sync-request',
roomId: currentRoom.id
roomId: targetRoomId
};
webrtc.sendToPeer(fromPeerId, syncRequestEvent);
@@ -575,17 +577,18 @@ function handleSyncRequest(
event: IncomingMessageEvent,
{ db, webrtc, currentRoom }: IncomingMessageContext
): Observable<Action> {
const targetRoomId = event.roomId || currentRoom?.id;
const fromPeerId = event.fromPeerId;
if (!currentRoom || !fromPeerId)
if (!targetRoomId || !fromPeerId)
return EMPTY;
return from(
(async () => {
const all = await db.getMessages(currentRoom.id, FULL_SYNC_LIMIT, 0);
const all = await db.getMessages(targetRoomId, FULL_SYNC_LIMIT, 0);
const syncFullEvent: ChatEvent = {
type: 'chat-sync-full',
roomId: currentRoom.id,
roomId: targetRoomId,
messages: all
};