Преглед изворни кода

Merge branch 'main' into dependabot/npm_and_yarn/follow-redirects-1.15.4

Abhinav Kumar пре 1 година
родитељ
комит
f8cdc55cfc

BIN
apps/auth/public/images/favicon.png


BIN
apps/photos/public/images/favicon.png


+ 1 - 1
apps/photos/public/locales/de/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 9 - 9
apps/photos/public/locales/en/translation.json

@@ -495,16 +495,16 @@
     "ROOT_LEVEL_FILE_WITH_FOLDER_NOT_ALLOWED": "Cannot create albums from file/folder mix",
     "ROOT_LEVEL_FILE_WITH_FOLDER_NOT_ALLOWED_MESSAGE": "<p>You have dragged and dropped a mixture of files and folders.</p><p>Please provide either only files, or only folders when selecting option to create separate albums</p>",
     "CHOSE_THEME": "Choose theme",
-    "ML_SEARCH": "ML search (beta)",
+    "ML_SEARCH": "Face recognition",
     "ENABLE_ML_SEARCH_DESCRIPTION": "<p>This will enable on-device machine learning and face search which will start analyzing your uploaded photos locally.</p><p>For the first run after login or enabling this feature, it will download all images on local device to analyze them. So please only enable this if you are ok with bandwidth and local processing of all images in your photo library.</p><p>If this is the first time you're enabling this, we'll also ask your permission to process face data.</p>",
     "ML_MORE_DETAILS": "More details",
-    "ENABLE_FACE_SEARCH": "Enable face search",
-    "ENABLE_FACE_SEARCH_TITLE": "Enable face search?",
-    "ENABLE_FACE_SEARCH_DESCRIPTION": "<p>If you enable face search, ente will extract face geometry from your photos. This will happen on your device, and any generated biometric data will be end-to-encrypted.<p/><p><a>Please click here for more details about this feature in our privacy policy</a></p>",
-    "DISABLE_BETA": "Disable beta",
-    "DISABLE_FACE_SEARCH": "Disable face search",
-    "DISABLE_FACE_SEARCH_TITLE": "Disable face search?",
-    "DISABLE_FACE_SEARCH_DESCRIPTION": "<p>ente will stop processing face geometry, and will also disable ML search (beta)</p><p>You can reenable face search again if you wish, so this operation is safe.</p>",
+    "ENABLE_FACE_SEARCH": "Enable face recognition",
+    "ENABLE_FACE_SEARCH_TITLE": "Enable face recognition?",
+    "ENABLE_FACE_SEARCH_DESCRIPTION": "<p>If you enable face recognition, ente will extract face geometry from your photos. This will happen on your device, and any generated biometric data will be end-to-encrypted.<p/><p><a>Please click here for more details about this feature in our privacy policy</a></p>",
+    "DISABLE_BETA": "Pause recognition",
+    "DISABLE_FACE_SEARCH": "Disable face recognition",
+    "DISABLE_FACE_SEARCH_TITLE": "Disable face recognition?",
+    "DISABLE_FACE_SEARCH_DESCRIPTION": "<p>Ente will stop processing face geometry.</p><p>You can reenable face recognition again if you wish, so this operation is safe.</p>",
     "ADVANCED": "Advanced",
     "FACE_SEARCH_CONFIRMATION": "I understand, and wish to allow ente to process face geometry",
     "LABS": "Labs",
@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "Photo Editor",
     "FASTER_UPLOAD": "Faster uploads",
     "FASTER_UPLOAD_DESCRIPTION": "Route uploads through nearby servers",
-    "STATUS": "Status",
+    "MAGIC_SEARCH_STATUS": "Magic Search Status",
     "INDEXED_ITEMS": "Indexed items",
     "CACHE_DIRECTORY": "Cache folder"
 }

+ 1 - 1
apps/photos/public/locales/es/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/fa/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/fi/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/fr/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "Éditeur de photos",
     "FASTER_UPLOAD": "Chargements plus rapides",
     "FASTER_UPLOAD_DESCRIPTION": "Router les chargements vers les serveurs à proximité",
-    "STATUS": "État",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "Éléments indexés",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/it/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/nl/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "Fotobewerker",
     "FASTER_UPLOAD": "Snellere uploads",
     "FASTER_UPLOAD_DESCRIPTION": "Uploaden door nabije servers",
-    "STATUS": "Status",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "Geïndexeerde bestanden",
     "CACHE_DIRECTORY": "Cache map"
 }

+ 1 - 1
apps/photos/public/locales/pt/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/ru/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/tr/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "",
     "FASTER_UPLOAD": "",
     "FASTER_UPLOAD_DESCRIPTION": "",
-    "STATUS": "",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "",
     "CACHE_DIRECTORY": ""
 }

