feat: Security

This commit is contained in:
2026-06-05 18:34:01 +02:00
parent ee293d7daf
commit 45675192a5
134 changed files with 4128 additions and 446 deletions
@@ -6,7 +6,8 @@ import {
User,
Room,
Reaction,
BanEntry
BanEntry,
type MessageRevision
} from '../../shared-kernel';
import type { ChatAttachmentMeta, CustomEmoji } from '../../shared-kernel';
import { getStoredCurrentUserId } from '../../core/storage/current-user-storage';
@@ -25,6 +26,7 @@ const STORE_BANS = 'bans';
const STORE_META = 'meta';
const STORE_ATTACHMENTS = 'attachments';
const STORE_CUSTOM_EMOJIS = 'customEmojis';
const STORE_MESSAGE_REVISIONS = 'messageRevisions';
/** All object store names, used when clearing the entire database. */
const ALL_STORE_NAMES: string[] = [
STORE_MESSAGES,
@@ -34,6 +36,7 @@ const ALL_STORE_NAMES: string[] = [
STORE_BANS,
STORE_ATTACHMENTS,
STORE_CUSTOM_EMOJIS,
STORE_MESSAGE_REVISIONS,
STORE_META
];
@@ -67,6 +70,13 @@ export class BrowserDatabaseService {
await this.put(STORE_MESSAGES, message);
}
async saveMessageRevision(revision: MessageRevision): Promise<void> {
await this.put(STORE_MESSAGE_REVISIONS, {
...revision,
id: `${revision.messageId}:${revision.revision}`
});
}
/**
* Retrieve the latest messages for a room, sorted oldest-first for display.
* @param roomId - Target room.