π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move
Manav Rathiad7dad59bcf2
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsxindex 3c1e00b40b..7c127db06a 100644--- a/web/apps/photos/src/pages/index.tsx+++ b/web/apps/photos/src/pages/index.tsx@@ -6,14 +6,13 @@ import { EnteLogo } from "ente-base/components/EnteLogo";import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";import { useBaseContext } from "ente-base/context";-import log from "ente-base/log";import { albumsAppOrigin, customAPIHost } from "ente-base/origins";import {haveAuthenticatedSession,updateSessionFromElectronSafeStorageIfNeeded,} from "ente-base/session";+import { canAccessIndexedDB } from "ente-gallery/services/files-db";import { DevSettings } from "ente-new/photos/components/DevSettings";-import localForage from "ente-shared/storage/localForage";import { getData } from "ente-shared/storage/localStorage";import { t } from "i18next";import { useRouter } from "next/router";@@ -72,19 +71,15 @@ const Page: React.FC = () => {};const ensureIndexedDBAccess = useCallback(async () => {- try {- await localForage.ready();- } catch (e) {- log.error("IndexDB is not accessible", e);+ if (!(await canAccessIndexedDB())) {showMiniDialog({title: t("error"),message: t("local_storage_not_accessible"),nonClosable: true,cancel: false,});- } finally {- setLoading(false);}+ setLoading(false);}, [showMiniDialog]);return (diff --git a/web/packages/gallery/services/files-db.ts b/web/packages/gallery/services/files-db.tsindex e455fbc701..e9f2afd9fe 100644--- a/web/packages/gallery/services/files-db.ts+++ b/web/packages/gallery/services/files-db.ts@@ -42,6 +42,7 @@* albums app stores data in keys prefixed with "public-".*/+import log from "ente-base/log";import {CollectionPrivateMagicMetadataData,CollectionPublicMagicMetadataData,@@ -62,9 +63,30 @@ import {FilePublicMagicMetadataData,} from "ente-media/file-metadata";import type { MagicMetadata } from "ente-media/magic-metadata";+import localForage from "ente-shared/storage/localForage";import { nullishToEmpty, nullToUndefined } from "ente-utils/transform";import { z } from "zod/v4";+/**+ * Return `true` if we can access IndexedDB.+ *+ * This is used as a pre-flight check, to notify the user if they're using a+ * browser or extension that is preventing the app from using IndexedDB (which+ * is necessary for local storage of collections and files metadata).+ *+ * > File contents themselves are not stored in IndexedDB, only+ * > {@link EnteFile}s.+ */+export const canAccessIndexedDB = async () => {+ try {+ await localForage.ready();+ return true;+ } catch (e) {+ log.error("IndexDB is not accessible", e);+ return false;+ }+};+/*** Return a Zod schema suitable for being used with the various magic metadata* fields of a file or a collection.