+ 1 - 1
apps/photos/public/locales/zh/translation.json

@@ -622,7 +622,7 @@
     "PHOTO_EDITOR": "照片编辑器",
     "FASTER_UPLOAD": "更快上传",
     "FASTER_UPLOAD_DESCRIPTION": "通过附近的服务器路由上传",
-    "STATUS": "状态",
+    "MAGIC_SEARCH_STATUS": "",
     "INDEXED_ITEMS": "索引项目",
     "CACHE_DIRECTORY": "缓存文件夹"
 }

+ 6 - 0
apps/photos/src/components/Search/SearchBar/searchInput/index.tsx

@@ -34,6 +34,7 @@ import { t } from 'i18next';
 import memoize from 'memoize-one';
 import { LocationTagData } from 'types/entity';
 import { FILE_TYPE } from 'constants/file';
+import { addLogLine } from '@ente/shared/logging';
 
 interface Iprops {
     isOpen: boolean;
@@ -64,10 +65,15 @@ export default function SearchInput(props: Iprops) {
 
     useEffect(() => {
         refreshDefaultOptions();
+        const t = setInterval(() => refreshDefaultOptions(), 2000);
+        return () => clearInterval(t);
     }, []);
 
     async function refreshDefaultOptions() {
+        const t = Date.now();
+        addLogLine('refreshDefaultOptions called');
         const defaultOptions = await getDefaultOptions(props.files);
+        addLogLine(`refreshDefaultOptions end time: ${Date.now() - t}ms`);
         setDefaultOptions(defaultOptions);
     }
 

+ 1 - 1
apps/photos/src/pages/_app.tsx

@@ -241,7 +241,7 @@ export default function App(props: EnteAppProps) {
                     );
                     return;
                 }
-                DownloadManager.init(APPS.PHOTOS, { token });
+                await DownloadManager.init(APPS.PHOTOS, { token });
                 const exportSettings = exportService.getExportSettings();
                 if (!exportService.exportFolderExists(exportSettings?.folder)) {
                     return;

+ 28 - 22
apps/photos/src/services/searchService.ts

@@ -42,7 +42,7 @@ export const getDefaultOptions = async (files: EnteFile[]) => {
     return [
         await getIndexStatusSuggestion(),
         ...convertSuggestionsToOptions(await getAllPeopleSuggestion(), files),
-    ];
+    ].filter((t) => !!t);
 };
 
 export const getAutoCompleteSuggestions =
@@ -176,7 +176,9 @@ function getYearSuggestion(searchPhrase: string): Suggestion[] {
 
 export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
     try {
+        addLogLine('getAllPeopleSuggestion called');
         const people = await getAllPeople(200);
+        addLogLine(`found people: ${people?.length ?? 0}`);
         return people.map((person) => ({
             label: person.name,
             type: SuggestionType.PERSON,
@@ -190,28 +192,32 @@ export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
 }
 
 export async function getIndexStatusSuggestion(): Promise<Suggestion> {
-    const config = await getMLSyncConfig();
-    const indexStatus = await mlIDbStorage.getIndexStatus(config.mlVersion);
-
-    let label;
-    if (!indexStatus.localFilesSynced) {
-        label = t('INDEXING_SCHEDULED');
-    } else if (indexStatus.outOfSyncFilesExists) {
-        label = t('ANALYZING_PHOTOS', {
-            indexStatus,
-        });
-    } else if (!indexStatus.peopleIndexSynced) {
-        label = t('INDEXING_PEOPLE', { indexStatus });
-    } else {
-        label = t('INDEXING_DONE', { indexStatus });
-    }
+    try {
+        const config = await getMLSyncConfig();
+        const indexStatus = await mlIDbStorage.getIndexStatus(config.mlVersion);
+
+        let label;
+        if (!indexStatus.localFilesSynced) {
+            label = t('INDEXING_SCHEDULED');
+        } else if (indexStatus.outOfSyncFilesExists) {
+            label = t('ANALYZING_PHOTOS', {
+                indexStatus,
+            });
+        } else if (!indexStatus.peopleIndexSynced) {
+            label = t('INDEXING_PEOPLE', { indexStatus });
+        } else {
+            label = t('INDEXING_DONE', { indexStatus });
+        }
 
-    return {
-        label,
-        type: SuggestionType.INDEX_STATUS,
-        value: indexStatus,
-        hide: true,
-    };
+        return {
+            label,
+            type: SuggestionType.INDEX_STATUS,
+            value: indexStatus,
+            hide: true,
+        };
+    } catch (e) {
+        logError(e, 'getIndexStatusSuggestion failed');
+    }
 }
 
 function getDateSuggestion(searchPhrase: string): Suggestion[] {