π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Start scaffolding
Manav Rathi0ace569e9721
diff --git a/web/packages/new/photos/services/exif.ts b/web/packages/new/photos/services/exif.tsnew file mode 100644index 0000000000..2f7ead0e99--- /dev/null+++ b/web/packages/new/photos/services/exif.ts@@ -0,0 +1,30 @@+import type { EnteFile } from "../types/file";++/**+ * Index Exif in the given file.+ *+ * This function is invoked as part of the ML indexing pipeline, which is why it+ * uses the same "index" nomenclature. But what it does is more of an extraction+ * / backfill process. The idea is that since we are anyways retrieving the+ * original file to index it for faces and CLIP, we might as well extract the+ * Exif and store it as part of the derived data (so that future features can+ * more readily use it), and also backfill any fields that old clients might've+ * not extracted during their file uploads.+ *+ * @param enteFile The {@link EnteFile} which we're indexing.+ *+ * @param+ *+ * [Note: Exif not EXIF]+ *+ * The standard uses "Exif" (not "EXIF") to refer to itself. We do the same.+ *+ * [Note: Indexing Exif]+ *+ * We don't really index Exif, we+ */+export const indexExif = (enteFile: EnteFile) => {+ return {+ title: enteFile.title ?? "",+ };+};diff --git a/web/packages/new/photos/services/ml/worker.ts b/web/packages/new/photos/services/ml/worker.tsindex 4254b3a8c6..64cae831b4 100644--- a/web/packages/new/photos/services/ml/worker.ts+++ b/web/packages/new/photos/services/ml/worker.ts@@ -9,6 +9,7 @@ import { ensure } from "@/utils/ensure";import { wait } from "@/utils/promise";import { expose } from "comlink";import downloadManager from "../download";+import { indexExif } from "../exif";import { getAllLocalFiles, getLocalTrashedFiles } from "../files";import type { UploadItem } from "../upload/types";import {@@ -388,7 +389,11 @@ const index = async (// See if we already have all the derived data fields that we need. If so,// just update our local db and return.- if (existingFaceIndex && existingCLIPIndex) {+ if (+ existingFaceIndex &&+ existingCLIPIndex &&+ !process.env.NEXT_PUBLIC_ENTE_ENABLE_WIP_ML_DONT_USE /* TODO-ML: WIP */+ ) {try {await saveIndexes({ fileID, ...existingFaceIndex },@@ -422,13 +427,15 @@ const index = async (try {let faceIndex: FaceIndex;let clipIndex: CLIPIndex;+ let exif: unknown;const startTime = Date.now();try {- [faceIndex, clipIndex] = await Promise.all([+ [faceIndex, clipIndex, exif] = await Promise.all([existingFaceIndex ?? indexFaces(enteFile, image, electron),existingCLIPIndex ?? indexCLIP(image, electron),+ indexExif(enteFile),]);} catch (e) {// See: [Note: Transient and permanent indexing failures]@@ -442,7 +449,9 @@ const index = async (const msg = [];if (!existingFaceIndex) msg.push(`${faceIndex.faces.length} faces`);if (!existingCLIPIndex) msg.push("clip");- return `Indexed ${msg.join(" and ")} in ${f} (${ms} ms)`;+ if (exif)+ return JSON.stringify(exif); // TODO: EXIF+ else return `Indexed ${msg.join(" and ")} in ${f} (${ms} ms)`;});const remoteFaceIndex = existingRemoteFaceIndex ?? {