π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Send to the right person
Manav Rathi7d42f23abfea
diff --git a/desktop/src/main.ts b/desktop/src/main.tsindex de969e3cf7..4ebe565bca 100644--- a/desktop/src/main.ts+++ b/desktop/src/main.ts@@ -21,6 +21,7 @@ import {attachFSWatchIPCHandlers,attachIPCHandlers,attachLogoutIPCHandler,+ attachMainWindowIPCHandlers,} from "./main/ipc";import log, { initLogging } from "./main/log";import { createApplicationMenu, createTrayContextMenu } from "./main/menu";@@ -121,6 +122,7 @@ const main = () => {// Setup IPC and streams.const watcher = createWatcher(mainWindow);attachIPCHandlers();+ attachMainWindowIPCHandlers(mainWindow);attachFSWatchIPCHandlers(watcher);attachLogoutIPCHandler(watcher);registerStreamProtocol();diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.tsindex f891fb390b..9bb5d4c001 100644--- a/desktop/src/main/ipc.ts+++ b/desktop/src/main/ipc.ts@@ -9,6 +9,7 @@*/import type { FSWatcher } from "chokidar";+import type { BrowserWindow } from "electron";import { ipcMain } from "electron/main";import type {CollectionMapping,@@ -188,8 +189,6 @@ export const attachIPCHandlers = () => {// - ML- ipcMain.on("createMLSession", () => createMLSession());-ipcMain.handle("computeCLIPImageEmbedding", (_, input: Float32Array) =>computeCLIPImageEmbedding(input),);@@ -235,6 +234,16 @@ export const attachIPCHandlers = () => {ipcMain.handle("clearPendingUploads", () => clearPendingUploads());};+/**+ * A subset of {@link attachIPCHandlers} for functions that need a reference to+ * the main window to do their thing.+ */+export const attachMainWindowIPCHandlers = (mainWindow: BrowserWindow) => {+ // - ML++ ipcMain.on("createMLSession", () => createMLSession(mainWindow));+};+/*** Sibling of {@link attachIPCHandlers} that attaches handlers specific to the* watch folder functionality.diff --git a/desktop/src/main/services/ml.ts b/desktop/src/main/services/ml.tsindex a8ab08ed16..316d70c346 100644--- a/desktop/src/main/services/ml.ts+++ b/desktop/src/main/services/ml.ts@@ -2,7 +2,7 @@* @file ML related functionality. This code runs in the main process.*/-import { ipcRenderer, MessageChannelMain } from "electron";+import { MessageChannelMain, type BrowserWindow } from "electron";import { utilityProcess } from "electron/main";import path from "node:path";@@ -60,11 +60,13 @@ import path from "node:path";* Node.js utility process <-> Renderer web worker**/-export const createMLSession = () => {+export const createMLSession = (window: BrowserWindow) => {const { port1, port2 } = new MessageChannelMain();const child = utilityProcess.fork(path.join(__dirname, "ml-util-test.js"));child.postMessage(/* unused */ "", [port1]);- ipcRenderer.postMessage("createMLSession/port", /* unused */ "", [port2]);+ window.webContents.postMessage("createMLSession/port", /* unused */ "", [+ port2,+ ]);};