π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Rearrange
Manav Rathi891ba97e0afe
diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.tsindex 0654141584..ff75fa462d 100644--- a/web/apps/photos/src/services/upload/uploadManager.ts+++ b/web/apps/photos/src/services/upload/uploadManager.ts@@ -543,11 +543,11 @@ class UploadManager {await wait(0);const { fileUploadResult, uploadedFile } = await uploader(- worker,- this.existingFiles,fileWithCollection,- this.parsedMetadataJSONMap,this.uploaderName,+ this.existingFiles,+ this.parsedMetadataJSONMap,+ worker,this.isCFUploadProxyDisabled,() => {this.abortIfCancelled();diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.tsindex fc9e02a0b7..d2f7fbe7b4 100644--- a/web/apps/photos/src/services/upload/uploadService.ts+++ b/web/apps/photos/src/services/upload/uploadService.ts@@ -170,11 +170,11 @@ interface UploadResponse {}export const uploader = async (- worker: Remote<DedicatedCryptoWorker>,- existingFiles: EnteFile[],fileWithCollection: FileWithCollection2,- parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,uploaderName: string,+ existingFiles: EnteFile[],+ parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,+ worker: Remote<DedicatedCryptoWorker>,isCFUploadProxyDisabled: boolean,abortIfCancelled: () => void,makeProgessTracker: MakeProgressTracker,@@ -185,18 +185,19 @@ export const uploader = async (try {/*- * We read the file three times:+ * We read the file four times:* 1. To determine its MIME type (only needs first few KBs).- * 2. To calculate its hash.- * 3. To encrypt it.+ * 2. To extract its metadata.+ * 3. To calculate its hash.+ * 4. To encrypt it.*- * When we already have a File object the multiple reads are fine. When- * we're in the context of our desktop app and have a path, it might be- * possible to optimize this further by using `ReadableStream.tee` to- * perform these three steps simultaneously. However, that'll require- * restructuring the code so that these steps run in some parallel- * manner (tee will not work for strictly sequential reads of large- * streams).+ * When we already have a File object the multiple reads are fine.+ *+ * When we're in the context of our desktop app and have a path, it+ * might be possible to optimize further by using `ReadableStream.tee`+ * to perform these steps simultaneously. However, that'll require+ * restructuring the code so that these steps run in a parallel manner+ * (tee will not work for strictly sequential reads of large streams).*/const { fileTypeInfo, fileSize } =@@ -209,11 +210,11 @@ export const uploader = async (abortIfCancelled();const { metadata, publicMagicMetadata } = await extractAssetMetadata(- worker,- parsedMetadataJSONMap,uploadAsset,- collection.id,fileTypeInfo,+ collection.id,+ parsedMetadataJSONMap,+ worker,);const matches = existingFiles.filter((file) =>@@ -499,12 +500,16 @@ interface ExtractMetadataResult {publicMagicMetadata: FilePublicMagicMetadataProps;}+/**+ * Compute the hash, extract EXIF or other metadata, and merge in data from the+ * {@link parsedMetadataJSONMap} for the assets. Return the resultant metadatum.+ */const extractAssetMetadata = async (- worker: Remote<DedicatedCryptoWorker>,- parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,{ isLivePhoto, file, livePhotoAssets }: UploadAsset2,- collectionID: number,fileTypeInfo: FileTypeInfo,+ collectionID: number,+ parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,+ worker: Remote<DedicatedCryptoWorker>,): Promise<ExtractMetadataResult> => {return isLivePhoto? await extractLivePhotoMetadata(diff --git a/web/apps/photos/src/types/upload/index.ts b/web/apps/photos/src/types/upload/index.tsindex 2111617bde..9b2e37a9b4 100644--- a/web/apps/photos/src/types/upload/index.ts+++ b/web/apps/photos/src/types/upload/index.ts@@ -25,6 +25,7 @@ export interface Metadata {modificationTime: number;latitude: number;longitude: number;+ /** The "Ente" file type. */fileType: FILE_TYPE;hasStaticThumbnail?: boolean;hash?: string;