π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move more
Manav Rathi2cce5fb17cd2
diff --git a/web/apps/photos/src/components/Upload/UploadProgress/dialog.tsx b/web/apps/photos/src/components/Upload/UploadProgress/dialog.tsxindex 1367b57ad5..da7f488f25 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/dialog.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/dialog.tsx@@ -1,8 +1,8 @@import { Dialog, DialogContent, Link } from "@mui/material";import { t } from "i18next";+import { UPLOAD_RESULT, UPLOAD_STAGES } from "@/new/photos/constants/upload";import { dialogCloseHandler } from "@ente/shared/components/DialogBox/TitleWithCloseButton";-import { UPLOAD_RESULT, UPLOAD_STAGES } from "constants/upload";import UploadProgressContext from "contexts/uploadProgress";import { useContext, useEffect, useState } from "react";import { Trans } from "react-i18next";diff --git a/web/apps/photos/src/components/Upload/UploadProgress/footer.tsx b/web/apps/photos/src/components/Upload/UploadProgress/footer.tsxindex 5a5bebd201..6359009a9a 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/footer.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/footer.tsx@@ -1,5 +1,5 @@+import { UPLOAD_RESULT, UPLOAD_STAGES } from "@/new/photos/constants/upload";import { Button, DialogActions } from "@mui/material";-import { UPLOAD_RESULT, UPLOAD_STAGES } from "constants/upload";import { t } from "i18next";import { useContext } from "react";diff --git a/web/apps/photos/src/components/Upload/UploadProgress/inProgressSection.tsx b/web/apps/photos/src/components/Upload/UploadProgress/inProgressSection.tsxindex 128e280abb..fba1a51db5 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/inProgressSection.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/inProgressSection.tsx@@ -11,8 +11,8 @@ import {} from "./section";import { InProgressItemContainer } from "./styledComponents";+import { UPLOAD_STAGES } from "@/new/photos/constants/upload";import { CaptionedText } from "components/CaptionedText";-import { UPLOAD_STAGES } from "constants/upload";export const InProgressSection = () => {const { inProgressUploads, hasLivePhotos, uploadFileNames, uploadStage } =diff --git a/web/apps/photos/src/components/Upload/UploadProgress/index.tsx b/web/apps/photos/src/components/Upload/UploadProgress/index.tsxindex 1acffd561e..da5fde0950 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/index.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/index.tsx@@ -1,4 +1,4 @@-import { UPLOAD_STAGES } from "constants/upload";+import { UPLOAD_STAGES } from "@/new/photos/constants/upload";import UploadProgressContext from "contexts/uploadProgress";import { t } from "i18next";import { AppContext } from "pages/_app";diff --git a/web/apps/photos/src/components/Upload/UploadProgress/progressBar.tsx b/web/apps/photos/src/components/Upload/UploadProgress/progressBar.tsxindex 6173829d7e..ba28ac7e19 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/progressBar.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/progressBar.tsx@@ -1,5 +1,5 @@+import { UPLOAD_STAGES } from "@/new/photos/constants/upload";import { Box, Divider, LinearProgress } from "@mui/material";-import { UPLOAD_STAGES } from "constants/upload";import UploadProgressContext from "contexts/uploadProgress";import { useContext } from "react";diff --git a/web/apps/photos/src/components/Upload/UploadProgress/resultSection.tsx b/web/apps/photos/src/components/Upload/UploadProgress/resultSection.tsxindex 1be6ca8317..93926fcf0e 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/resultSection.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/resultSection.tsx@@ -1,7 +1,7 @@+import { UPLOAD_RESULT } from "@/new/photos/constants/upload";import ExpandMoreIcon from "@mui/icons-material/ExpandMore";import { CaptionedText } from "components/CaptionedText";import ItemList from "components/ItemList";-import { UPLOAD_RESULT } from "constants/upload";import UploadProgressContext from "contexts/uploadProgress";import { useContext } from "react";import {diff --git a/web/apps/photos/src/components/Upload/UploadProgress/title.tsx b/web/apps/photos/src/components/Upload/UploadProgress/title.tsxindex 1b97b9b437..a123b4c009 100644--- a/web/apps/photos/src/components/Upload/UploadProgress/title.tsx+++ b/web/apps/photos/src/components/Upload/UploadProgress/title.tsx@@ -1,10 +1,10 @@+import { UPLOAD_STAGES } from "@/new/photos/constants/upload";import {IconButtonWithBG,SpaceBetweenFlex,} from "@ente/shared/components/Container";import Close from "@mui/icons-material/Close";import { Box, DialogTitle, Stack, Typography } from "@mui/material";-import { UPLOAD_STAGES } from "constants/upload";import { t } from "i18next";import { useContext } from "react";diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsxindex 170d2fcdc8..8afe1a41d1 100644--- a/web/apps/photos/src/components/Upload/Uploader.tsx+++ b/web/apps/photos/src/components/Upload/Uploader.tsx@@ -1,3 +1,4 @@+import { UPLOAD_STAGES } from "@/new/photos/constants/upload";import { exportMetadataDirectoryName } from "@/new/photos/services/export";import { basename } from "@/next/file";import log from "@/next/log";@@ -8,7 +9,6 @@ import { CustomError } from "@ente/shared/error";import { isPromise } from "@ente/shared/utils";import DiscFullIcon from "@mui/icons-material/DiscFull";import UserNameInputDialog from "components/UserNameInputDialog";-import { UPLOAD_STAGES } from "constants/upload";import { t } from "i18next";import isElectron from "is-electron";import { AppContext } from "pages/_app";diff --git a/web/apps/photos/src/contexts/uploadProgress.tsx b/web/apps/photos/src/contexts/uploadProgress.tsxindex b25df7d65b..440ec75c6d 100644--- a/web/apps/photos/src/contexts/uploadProgress.tsx+++ b/web/apps/photos/src/contexts/uploadProgress.tsx@@ -1,4 +1,4 @@-import { UPLOAD_STAGES } from "constants/upload";+import { UPLOAD_STAGES } from "@/new/photos/constants/upload";import { createContext } from "react";import type {InProgressUpload,diff --git a/web/apps/photos/src/services/download/index.ts b/web/apps/photos/src/services/download/index.tsindex e656c54484..421a540a5c 100644--- a/web/apps/photos/src/services/download/index.ts+++ b/web/apps/photos/src/services/download/index.ts@@ -24,7 +24,7 @@ export type OnDownloadProgress = (event: {total: number;}) => void;-export interface DownloadClient {+interface DownloadClient {updateTokens: (token: string, passwordToken?: string) => void;downloadThumbnail: (file: EnteFile,diff --git a/web/apps/photos/src/services/exif.ts b/web/apps/photos/src/services/exif.tsindex 073a695f75..eed1f5ee17 100644--- a/web/apps/photos/src/services/exif.ts+++ b/web/apps/photos/src/services/exif.ts@@ -1,10 +1,13 @@import { type FileTypeInfo } from "@/media/file-type";+import { NULL_LOCATION } from "@/new/photos/constants/upload";+import type {+ Location,+ ParsedExtractedMetadata,+} from "@/new/photos/types/metadata";import log from "@/next/log";import { validateAndGetCreationUnixTimeInMicroSeconds } from "@ente/shared/time";-import { NULL_LOCATION } from "constants/upload";import exifr from "exifr";import piexif from "piexifjs";-import type { Location, ParsedExtractedMetadata } from "types/metadata";type ParsedEXIFData = Record<string, any> &Partial<{diff --git a/web/apps/photos/src/services/export/migration.ts b/web/apps/photos/src/services/export/migration.tsindex f46fc0a48e..da506e11e1 100644--- a/web/apps/photos/src/services/export/migration.ts+++ b/web/apps/photos/src/services/export/migration.ts@@ -1,5 +1,6 @@import { FILE_TYPE } from "@/media/file-type";import { decodeLivePhoto } from "@/media/live-photo";+import { exportMetadataDirectoryName } from "@/new/photos/services/export";import { getAllLocalFiles } from "@/new/photos/services/files";import { EnteFile } from "@/new/photos/types/file";import { mergeMetadata } from "@/new/photos/utils/file";@@ -30,7 +31,6 @@ import {import { getNonEmptyPersonalCollections } from "utils/collection";import { getIDBasedSortedFiles, getPersonalFiles } from "utils/file";import {- exportMetadataDirectoryName,getCollectionIDFromFileUID,getExportRecordFileUID,getLivePhotoExportName,diff --git a/web/apps/photos/src/services/ffmpeg.ts b/web/apps/photos/src/services/ffmpeg.tsindex 342a6fca57..ded7a5baff 100644--- a/web/apps/photos/src/services/ffmpeg.ts+++ b/web/apps/photos/src/services/ffmpeg.ts@@ -1,3 +1,5 @@+import { NULL_LOCATION } from "@/new/photos/constants/upload";+import type { ParsedExtractedMetadata } from "@/new/photos/types/metadata";import {readConvertToMP4Done,readConvertToMP4Stream,@@ -12,8 +14,6 @@ import {inputPathPlaceholder,outputPathPlaceholder,} from "constants/ffmpeg";-import { NULL_LOCATION } from "constants/upload";-import type { ParsedExtractedMetadata } from "types/metadata";import type { DedicatedFFmpegWorker } from "worker/ffmpeg.worker";import {toDataOrPathOrZipEntry,diff --git a/web/apps/photos/src/services/locationSearchService.ts b/web/apps/photos/src/services/locationSearchService.tsindex 354c87a712..07c805bac0 100644--- a/web/apps/photos/src/services/locationSearchService.ts+++ b/web/apps/photos/src/services/locationSearchService.ts@@ -1,6 +1,6 @@+import type { Location } from "@/new/photos/types/metadata";import log from "@/next/log";-import { LocationTagData } from "types/entity";-import { Location } from "types/metadata";+import type { LocationTagData } from "types/entity";export interface City {city: string;diff --git a/web/apps/photos/src/services/upload/takeout.ts b/web/apps/photos/src/services/upload/takeout.tsindex 2cd0f342d6..f2bcdee38b 100644--- a/web/apps/photos/src/services/upload/takeout.ts+++ b/web/apps/photos/src/services/upload/takeout.ts@@ -1,11 +1,11 @@/** @file Dealing with the JSON metadata in Google Takeouts */+import { NULL_LOCATION } from "@/new/photos/constants/upload";+import type { Location } from "@/new/photos/types/metadata";import { readStream } from "@/new/photos/utils/native-stream";import { ensureElectron } from "@/next/electron";import { nameAndExtension } from "@/next/file";import log from "@/next/log";-import { NULL_LOCATION } from "constants/upload";-import type { Location } from "types/metadata";import type { UploadItem } from "./types";export interface ParsedMetadataJSON {diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.tsindex 869bbbad27..be4ced8a92 100644--- a/web/apps/photos/src/services/upload/uploadManager.ts+++ b/web/apps/photos/src/services/upload/uploadManager.ts@@ -1,5 +1,10 @@import { FILE_TYPE } from "@/media/file-type";import { potentialFileTypeFromExtension } from "@/media/live-photo";+import {+ RANDOM_PERCENTAGE_PROGRESS_FOR_PUT,+ UPLOAD_RESULT,+ UPLOAD_STAGES,+} from "@/new/photos/constants/upload";import { getLocalFiles } from "@/new/photos/services/files";import { EncryptedEnteFile, EnteFile } from "@/new/photos/types/file";import { ensureElectron } from "@/next/electron";@@ -15,11 +20,6 @@ import { CustomError } from "@ente/shared/error";import { Events, eventBus } from "@ente/shared/events";import { Canceler } from "axios";import type { Remote } from "comlink";-import {- RANDOM_PERCENTAGE_PROGRESS_FOR_PUT,- UPLOAD_RESULT,- UPLOAD_STAGES,-} from "constants/upload";import isElectron from "is-electron";import {getLocalPublicFiles,diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.tsindex bfe682cb1b..81cf6645f8 100644--- a/web/apps/photos/src/services/upload/uploadService.ts+++ b/web/apps/photos/src/services/upload/uploadService.ts@@ -2,6 +2,11 @@ import { hasFileHash } from "@/media/file";import { FILE_TYPE, type FileTypeInfo } from "@/media/file-type";import { encodeLivePhoto } from "@/media/live-photo";import type { Metadata } from "@/media/types/file";+import {+ NULL_LOCATION,+ RANDOM_PERCENTAGE_PROGRESS_FOR_PUT,+ UPLOAD_RESULT,+} from "@/new/photos/constants/upload";import {EnteFile,MetadataFileAttributes,@@ -11,6 +16,7 @@ import {type FilePublicMagicMetadataProps,} from "@/new/photos/types/file";import { EncryptedMagicMetadata } from "@/new/photos/types/magicMetadata";+import type { ParsedExtractedMetadata } from "@/new/photos/types/metadata";import { detectFileTypeInfoFromChunk } from "@/new/photos/utils/detect-type";import { readStream } from "@/new/photos/utils/native-stream";import { ensureElectron } from "@/next/electron";@@ -23,11 +29,6 @@ import type { B64EncryptionResult } from "@ente/shared/crypto/internal/libsodiumimport { ENCRYPTION_CHUNK_SIZE } from "@ente/shared/crypto/internal/libsodium";import { CustomError, handleUploadError } from "@ente/shared/error";import type { Remote } from "comlink";-import {- NULL_LOCATION,- RANDOM_PERCENTAGE_PROGRESS_FOR_PUT,- UPLOAD_RESULT,-} from "constants/upload";import { addToCollection } from "services/collectionService";import { parseImageMetadata } from "services/exif";import * as ffmpeg from "services/ffmpeg";@@ -35,7 +36,6 @@ import {PublicUploadProps,type LivePhotoAssets,} from "services/upload/uploadManager";-import type { ParsedExtractedMetadata } from "types/metadata";import {getNonEmptyMagicMetadataProps,updateMagicMetadata,diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.tsindex 597bbe29cc..2e9519dbf5 100644--- a/web/apps/photos/src/services/watch.ts+++ b/web/apps/photos/src/services/watch.ts@@ -3,6 +3,7 @@* watch folders functionality.*/+import { UPLOAD_RESULT } from "@/new/photos/constants/upload";import { getLocalFiles } from "@/new/photos/services/files";import { EncryptedEnteFile } from "@/new/photos/types/file";import { ensureElectron } from "@/next/electron";@@ -14,7 +15,6 @@ import type {FolderWatchSyncedFile,} from "@/next/types/ipc";import { ensureString } from "@/utils/ensure";-import { UPLOAD_RESULT } from "constants/upload";import debounce from "debounce";import uploadManager, {type UploadItemWithCollection,diff --git a/web/apps/photos/src/types/entity.ts b/web/apps/photos/src/types/entity.tsindex 60844ce466..0f22973d21 100644--- a/web/apps/photos/src/types/entity.ts+++ b/web/apps/photos/src/types/entity.ts@@ -1,4 +1,4 @@-import { Location } from "types/metadata";+import { Location } from "@/new/photos/types/metadata";export enum EntityType {LOCATION_TAG = "location",diff --git a/web/apps/photos/src/constants/upload.ts b/web/packages/new/photos/constants/upload.tssimilarity index 91%rename from web/apps/photos/src/constants/upload.tsrename to web/packages/new/photos/constants/upload.tsindex a0103cb6e6..fcee4df18c 100644--- a/web/apps/photos/src/constants/upload.ts+++ b/web/packages/new/photos/constants/upload.ts@@ -1,4 +1,4 @@-import { Location } from "types/metadata";+import type { Location } from "../types/metadata";export const RANDOM_PERCENTAGE_PROGRESS_FOR_PUT = () => 90 + 10 * Math.random();diff --git a/web/apps/photos/src/types/metadata.ts b/web/packages/new/photos/types/metadata.tssimilarity index 73%rename from web/apps/photos/src/types/metadata.tsrename to web/packages/new/photos/types/metadata.tsindex 7994e62479..626493211f 100644--- a/web/apps/photos/src/types/metadata.ts+++ b/web/packages/new/photos/types/metadata.ts@@ -1,6 +1,6 @@export interface Location {- latitude: number;- longitude: number;+ latitude: number | null;+ longitude: number | null;}export interface ParsedExtractedMetadata {