π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
New
Manav Rathi403cc3cca0d3
diff --git a/web/apps/photos/src/services/face/indexer.ts b/web/apps/photos/src/services/face/indexer.tsindex 5d5d0f56c5..7436986144 100644--- a/web/apps/photos/src/services/face/indexer.ts+++ b/web/apps/photos/src/services/face/indexer.ts@@ -2,12 +2,14 @@ import log from "@/next/log";import { ComlinkWorker } from "@/next/worker/comlink-worker";import { wait } from "@/utils/promise";import { type Remote } from "comlink";-import mlIDbStorage from "services/face/db-old";+import mlIDbStorage, { ML_SEARCH_CONFIG_NAME } from "services/face/db-old";import machineLearningService, {+ DEFAULT_ML_SEARCH_CONFIG,defaultMLVersion,} from "services/machineLearning/machineLearningService";import mlWorkManager from "services/machineLearning/mlWorkManager";import type { EnteFile } from "types/file";+import { isInternalUserForML } from "utils/user";import { indexableAndIndexedCounts, markIndexingFailed } from "./db";import type { IndexStatus } from "./db-old";import { indexFaces } from "./f-index";@@ -213,3 +215,28 @@ export const unidentifiedFaceIDs = async (const mlFileData = await mlIDbStorage.getFile(enteFile.id);return mlFileData?.faces ?? [];};++/**+ * Return true if the user has enabled face indexing in the app's settings.+ *+ * This setting is persisted locally (in local storage) and is not synced with+ * remote. There is a separate setting, "faceSearchEnabled" that is synced with+ * remote, but that tracks whether or not the user has enabled face search once+ * on any client. This {@link isFaceIndexingEnabled} property, on the other+ * hand, denotes whether or not indexing is enabled on the current client.+ */+export const isFaceIndexingEnabled = () => {+ if (isInternalUserForML()) {+ return mlIDbStorage.getConfig(+ ML_SEARCH_CONFIG_NAME,+ DEFAULT_ML_SEARCH_CONFIG,+ );+ }+ // Force disabled for everyone else while we finalize it to avoid redundant+ // reindexing for users.+ return DEFAULT_ML_SEARCH_CONFIG;+};++export const setIsFaceIndexingEnabled = (enabled: boolean) => {+ return mlIDbStorage.putConfig(ML_SEARCH_CONFIG_NAME, { enabled });+};diff --git a/web/apps/photos/src/services/machineLearning/machineLearningService.ts b/web/apps/photos/src/services/machineLearning/machineLearningService.tsindex cbde414341..f952a3202e 100644--- a/web/apps/photos/src/services/machineLearning/machineLearningService.ts+++ b/web/apps/photos/src/services/machineLearning/machineLearningService.ts@@ -5,10 +5,10 @@ import mlIDbStorage, {ML_SEARCH_CONFIG_NAME,type MinimalPersistedFileData,} from "services/face/db-old";+import { isFaceIndexingEnabled } from "services/face/indexer";import { FaceIndexerWorker } from "services/face/indexer.worker";import { getLocalFiles } from "services/fileService";import { EnteFile } from "types/file";-import { isInternalUserForML } from "utils/user";export const defaultMLVersion = 1;@@ -25,15 +25,7 @@ export const DEFAULT_ML_SEARCH_CONFIG: MLSearchConfig = {};export async function getMLSearchConfig() {- if (isInternalUserForML()) {- return mlIDbStorage.getConfig(- ML_SEARCH_CONFIG_NAME,- DEFAULT_ML_SEARCH_CONFIG,- );- }- // Force disabled for everyone else while we finalize it to avoid redundant- // reindexing for users.- return DEFAULT_ML_SEARCH_CONFIG;+ return isFaceIndexingEnabled();}export async function updateMLSearchConfig(newConfig: MLSearchConfig) {