Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Outline the plan

Manav Rathi0161739bc054
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index 4837210c87..10a68003f8 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -212,6 +212,25 @@ const setupTrayItem = (mainWindow: BrowserWindow) => {
tray.setContextMenu(createTrayContextMenu(mainWindow));
};
+/**
+ * Register a protocol handler that we use for streaming large files between the
+ * main process (node) and the renderer process (browser) layer.
+ *
+ * [Note: IPC streams]
+ *
+ * When running without node integration, there is no direct way to pass streams
+ * across IPC. And passing the entire contents of the file is not feasible for
+ * large video files because of the memory pressure the copying would entail.
+ *
+ * As an alternative, we register a custom protocol handler that can provided a
+ * bi-directional stream. The renderer can stream data to the node side by
+ * streaming the request. The node side can stream to the renderer side by
+ * streaming the response.
+ *
+ * See also: [Note: Transferring large amount of data over IPC]
+ */
+const registerStreamProtocol = () => {};
+
/**
* Older versions of our app used to maintain a cache dir using the main
* process. This has been deprecated in favor of using a normal web cache.
@@ -278,6 +297,7 @@ const main = () => {
handleDownloads(mainWindow);
handleExternalLinks(mainWindow);
addAllowOriginHeader(mainWindow);
+ registerStreamProtocol();
try {
deleteLegacyDiskCacheDirIfExists();
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index c709468cbf..5603d49a4f 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -300,7 +300,8 @@ const getDirFiles = (dirPath: string): Promise<ElectronFile[]> =>
// https://www.electronjs.org/docs/latest/api/context-bridge#methods
//
// The copy itself is relatively fast, but the problem with transfering large
-// amounts of data is potentially running out of memory during the copy.
+// amounts of data is potentially running out of memory during the copy. For an
+// alternative, see [Note: IPC streams].
contextBridge.exposeInMainWorld("electron", {
// - General
appVersion,