π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Let tsc know
Manav Rathied907c71f86c
diff --git a/web/packages/new/photos/services/ml/cgroups.ts b/web/packages/new/photos/services/ml/cgroups.tsindex 5966b9ca4c..f33e27e53c 100644--- a/web/packages/new/photos/services/ml/cgroups.ts+++ b/web/packages/new/photos/services/ml/cgroups.ts@@ -134,8 +134,12 @@ export const syncCGroups = async () => {await pullCGroups(masterKey);};+export type NamedPerson = Omit<Person, "name"> & {+ name: string;+};+/**- * Construct in-memory "people" from the cgroups present locally.+ * Construct in-memory {@link NamedPerson}s from the cgroups present locally.** This function is meant to run after files, cgroups and faces have been synced* with remote. It then uses all the information in the local DBs to construct@@ -144,7 +148,7 @@ export const syncCGroups = async () => {* @return A list of {@link Person}s, sorted by the number of files that they* reference.*/-export const peopleFromCGroups = async () => {+export const namedPeopleFromCGroups = async (): Promise<NamedPerson[]> => {if (!process.env.NEXT_PUBLIC_ENTE_WIP_CL) return [];if (!(await wipClusterEnable())) return [];diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.tsindex 1bed3f27ce..03dc4a83ef 100644--- a/web/packages/new/photos/services/ml/index.ts+++ b/web/packages/new/photos/services/ml/index.ts@@ -18,7 +18,7 @@ import { isInternalUser } from "../feature-flags";import { getRemoteFlag, updateRemoteFlag } from "../remote-store";import { setSearchPeople } from "../search";import type { UploadItem } from "../upload/types";-import { peopleFromCGroups, syncCGroups, type Person } from "./cgroups";+import { namedPeopleFromCGroups, syncCGroups, type Person } from "./cgroups";import { regenerateFaceCrops } from "./crop";import { clearMLDB, getFaceIndex, getIndexableAndIndexedCounts } from "./db";import { MLWorker } from "./worker";@@ -335,7 +335,7 @@ export const mlSync = async () => {wipClusterLocalOnce();// Update our in-memory snapshot of people.- const namedPeople = await peopleFromCGroups();+ const namedPeople = await namedPeopleFromCGroups();_state.peopleRemote = namedPeople;updatePeopleSnapshot();diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.tsindex 7d59b16971..759111292c 100644--- a/web/packages/new/photos/services/search/index.ts+++ b/web/packages/new/photos/services/search/index.ts@@ -4,7 +4,7 @@ import { ComlinkWorker } from "@/base/worker/comlink-worker";import { FileType } from "@/media/file-type";import i18n, { t } from "i18next";import { clipMatches, isMLEnabled, isMLSupported } from "../ml";-import type { Person } from "../ml/cgroups";+import type { NamedPerson } from "../ml/cgroups";import type {LabelledFileType,LabelledSearchDateComponents,@@ -58,9 +58,9 @@ export const setSearchCollectionsAndFiles = (cf: SearchCollectionsAndFiles) =>void worker().then((w) => w.setCollectionsAndFiles(cf));/**- * Set the people that we should search across.+ * Set the (named) people that we should search across.*/-export const setSearchPeople = (people: Person[]) =>+export const setSearchPeople = (people: NamedPerson[]) =>void worker().then((w) => w.setPeople(people));/**diff --git a/web/packages/new/photos/services/search/worker.ts b/web/packages/new/photos/services/search/worker.tsindex 4fcbc4cb61..2150d9c228 100644--- a/web/packages/new/photos/services/search/worker.ts+++ b/web/packages/new/photos/services/search/worker.ts@@ -2,7 +2,7 @@ import { HTTPError } from "@/base/http";import type { Location } from "@/base/types";import type { Collection } from "@/media/collection";import { fileCreationPhotoDate, fileLocation } from "@/media/file-metadata";-import type { Person } from "@/new/photos/services/ml/cgroups";+import type { NamedPerson } from "@/new/photos/services/ml/cgroups";import type { EnteFile } from "@/new/photos/types/file";import { ensure } from "@/utils/ensure";import { nullToUndefined } from "@/utils/transform";@@ -37,7 +37,7 @@ export class SearchWorker {collections: [],files: [],};- private people: Person[] = [];+ private people: NamedPerson[] = [];/*** Fetch any state we might need when the actual search happens.@@ -62,9 +62,9 @@ export class SearchWorker {}/**- * Set the people that we should search across.+ * Set the (named) people that we should search across.*/- setPeople(people: Person[]) {+ setPeople(people: NamedPerson[]) {this.people = people;}@@ -122,7 +122,7 @@ const suggestionsForString = (re: RegExp,searchString: string,{ collections, files }: SearchCollectionsAndFiles,- people: Person[],+ people: NamedPerson[],{ locale, holidays, labelledFileTypes }: LocalizedSearchData,locationTags: LocationTag[],cities: City[],@@ -196,7 +196,10 @@ const fileCaptionSuggestion = (: [];};-const peopleSuggestions = (re: RegExp, people: Person[]): SearchSuggestion[] =>+const peopleSuggestions = (+ re: RegExp,+ people: NamedPerson[],+): SearchSuggestion[] =>people.filter((p) => re.test(p.name)).map((person) => ({ type: "person", person, label: person.name }));