Bypass
This commit is contained in:
@@ -50,11 +50,9 @@ import { createContext, useContext, useEffect, useRef, useState } from "react";
|
||||
import LoadingBar from "react-top-loading-bar";
|
||||
import DownloadManager from "services/download";
|
||||
import { resumeExportsIfNeeded } from "services/export";
|
||||
import { isFaceIndexingEnabled } from "services/face/indexer";
|
||||
import { photosLogout } from "services/logout";
|
||||
import {
|
||||
getMLSearchConfig,
|
||||
updateMLSearchConfig,
|
||||
} from "services/machineLearning/machineLearningService";
|
||||
import { updateMLSearchConfig } from "services/machineLearning/machineLearningService";
|
||||
import mlWorkManager from "services/machineLearning/mlWorkManager";
|
||||
import {
|
||||
getFamilyPortalRedirectURL,
|
||||
@@ -186,9 +184,9 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
}
|
||||
const loadMlSearchState = async () => {
|
||||
try {
|
||||
const mlSearchConfig = await getMLSearchConfig();
|
||||
setMlSearchEnabled(mlSearchConfig.enabled);
|
||||
mlWorkManager.setMlSearchEnabled(mlSearchConfig.enabled);
|
||||
const enabled = await isFaceIndexingEnabled();
|
||||
setMlSearchEnabled(enabled);
|
||||
mlWorkManager.setMlSearchEnabled(enabled);
|
||||
} catch (e) {
|
||||
log.error("Error while loading mlSearchEnabled", e);
|
||||
}
|
||||
@@ -286,8 +284,7 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
const showNavBar = (show: boolean) => setShowNavBar(show);
|
||||
const updateMlSearchEnabled = async (enabled: boolean) => {
|
||||
try {
|
||||
const mlSearchConfig = await getMLSearchConfig();
|
||||
mlSearchConfig.enabled = enabled;
|
||||
const mlSearchConfig = { enabled };
|
||||
await updateMLSearchConfig(mlSearchConfig);
|
||||
setMlSearchEnabled(enabled);
|
||||
mlWorkManager.setMlSearchEnabled(enabled);
|
||||
|
||||
@@ -225,16 +225,17 @@ export const unidentifiedFaceIDs = async (
|
||||
* 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 = () => {
|
||||
export const isFaceIndexingEnabled = async () => {
|
||||
if (isInternalUserForML()) {
|
||||
return mlIDbStorage.getConfig(
|
||||
const config = await mlIDbStorage.getConfig(
|
||||
ML_SEARCH_CONFIG_NAME,
|
||||
DEFAULT_ML_SEARCH_CONFIG,
|
||||
);
|
||||
return config.enabled;
|
||||
}
|
||||
// Force disabled for everyone else while we finalize it to avoid redundant
|
||||
// reindexing for users.
|
||||
return DEFAULT_ML_SEARCH_CONFIG;
|
||||
return false;
|
||||
};
|
||||
|
||||
export const setIsFaceIndexingEnabled = (enabled: boolean) => {
|
||||
|
||||
@@ -5,7 +5,6 @@ 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";
|
||||
@@ -24,10 +23,6 @@ export const DEFAULT_ML_SEARCH_CONFIG: MLSearchConfig = {
|
||||
enabled: false,
|
||||
};
|
||||
|
||||
export async function getMLSearchConfig() {
|
||||
return isFaceIndexingEnabled();
|
||||
}
|
||||
|
||||
export async function updateMLSearchConfig(newConfig: MLSearchConfig) {
|
||||
return mlIDbStorage.putConfig(ML_SEARCH_CONFIG_NAME, newConfig);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user