π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
sync
Manav Rathiddf530f23681
diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.tsindex a2e6eee825..987a4cdacb 100644--- a/web/apps/photos/src/services/searchService.ts+++ b/web/apps/photos/src/services/searchService.ts@@ -11,7 +11,7 @@ import {} from "@/new/photos/services/ml";import { clusterGroups } from "@/new/photos/services/ml/db";import type { SearchPerson } from "@/new/photos/services/search";-import { syncPersons } from "@/new/photos/services/user-entity";+import { syncCGroups } from "@/new/photos/services/user-entity";import { EnteFile } from "@/new/photos/types/file";import * as chrono from "chrono-node";import { t } from "i18next";@@ -424,7 +424,7 @@ async function getAllPeople(limit: number = undefined) {done = true;if (process.env.NEXT_PUBLIC_ENTE_WIP_CL_FETCH) {- await syncPersons();+ await syncCGroups();const people = await clusterGroups();log.debug(() => ["people", { people }]);}diff --git a/web/packages/new/photos/services/search.ts b/web/packages/new/photos/services/search.tsindex de11843164..587485d571 100644--- a/web/packages/new/photos/services/search.ts+++ b/web/packages/new/photos/services/search.ts@@ -1,7 +1,7 @@import type { EnteFile } from "@/new/photos/types/file";/**- * A massaged version of {@link Person} suitable for being shown in search+ * A massaged version of {@link CGroup} suitable for being shown in search* results.*/export interface SearchPerson {diff --git a/web/packages/new/photos/services/user-entity.ts b/web/packages/new/photos/services/user-entity.tsindex 81b451503e..ee3e5edd8c 100644--- a/web/packages/new/photos/services/user-entity.ts+++ b/web/packages/new/photos/services/user-entity.ts@@ -14,14 +14,16 @@ import { applyCGroupDiff } from "./ml/db";* User entities are predefined lists of otherwise arbitrary data that the user* can store for their account.*- * e.g. location tags, people in their photos.+ * e.g. location tags, cluster groups.*/export type EntityType =/**- * The latest iteration of the Person entity format, where the data is- * gzipped before encryption.+ * A cluster group.+ *+ * Format: An encrypted string containing a gzipped JSON string representing+ * the cgroup data.*/- "person_v2";+ "cgroup";/*** The maximum number of items to fetch in a single diff@@ -315,19 +317,19 @@ const saveLatestUpdatedAt = (type: EntityType, value: number) =>/*** Sync the {@link CGroup} entities that we have locally with remote.*- * This fetches all the user entities corresponding to the "person_v2" entity- * type from remote that have been created, updated or deleted since the last- * time we checked.+ * This fetches all the user entities corresponding to the "cgroup" entity type+ * from remote that have been created, updated or deleted since the last time we+ * checked.** This diff is then applied to the data we have persisted locally.*/-export const syncPersons = async () => {- const type: EntityType = "person_v2";+export const syncCGroups = async () => {+ const type: EntityType = "cgroup";const entityKeyB64 = await getOrCreateEntityKeyB64(type);const parse = async (id: string, data: Uint8Array): Promise<CGroup> => {- const rp = RemotePerson.parse(JSON.parse(await gunzip(data)));+ const rp = RemoteCGroup.parse(JSON.parse(await gunzip(data)));return {id,name: rp.name,@@ -360,8 +362,8 @@ export const syncPersons = async () => {}};-/** Zod schema for the {@link RemotePerson} type. */-const RemotePerson = z.object({+/** Zod schema for the {@link RemoteCGroup} type. */+const RemoteCGroup = z.object({name: z.string().nullish().transform(nullToUndefined),assigned: z.array(z.object({@@ -374,6 +376,6 @@ const RemotePerson = z.object({});/**- * A "person_v2" entity as synced via remote.+ * Contents of a "cgroup" user entity, as synced via remote.*/-type RemotePerson = z.infer<typeof RemotePerson>;+type RemoteCGroup = z.infer<typeof RemoteCGroup>;