Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Update key

Manav Rathibbac3a2a94e0
diff --git a/web/packages/new/photos/services/ml/db.ts b/web/packages/new/photos/services/ml/db.ts
index 3fe18d0731..dc65270a08 100644
--- a/web/packages/new/photos/services/ml/db.ts
+++ b/web/packages/new/photos/services/ml/db.ts
@@ -149,6 +149,12 @@ const deleteLegacyDB = () => {
removeKV("embeddingSyncTime:onnx-clip"),
removeKV("embeddingSyncTime:file-ml-clip-face"),
]);
+
+ // Delete legacy ML keys.
+ //
+ // This code was added August 2024 (v1.7.3-beta) and can be removed at some
+ // point when most clients have migrated (tag: Migration).
+ localStorage.removeItem("faceIndexingEnabled");
};
/**
diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.ts
index 9355e7d24b..d998029507 100644
--- a/web/packages/new/photos/services/ml/index.ts
+++ b/web/packages/new/photos/services/ml/index.ts
@@ -160,13 +160,8 @@ export const isMLSupported = isDesktop;
/**
* TODO-ML: This will not be needed when we move to a public beta.
- * Was this someone who might've enabled the beta ML? If so, show them the
- * coming back soon banner while we finalize it.
*/
-export const canEnableML = async () =>
- // TODO-ML: The interim condition should be
- // isDevBuild || (await isInternalUser()) || (await isBetaUser());
- await isInternalUser();
+export const canEnableML = async () => await isInternalUser();
/**
* Initialize the ML subsystem if the user has enabled it in preferences.
@@ -224,6 +219,11 @@ export const disableML = async () => {
triggerStatusUpdate();
};
+/**
+ * Local storage key for {@link isMLEnabledLocal}.
+ */
+const mlLocalKey = "mlEnabled";
+
/**
* Return true if our local persistence thinks that ML is enabled.
*
@@ -233,17 +233,15 @@ export const disableML = async () => {
* The remote status is tracked with a separate {@link isMLEnabledRemote} flag
* that is synced with remote.
*/
-const isMLEnabledLocal = () =>
- // TODO-ML: Rename this flag
- localStorage.getItem("faceIndexingEnabled") == "1";
+const isMLEnabledLocal = () => localStorage.getItem(mlLocalKey) == "1";
/**
* Update the (locally stored) value of {@link isMLEnabledLocal}.
*/
const setIsMLEnabledLocal = (enabled: boolean) =>
enabled
- ? localStorage.setItem("faceIndexingEnabled", "1")
- : localStorage.removeItem("faceIndexingEnabled");
+ ? localStorage.setItem(mlLocalKey, "1")
+ : localStorage.removeItem(mlLocalKey);
/**
* For historical reasons, this is called "faceSearchEnabled" (it started off as