π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Outline
Manav Rathi961336115163
diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsxindex 96ecd8dbeb..01be8774b6 100644--- a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx+++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx@@ -3,7 +3,7 @@ import { Titlebar } from "@/base/components/Titlebar";import { nameAndExtension } from "@/base/file";import { FILE_TYPE } from "@/media/file-type";import { UnidentifiedFaces } from "@/new/photos/components/PeopleList";-import type { ParsedExif, RawExifTags } from "@/new/photos/services/exif";+import type { ParsedMetadata, RawExifTags } from "@/new/photos/services/exif";import { isMLEnabled } from "@/new/photos/services/ml";import { EnteFile } from "@/new/photos/types/file";import { formattedByteSize } from "@/new/photos/utils/units";@@ -46,7 +46,7 @@ import { RenderCreationTime } from "./RenderCreationTime";export interface FileInfoExif {tags: RawExifTags | undefined;- parsed: ParsedExif | undefined;+ parsed: ParsedMetadata | undefined;}interface FileInfoProps {diff --git a/web/packages/media/types/file.ts b/web/packages/media/types/file.tsindex fbffb1bd39..e5c674e4ff 100644--- a/web/packages/media/types/file.ts+++ b/web/packages/media/types/file.ts@@ -8,15 +8,15 @@ import type { FILE_TYPE } from "../file-type";* There are three different sources of metadata relating to a file.** 1. Metadata- * 2. Magic Metadata- * 3. Public Magic Metadata+ * 2. Magic metadata+ * 3. Public magic metadata** The names of API entities are such for historical reasons, but we can think* of them as:** 1. Metadata- * 2. Private Mutable Metadata- * 3. Shared Mutable Metadata+ * 2. Private mutable metadata+ * 3. Shared mutable metadata** Metadata is the original metadata that we attached to the file when it was* uploaded. It is immutable, and it never changes.@@ -36,12 +36,13 @@ import type { FILE_TYPE } from "../file-type";* When the client needs to show a file, it needs to "merge" in 2 or 3 of these* sources.*- * - When showing a shared file, (1) and (3) are merged, with changes from (3)- * taking precedence, to obtain the full metadata pertinent to the file.- * - When showing a normal (un-shared) file, (1), (2) and (3) are merged, with- * changes from (2) and (3) taking precedence, to obtain the full metadata.- * (2) and (3) have no intersection of keys, so they can be merged in any- * order.+ * - When showing a shared file, (1) and (3) are merged, with changes from (3)+ * taking precedence, to obtain the full metadata pertinent to the file.+ *+ * - When showing a normal (un-shared) file, (1), (2) and (3) are merged, with+ * changes from (2) and (3) taking precedence, to obtain the full metadata.+ * (2) and (3) have no intersection of keys, so they can be merged in any+ * order.** While these sources can be conceptually merged, it is important for the* client to also retain the original sources unchanged. This is because the@@ -51,6 +52,8 @@ import type { FILE_TYPE } from "../file-type";* unchanged.*/export interface Metadata {+ /** The "Ente" file type - image, video or live photo. */+ fileType: FILE_TYPE;/*** The file name.*@@ -71,8 +74,6 @@ export interface Metadata {modificationTime: number;latitude: number;longitude: number;- /** The "Ente" file type - image, video or live photo. */- fileType: FILE_TYPE;hasStaticThumbnail?: boolean;hash?: string;imageHash?: string;diff --git a/web/packages/new/photos/services/exif.ts b/web/packages/new/photos/services/exif.tsindex 960ccbb287..952d7a542b 100644--- a/web/packages/new/photos/services/exif.ts+++ b/web/packages/new/photos/services/exif.ts@@ -9,7 +9,7 @@ export const wipNewLib = async () => isDevBuild && (await isInternalUser());export const cmpNewLib = (oldLib: ParsedExtractedMetadata,- newLib: ParsedExif,+ newLib: ParsedMetadata,) => {if (oldLib.creationTime == newLib.creationTime &&@@ -27,14 +27,34 @@ export const cmpNewLib = (};/**- * Data extracted from the Exif and other metadata embedded in the original- * image, and saved in the metadata associated with an {@link EnteFile}.+ * Metadata about a file extracted from various sources (like Exif) when+ * uploading it into Ente.*- * These are the bits of information that are commonly needed, and having them- * be attached to an {@link EnteFile} allows us to perform operations using- * these attributes without needing to re-download the original image.+ * Depending on the file type and the upload sequence, this data can come from+ * various places:+ *+ * - For images it comes from the Exif and other forms of metadata (XMP, IPTC)+ * embedded in the file.+ *+ * - For videos, similarly it is extracted from the metadata embedded in the+ * file using ffmpeg.+ *+ * - From various sidecar files (like metadata JSONs) that might be sitting+ * next to the original during an import.+ *+ * These bits then get distributed and saved in the various metadata fields+ * associated with an {@link EnteFile} (See: [Note: Metadatum]).+ *+ * The advantage of having them be attached to an {@link EnteFile} is that it+ * allows us to perform operations using these attributes without needing to+ * re-download the original image.+ *+ * The disadvantage is that it increases the network payload (anything attached+ * to an {@link EnteFile} comes back in the diff response), and thus latency and+ * local storage costs for all clients. Thus, we need to curate what gets+ * preseved within the {@link EnteFile}'s metadatum.*/-export interface ParsedExif {+export interface ParsedMetadata {/** The width of the image, in pixels. */width?: number;/** The height of the image, in pixels. */@@ -80,7 +100,7 @@ export const parseExif = (tags: RawExifTags) => {const creationDate = parseCreationDate(tags);const dimensions = parseDimensions(tags);- const metadata: ParsedExif = dimensions ?? {};+ const metadata: ParsedMetadata = dimensions ?? {};if (creationDate) metadata.creationTime = creationDate.getTime() * 1000;if (location) metadata.location = location;return metadata;