π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Reorder
Manav Rathi00c0780de17a
diff --git a/web/apps/photos/src/services/upload/metadataService.ts b/web/apps/photos/src/services/upload/metadataService.tsindex ad391eb456..e4f4c348b6 100644--- a/web/apps/photos/src/services/upload/metadataService.ts+++ b/web/apps/photos/src/services/upload/metadataService.ts@@ -61,7 +61,63 @@ export interface ExtractMetadataResult {publicMagicMetadata: FilePublicMagicMetadataProps;}-export async function extractMetadata(+export const extractAssetMetadata = async (+ worker: Remote<DedicatedCryptoWorker>,+ parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,+ { isLivePhoto, file, livePhotoAssets }: UploadAsset2,+ collectionID: number,+ fileTypeInfo: FileTypeInfo,+): Promise<ExtractMetadataResult> => {+ return isLivePhoto+ ? await extractLivePhotoMetadata(+ worker,+ parsedMetadataJSONMap,+ collectionID,+ fileTypeInfo,+ livePhotoAssets,+ )+ : await extractFileMetadata(+ worker,+ parsedMetadataJSONMap,+ collectionID,+ fileTypeInfo,+ file,+ );+};++async function extractFileMetadata(+ worker: Remote<DedicatedCryptoWorker>,+ parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,+ collectionID: number,+ fileTypeInfo: FileTypeInfo,+ rawFile: File | ElectronFile | string,+): Promise<ExtractMetadataResult> {+ const rawFileName = getFileName(rawFile);+ let key = getMetadataJSONMapKeyForFile(collectionID, rawFileName);+ let googleMetadata: ParsedMetadataJSON = parsedMetadataJSONMap.get(key);++ if (!googleMetadata && key.length > MAX_FILE_NAME_LENGTH_GOOGLE_EXPORT) {+ key = getClippedMetadataJSONMapKeyForFile(collectionID, rawFileName);+ googleMetadata = parsedMetadataJSONMap.get(key);+ }++ const { metadata, publicMagicMetadata } = await extractMetadata(+ worker,+ /* TODO(MR): ElectronFile changes */+ rawFile as File | ElectronFile,+ fileTypeInfo,+ );++ for (const [key, value] of Object.entries(googleMetadata ?? {})) {+ if (!value) {+ continue;+ }+ metadata[key] = value;+ }+ return { metadata, publicMagicMetadata };+}++async function extractMetadata(worker: Remote<DedicatedCryptoWorker>,receivedFile: File | ElectronFile,fileTypeInfo: FileTypeInfo,@@ -182,62 +238,6 @@ async function getVideoMetadata(file: File | ElectronFile) {return videoMetadata;}-export const extractAssetMetadata = async (- worker: Remote<DedicatedCryptoWorker>,- parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,- { isLivePhoto, file, livePhotoAssets }: UploadAsset2,- collectionID: number,- fileTypeInfo: FileTypeInfo,-): Promise<ExtractMetadataResult> => {- return isLivePhoto- ? await extractLivePhotoMetadata(- worker,- parsedMetadataJSONMap,- collectionID,- fileTypeInfo,- livePhotoAssets,- )- : await extractFileMetadata(- worker,- parsedMetadataJSONMap,- collectionID,- fileTypeInfo,- file,- );-};--async function extractFileMetadata(- worker: Remote<DedicatedCryptoWorker>,- parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,- collectionID: number,- fileTypeInfo: FileTypeInfo,- rawFile: File | ElectronFile | string,-): Promise<ExtractMetadataResult> {- const rawFileName = getFileName(rawFile);- let key = getMetadataJSONMapKeyForFile(collectionID, rawFileName);- let googleMetadata: ParsedMetadataJSON = parsedMetadataJSONMap.get(key);-- if (!googleMetadata && key.length > MAX_FILE_NAME_LENGTH_GOOGLE_EXPORT) {- key = getClippedMetadataJSONMapKeyForFile(collectionID, rawFileName);- googleMetadata = parsedMetadataJSONMap.get(key);- }-- const { metadata, publicMagicMetadata } = await extractMetadata(- worker,- /* TODO(MR): ElectronFile changes */- rawFile as File | ElectronFile,- fileTypeInfo,- );-- for (const [key, value] of Object.entries(googleMetadata ?? {})) {- if (!value) {- continue;- }- metadata[key] = value;- }- return { metadata, publicMagicMetadata };-}-async function extractLivePhotoMetadata(worker: Remote<DedicatedCryptoWorker>,parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,