Skip to content

armgit / ente

Public Imported from GitHub
0

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

Scaffold

Manav Rathie65307517db1
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 825a2ed32b..093724251a 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -53,6 +53,7 @@ import {
} from "./services/store";
import {
getElectronFilesFromGoogleZip,
+ lsZip,
pendingUploads,
setPendingUploadCollection,
setPendingUploadFiles,
@@ -210,6 +211,8 @@ export const attachIPCHandlers = () => {
setPendingUploadFiles(type, filePaths),
);
+ ipcMain.handle("lsZip", (_, zipPath: string) => lsZip(zipPath));
+
// -
ipcMain.handle("getElectronFilesFromGoogleZip", (_, filePath: string) =>
diff --git a/desktop/src/main/services/upload.ts b/desktop/src/main/services/upload.ts
index 88c2d88d19..245edafe6c 100644
--- a/desktop/src/main/services/upload.ts
+++ b/desktop/src/main/services/upload.ts
@@ -69,6 +69,10 @@ const storeKey = (type: PendingUploads["type"]): keyof UploadStatusStore => {
}
};
+export const lsZip = async (zipPath: string) => {
+ return [zipPath];
+};
+
export const getElectronFilesFromGoogleZip = async (filePath: string) => {
const zip = new StreamZip.async({
file: filePath,
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 18fb550130..244cc9ffce 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -253,6 +253,9 @@ const setPendingUploadFiles = (
): Promise<void> =>
ipcRenderer.invoke("setPendingUploadFiles", type, filePaths);
+const lsZip = (zipPath: string): Promise<string[]> =>
+ ipcRenderer.invoke("lsZip", zipPath);
+
// - TODO: AUDIT below this
// -
@@ -373,6 +376,7 @@ contextBridge.exposeInMainWorld("electron", {
pendingUploads,
setPendingUploadCollection,
setPendingUploadFiles,
+ lsZip,
// -
diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.ts
index 85d54b7907..ed7b16a793 100644
--- a/web/apps/photos/src/utils/native-stream.ts
+++ b/web/apps/photos/src/utils/native-stream.ts
@@ -2,6 +2,8 @@
* @file Streaming IPC communication with the Node.js layer of our desktop app.
*
* NOTE: These functions only work when we're running in our desktop app.
+ *
+ * See: [Note: IPC streams].
*/
import type { Electron } from "@/next/types/ipc";
diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts
index 1622a820d9..f00409b008 100644
--- a/web/packages/next/types/ipc.ts
+++ b/web/packages/next/types/ipc.ts
@@ -491,6 +491,19 @@ export interface Electron {
filePaths: string[],
) => Promise<void>;
+ /**
+ * Get the list of files that are present in the given zip file.
+ *
+ * @param zipPath The path of the zip file on the user's local file system.
+ *
+ * @returns A list of paths, one for each file in the given zip. Directories
+ * are traversed recursively, but the directory entries themselves will be
+ * excluded from the returned list.
+ *
+ * To read the contents of the files themselves, see [Note: IPC streams].
+ */
+ lsZip: (zipPath: string) => Promise<string[]>;
+
/*
* TODO: AUDIT below this - Some of the types we use below are not copyable
* across process boundaries, and such functions will (expectedly) fail at