π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Mirror files
Manav Rathia302f986d7c9
diff --git a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsxindex 5a829e3998..c232bc698a 100644--- a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx+++ b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx@@ -11,7 +11,7 @@ import { downloadAndRevokeObjectURL } from "@/base/utils/web";import { downloadManager } from "@/gallery/services/download";import { EnteFile } from "@/media/file";import { photosDialogZIndex } from "@/new/photos/components/utils/z-index";-import { getLocalCollections } from "@/new/photos/services/collection";+import { getLocalCollections } from "@/new/photos/services/collections";import { AppContext } from "@/new/photos/types/context";import {CenteredFlex,diff --git a/web/apps/photos/src/pages/deduplicate.tsx b/web/apps/photos/src/pages/deduplicate.tsxindex e5744910ac..9b3cb7722d 100644--- a/web/apps/photos/src/pages/deduplicate.tsx+++ b/web/apps/photos/src/pages/deduplicate.tsx@@ -2,10 +2,8 @@ import { stashRedirect } from "@/accounts/services/redirect";import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";import { errorDialogAttributes } from "@/base/components/utils/dialog";import log from "@/base/log";-import {- ALL_SECTION,- getLocalCollections,-} from "@/new/photos/services/collection";+import { ALL_SECTION } from "@/new/photos/services/collection";+import { getLocalCollections } from "@/new/photos/services/collections";import { createFileCollectionIDs } from "@/new/photos/services/file";import { getLocalFiles } from "@/new/photos/services/files";import { useAppContext } from "@/new/photos/types/context";diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.tsindex d24195f02f..e9ef53afd7 100644--- a/web/apps/photos/src/services/collectionService.ts+++ b/web/apps/photos/src/services/collectionService.ts@@ -21,8 +21,6 @@ import {import { EncryptedMagicMetadata, EnteFile } from "@/media/file";import { ItemVisibility } from "@/media/file-metadata";import {- getAllLocalCollections,- getLocalCollections,isDefaultHiddenCollection,isHiddenCollection,} from "@/new/photos/services/collection";@@ -31,6 +29,10 @@ import {CollectionSummaryOrder,CollectionsSortBy,} from "@/new/photos/services/collection/ui";+import {+ getAllLocalCollections,+ getLocalCollections,+} from "@/new/photos/services/collections";import { groupFilesByCollectionID } from "@/new/photos/services/file";import { getLocalFiles, sortFiles } from "@/new/photos/services/files";import { updateMagicMetadata } from "@/new/photos/services/magic-metadata";diff --git a/web/apps/photos/src/services/export/migration.ts b/web/apps/photos/src/services/export/migration.tsindex 9f9b035c4b..b5113ea226 100644--- a/web/apps/photos/src/services/export/migration.ts+++ b/web/apps/photos/src/services/export/migration.ts@@ -6,7 +6,7 @@ import type { Collection } from "@/media/collection";import { mergeMetadata, type EnteFile } from "@/media/file";import { FileType } from "@/media/file-type";import { decodeLivePhoto } from "@/media/live-photo";-import { getLocalCollections } from "@/new/photos/services/collection";+import { getLocalCollections } from "@/new/photos/services/collections";import { exportMetadataDirectoryName } from "@/new/photos/services/export";import { getAllLocalFiles } from "@/new/photos/services/files";import {diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.tsindex eb727e3b5c..90b663565c 100644--- a/web/apps/photos/src/utils/collection.ts+++ b/web/apps/photos/src/utils/collection.ts@@ -14,11 +14,13 @@ import { ItemVisibility } from "@/media/file-metadata";import {DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME,findDefaultHiddenCollectionIDs,- getAllLocalCollections,- getLocalCollections,isHiddenCollection,isIncomingShare,} from "@/new/photos/services/collection";+import {+ getAllLocalCollections,+ getLocalCollections,+} from "@/new/photos/services/collections";import { getAllLocalFiles, getLocalFiles } from "@/new/photos/services/files";import { updateMagicMetadata } from "@/new/photos/services/magic-metadata";import { safeDirectoryName } from "@/new/photos/utils/native-fs";diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.tsindex 6e5cfead6d..b8a9a904f3 100644--- a/web/apps/photos/tests/upload.test.ts+++ b/web/apps/photos/tests/upload.test.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/dot-notation */import { FileType } from "@/media/file-type";+import { getLocalCollections } from "@/new/photos/services/collections";import { groupFilesByCollectionID } from "@/new/photos/services/file";import { getLocalFiles } from "@/new/photos/services/files";-import { getLocalCollections } from "@/new/photos/services/collection";import { parseDateFromDigitGroups } from "services/upload/date";import {MAX_FILE_NAME_LENGTH_GOOGLE_EXPORT,diff --git a/web/packages/new/photos/services/collections.ts b/web/packages/new/photos/services/collections.tsnew file mode 100644index 0000000000..44f6b9f868--- /dev/null+++ b/web/packages/new/photos/services/collections.ts@@ -0,0 +1,20 @@+import { type Collection } from "@/media/collection";+import localForage from "@ente/shared/storage/localForage";+import { isHiddenCollection } from "./collection";++const COLLECTION_TABLE = "collections";++export const getLocalCollections = async (+ type: "normal" | "hidden" = "normal",+): Promise<Collection[]> => {+ const collections = await getAllLocalCollections();+ return type == "normal"+ ? collections.filter((c) => !isHiddenCollection(c))+ : collections.filter((c) => isHiddenCollection(c));+};++export const getAllLocalCollections = async (): Promise<Collection[]> => {+ const collections: Collection[] =+ (await localForage.getItem(COLLECTION_TABLE)) ?? [];+ return collections;+};diff --git a/web/packages/new/photos/services/dedup.ts b/web/packages/new/photos/services/dedup.tsindex 6bede82f46..baf84f79d9 100644--- a/web/packages/new/photos/services/dedup.ts+++ b/web/packages/new/photos/services/dedup.ts@@ -1,5 +1,6 @@import type { EnteFile } from "@/media/file";-import { createCollectionNameByID, getLocalCollections } from "./collection";+import { createCollectionNameByID } from "./collection";+import { getLocalCollections } from "./collections";import { getLocalFiles, uniqueFilesByID } from "./files";/**@@ -83,7 +84,9 @@ export const deduceDuplicates = async () => {filesByHash.set(hash, [...(filesByHash.get(hash) ?? []), file]);}- const collectionNameByID = createCollectionNameByID(await getLocalCollections());+ const collectionNameByID = createCollectionNameByID(+ await getLocalCollections(),+ );const duplicateGroups: DuplicateGroup[] = [];