fix(history): remove selections atomically

This commit is contained in:
Sucukdeluxe
2026-08-21 00:59:45 +02:00
parent 3a95136ef1
commit 869dbc25be
11 changed files with 107 additions and 20 deletions
+11
View File
@@ -97,6 +97,14 @@ function isDevMode(): boolean {
return process.env.NODE_ENV === "development";
}
function validateHistoryEntryIds(value: unknown): string[] {
const entryIds = validateStringArray(value, "entryIds");
if (entryIds.length > 100_000 || entryIds.some((entryId) => entryId.length === 0 || entryId.length > 4_096)) {
throw new Error("entryIds ist ungültig");
}
return [...new Set(entryIds)];
}
function getRendererFileUrl(): string {
return pathToFileURL(path.join(app.getAppPath(), "build", "renderer", "index.html")).toString();
}
@@ -588,6 +596,9 @@ function registerIpcHandlers(): void {
validateString(entryId, "entryId");
return controller.removeHistoryEntry(entryId);
});
handleTrusted(IPC_CHANNELS.REMOVE_HISTORY_ENTRIES, (_event: IpcMainInvokeEvent, entryIds: unknown) => {
return controller.removeHistoryEntries(validateHistoryEntryIds(entryIds));
});
handleTrusted(IPC_CHANNELS.REVEAL_HISTORY_ENTRY, (_event: IpcMainInvokeEvent, entryId: unknown) => {
return revealHistoryEntry({ entryId }, {
loadHistory: () => controller.getHistory(),