π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Envision
Manav Rathi63841abd3017
diff --git a/desktop/src/main/stores/upload-status.ts b/desktop/src/main/stores/upload-status.tsindex 5b7f7c1127..4a402333a7 100644--- a/desktop/src/main/stores/upload-status.ts+++ b/desktop/src/main/stores/upload-status.ts@@ -1,10 +1,16 @@import Store, { Schema } from "electron-store";export interface UploadStatusStore {+ /* The collection to which we're uploading, or the root collection. */collectionName: string;+ /** Paths to regular files that are pending upload */filePaths: string[];+ /**+ * Each item is the path to a zip file and the name of an entry within it.+ */+ zipEntries: [zipPath: string, entryName: string][];+ /** Legacy paths to zip files, now subsumed into zipEntries */zipPaths: string[];- zipEntries: Record<string, string[]>;}const uploadStatusSchema: Schema<UploadStatusStore> = {@@ -17,15 +23,21 @@ const uploadStatusSchema: Schema<UploadStatusStore> = {type: "string",},},+ zipEntries: {+ type: "array",+ items: {+ type: "array",+ items: {+ type: "string",+ },+ },+ },zipPaths: {type: "array",items: {type: "string",},},- zipEntries: {- type: "object",- },};export const uploadStatusStore = new Store({diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.tsindex 1056610366..e340e7a061 100644--- a/web/packages/next/types/ipc.ts+++ b/web/packages/next/types/ipc.ts@@ -465,57 +465,53 @@ export interface Electron {// - Upload+ /**+ * 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. File entries whose file name begins with+ * a dot (i.e. "hidden" files) will also be excluded.+ *+ * To read the contents of the files themselves, see [Note: IPC streams].+ */+ lsZip: (zipPath: string) => Promise<string[]>;+/*** Return any pending uploads that were previously enqueued but haven't yet* been completed.*- * The state of pending uploads is persisted in the Node.js layer.- *- * Note that we might have both outstanding zip and regular file uploads at- * the same time. In such cases, the zip file ones get precedence.+ * The state of pending uploads is persisted in the Node.js layer. Or app+ * start, we read in this data from the Node.js layer via this IPC method.+ * The Node.js code returns the persisted data after filtering out any files+ * that no longer exist on disk.*/pendingUploads: () => Promise<PendingUploads | undefined>;/**- * Set or clear the name of the collection where the pending upload is- * directed to.+ * Set the state of pending uploads.+ *+ * Typically, this would be called at the start of an upload. Thereafter, as+ * each item gets uploaded one by one, we'd call {@link markUploaded}.+ * Finally, once the upload completes (or gets cancelled), we'd call+ * {@link clearPendingUploads} to complete the circle.*/- setPendingUploadCollection: (collectionName: string) => Promise<void>;+ setPendingUploads: (pendingUploads: PendingUploads) => Promise<void>;/*** Update the list of files (of {@link type}) associated with the pending* upload.*/- setPendingUploadFiles: (- type: PendingUploads["type"],- filePaths: string[],+ markUploaded: (+ pathOrZipEntry: string | [zipPath: string, entryName: 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].+ * Clear any pending uploads.*/- 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- * runtime. For such functions, find an efficient alternative or refactor- * the dataflow.- */-- // --- getElectronFilesFromGoogleZip: (- filePath: string,- ) => Promise<ElectronFile[]>;+ clearPendingUploads: () => Promise<void>;}/**@@ -622,12 +618,12 @@ export interface PendingUploads {*/filePaths: string[];/**- * Paths of zip files that need to be uploaded.- */- zipPaths: string[];- /**- * For each zip file, which of its entries (paths) within the zip file that- * need to be uploaded.+ * When the user uploads a zip file, we create a "zip entry" for each entry+ * within that zip file. Such an entry is a tuple containin the path to a+ * zip file itself, and the name of an entry within it.+ *+ * These are the remaining of those zip entries that still need to be+ * uploaded.*/- zipEntries: Record<string, string[]>;+ zipEntries: [zipPath: string, entryName: string][];}