π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
chore(xmp):add-internalUser-flag
Aswin Asokf2fdf1533125
diff --git a/desktop/changes/apple-photos-xmp-sidecars.md b/desktop/changes/apple-photos-xmp-sidecars.mdindex 9eecb0caff..48e322eae5 100644--- a/desktop/changes/apple-photos-xmp-sidecars.md+++ b/desktop/changes/apple-photos-xmp-sidecars.md@@ -1 +1 @@-- Added support for reading Apple Photos XMP sidecar files during folder and ZIP imports, preserving dates, locations, and captions.+- (i) Added support for importing Apple Photos folders with XMP sidecars, preserving dates, locations, and captions.diff --git a/docs/docs/photos/faq/migration.md b/docs/docs/photos/faq/migration.mdindex d8cd7411d9..a478cc80de 100644--- a/docs/docs/photos/faq/migration.md+++ b/docs/docs/photos/faq/migration.md@@ -233,34 +233,32 @@ This only applies to partner-shared photos that Google included in your Takeout.### Why is it recommended to migrate Apple Photos from mobile? {#why-migrate-apple-photos-from-mobile}-It is highly recommended to import from Apple Photos via mobile rather than desktop, as desktop import requires a manual export with XMP sidecars and sequential naming for Live Photos.+It is highly recommended to import from Apple Photos via mobile rather than desktop, as mobile upload preserves metadata, while desktop upload may lose metadata (reason stated [below](#can-i-import-apple-photos-via-desktop)), requires manual export and sequential naming for live photos.### Can I import Apple Photos via desktop? {#can-i-import-apple-photos-via-desktop}-Importing via the mobile app remains the easiest option.+It is highly recommended to import from Apple Photos via mobile rather than desktop.-Some photos lack EXIF metadata embedded directly within the image file. Apple Photos can export this metadata, including corrections made in the app, into separate `.xmp` sidecar files instead of rewriting the original file.+Some photos may not have EXIF metadata embedded directly within the image file. In these cases, Apple Photos exports metadata into separate `.XMP` sidecar files instead of writing it into the photo itself.-The desktop and web apps read these sidecars during manual folder imports, and the desktop app also reads them during ZIP imports, preserving capture dates with timezone offsets, locations, and captions.+Currently, the desktop app does not read metadata from separate XMP sidecar files - it can only recognize metadata that is embedded within the file.-If you need to import manually, follow the steps below:+We recommend to upload the photos using the iPhone app as iOS exports typically include embedded metadata, which ensures dates and other details are preserved correctly.++However, for any reason, if desktop is the only way to import, you can follow the steps below:#### 1. Export your data from the Apple Photos app.Select the files you want to export (`Command + A` to select them all), and click on `File` > `Export` > `Export Unmodified Originals`.-In the dialog that pops up, select File Name as `Sequential`, provide any prefix you'd like, and select **Export IPTC as XMP**. Sequential names ensure that we combine the photo and video portions of your Live Photos correctly. The XMP option writes one `.xmp` file next to each photo, which Ente uses for the date, location, and caption.+In the dialog that pops up, select File Name as `Sequential` and provide any prefix you'd like. This is to make sure that we combine the photo and video portions of your Live Photos correctly.Finally, choose an export directory and confirm by clicking `Export Originals`. You will receive a notification from the app once your export is complete.#### 2. Import into Ente-Alternatively, open the uploader, click **Apple Photos** under **Import from**, and select the exported folder; the screen repeats these export steps.-Now simply drag and drop the downloaded folders into [our desktop app](https://ente.com/download/desktop) and grab a cup of coffee (or a good night's sleep, depending on the size of your library) while we handle the rest.-Keep the `.xmp` files alongside the photos in the same folder when you drag it in; they are read and are not uploaded as separate files.-> Note: In case your uploads get interrupted, just drag and drop the folders into the same albums again, and we will ignore already backed up files and upload just the rest.## Importing from other cloud servicesdiff --git a/web/apps/photos/src/components/TakeoutOptions.tsx b/web/apps/photos/src/components/TakeoutOptions.tsxindex 009b98dfd8..3dc2eac9ce 100644--- a/web/apps/photos/src/components/TakeoutOptions.tsx+++ b/web/apps/photos/src/components/TakeoutOptions.tsx@@ -77,15 +77,15 @@ export function TakeoutOptions({<ArrowBackIcon sx={{ fontSize: "24px" }} /></IconButton><Typography sx={optionsTitleSx}>- {t(- provider == "apple"- ? isSheet- ? "apple_photos"- : "import_from_apple_photos"- : isSheet- ? "google_takeout"- : "import_from_google_photos",- )}+ {provider == "apple"+ ? isSheet+ ? "Apple Photos"+ : "Import from Apple Photos"+ : t(+ isSheet+ ? "google_takeout"+ : "import_from_google_photos",+ )}</Typography></Stack><IconButton@@ -109,16 +109,16 @@ export function TakeoutOptions({<Stack sx={{ gap: 1 }}><TakeoutOptionButtonicon={<HugeiconsIcon icon={Folder01Icon} size={18} />}- label={t(+ label={provider == "apple"- ? "exported_folder"- : "unzipped_folder",- )}- description={t(+ ? "Exported folder"+ : t("unzipped_folder")+ }+ description={provider == "apple"- ? "apple_export_folder_hint"- : "unzipped_folder_hint",- )}+ ? "Select the folder exported from Photos"+ : t("unzipped_folder_hint")+ }pending={isFolderSelectionPending}onClick={onSelectFolder}/>@@ -175,9 +175,9 @@ export function TakeoutOptions({function AppleExportSteps(): React.JSX.Element {const steps = [- t("apple_export_step_1"),- t("apple_export_step_2"),- t("apple_export_step_3"),+ "In Photos, select your photos and choose File > Export > Export Unmodified Originals",+ "Set File Name to Sequential so Live Photos pair correctly",+ "Select Export IPTC as XMP so dates, locations, and captions come along",];return (diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsxindex 95e3023728..80f15789ae 100644--- a/web/apps/photos/src/components/Upload.tsx+++ b/web/apps/photos/src/components/Upload.tsx@@ -76,6 +76,7 @@ import { hasReliableCanvasReadback } from "ente-gallery/utils/upload/canvas-inteimport { CollectionSubType, type Collection } from "ente-media/collection";import type { EnteFile } from "ente-media/file";import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";+import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";import { suppressAutoLockOnBlurForTrustedPrompt } from "ente-new/photos/services/app-lock";import {addOrCopyToCollection,@@ -166,10 +167,12 @@ type UploadConfirmationState =const importSourceHint = (uploadItemAndPaths: UploadItemAndPath[],+ isInternalUser: boolean,): ImportSource =>uploadItemAndPaths.some(([, path]) => lowercaseExtension(path) == "json")? "google-takeout"- : uploadItemAndPaths.some(+ : isInternalUser &&+ uploadItemAndPaths.some(([, path]) => lowercaseExtension(path) == "xmp",)? "apple-photos"@@ -190,6 +193,7 @@ export const Upload: React.FC<UploadProps> = ({}) => {const { showMiniDialog, onGenericError } = useBaseContext();const { showNotification, watchFolderView } = usePhotosAppContext();+ const { isInternalUser } = useSettingsSnapshot();const [uploadProgressView, setUploadProgressView] = useState(false);const [@@ -678,7 +682,7 @@ export const Upload: React.FC<UploadProps> = ({) => {if (uploadItemsAndPaths.current !== uploadItemAndPaths) return;- const hint = importSourceHint(uploadItemAndPaths);+ const hint = importSourceHint(uploadItemAndPaths, isInternalUser);if (uploadItemAndPaths.length > 1 || hint != "generic")setUploadConfirmation({ phase: "counting", importSource: hint });@@ -777,7 +781,7 @@ export const Upload: React.FC<UploadProps> = ({}: NewCollectionsOptions = {},) => {const uploadItemAndPaths = uploadItemsAndPaths.current;- const hint = importSourceHint(uploadItemAndPaths);+ const hint = importSourceHint(uploadItemAndPaths, isInternalUser);if (!skipConfirmation &&(uploadItemAndPaths.length > 1 || hint != "generic")@@ -1212,6 +1216,7 @@ export const Upload: React.FC<UploadProps> = ({open={props.uploadTypeSelectorView}onClose={props.closeUploadTypeSelector}intent={props.uploadTypeSelectorIntent}+ isInternalUser={isInternalUser}pendingUploadType={isInputPending ? selectedUploadType.current : undefined}@@ -1485,6 +1490,7 @@ const setPendingUploads = async (type UploadTypeSelectorProps = ModalVisibilityProps & {intent: UploadTypeSelectorIntent;+ isInternalUser: boolean;pendingUploadType: UploadType | undefined;onSelect: (type: UploadType) => void;};@@ -1493,6 +1499,7 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({open,onClose,intent,+ isInternalUser,pendingUploadType,onSelect,}) => {@@ -1551,7 +1558,13 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({}}><UploadOptions- {...{ intent, pendingUploadType, onSelect, onClose }}+ {...{+ intent,+ isInternalUser,+ pendingUploadType,+ onSelect,+ onClose,+ }}/></Dialog>);@@ -1559,21 +1572,24 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({type UploadOptionsProps = Pick<UploadTypeSelectorProps,- "onClose" | "intent" | "pendingUploadType" | "onSelect"+ "onClose" | "intent" | "isInternalUser" | "pendingUploadType" | "onSelect">;const UploadOptions: React.FC<UploadOptionsProps> = ({intent,+ isInternalUser,pendingUploadType,onSelect,onClose,}) => {// Keep dialog state in this child so it resets when the dialog closes.const [provider, setProvider] = useState<"google" | "apple">();+ const selectedProvider =+ provider == "apple" && !isInternalUser ? undefined : provider;- return provider ? (+ return selectedProvider ? (<TakeoutOptions- provider={provider}+ provider={selectedProvider}isFolderSelectionPending={pendingUploadType == "folders"}onBack={() => setProvider(undefined)}onSelectFolder={() => onSelect("folders")}@@ -1588,7 +1604,9 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({onSelectFiles={() => onSelect("files")}onSelectFolder={() => onSelect("folders")}onSelectGooglePhotos={() => setProvider("google")}- onSelectApplePhotos={() => setProvider("apple")}+ {...(isInternalUser && {+ onSelectApplePhotos: () => setProvider("apple"),+ })}{...{ onClose }}/>);diff --git a/web/apps/photos/src/components/UploadConfirmationDialog.tsx b/web/apps/photos/src/components/UploadConfirmationDialog.tsxindex e49ff7f9de..bc8327c1a9 100644--- a/web/apps/photos/src/components/UploadConfirmationDialog.tsx+++ b/web/apps/photos/src/components/UploadConfirmationDialog.tsx@@ -82,11 +82,9 @@ export function UploadConfirmationDialog({: "import_from_google_photos",): importSource == "apple-photos"- ? t(- isSheet- ? "apple_photos"- : "import_from_apple_photos",- )+ ? isSheet+ ? "Apple Photos"+ : "Import from Apple Photos": t("upload_to_ente")}</Typography><Stack direction="row" sx={headerActionsSx}>diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.tsindex 8606ec1342..89c0c67af5 100644--- a/web/apps/photos/src/services/upload-manager.ts+++ b/web/apps/photos/src/services/upload-manager.ts@@ -705,7 +705,7 @@ const tryParseMetadataItem = async (const metadata =extension == "json"? await tryParseTakeoutMetadataJSON(uploadItem!)- : extension == "xmp"+ : extension == "xmp" && settingsSnapshot().isInternalUser? await tryParseXMPSidecar(uploadItem!): undefined;if (!metadata) return undefined;diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.jsonindex 967700711d..c013618489 100644--- a/web/packages/base/locales/en-US/translation.json+++ b/web/packages/base/locales/en-US/translation.json@@ -87,13 +87,6 @@"desktop_only": "Desktop only","takeout_help_prompt": "Still have questions?","takeout_help_action": "We're here to help",- "apple_photos": "Apple Photos",- "import_from_apple_photos": "Import from Apple Photos",- "exported_folder": "Exported folder",- "apple_export_folder_hint": "Select the folder exported from Photos",- "apple_export_step_1": "In Photos, select your photos and choose File > Export > Export Unmodified Originals",- "apple_export_step_2": "Set File Name to Sequential so Live Photos pair correctly",- "apple_export_step_3": "Select Export IPTC as XMP so dates, locations, and captions come along","upload_to_ente": "Upload to Ente","calculating_title": "Calculating Files","calculating_takeout_description": "We're scanning your files to count what can be imported. This usually takes under a minute.",diff --git a/web/packages/gallery/components/upload/DefaultOptions.tsx b/web/packages/gallery/components/upload/DefaultOptions.tsxindex afa8bb819f..ebc3755be6 100644--- a/web/packages/gallery/components/upload/DefaultOptions.tsx+++ b/web/packages/gallery/components/upload/DefaultOptions.tsx@@ -32,7 +32,7 @@ type DefaultOptionsProps = DefaultOptionsBaseProps &(| {intent: UploadTypeSelectorIntent;- onSelectApplePhotos: () => void;+ onSelectApplePhotos?: () => void;onSelectGooglePhotos: () => void;}| {@@ -132,7 +132,7 @@ export function DefaultOptions({type ImportOptionsProps = Pick<DefaultOptionsBaseProps,"isFolderSelectionPending" | "onSelectFolder"-> & { onSelectApplePhotos: () => void; onSelectGooglePhotos: () => void };+> & { onSelectApplePhotos?: () => void; onSelectGooglePhotos: () => void };function ImportOptions({isFolderSelectionPending,@@ -155,15 +155,17 @@ function ImportOptions({label={t("google_photos")}onClick={onSelectGooglePhotos}/>- <ImportProviderButton- icon={- <AppleIcon- sx={{ color: "text.muted", fontSize: 22 }}- />- }- label={t("apple_photos")}- onClick={onSelectApplePhotos}- />+ {onSelectApplePhotos ? (+ <ImportProviderButton+ icon={+ <AppleIcon+ sx={{ color: "text.muted", fontSize: 22 }}+ />+ }+ label="Apple Photos"+ onClick={onSelectApplePhotos}+ />+ ) : null}</Stack></ImportSection><ImportSection title={t("upload_from")}>@@ -194,7 +196,7 @@ type UploadOptionsProps = Pick<| "isFolderSelectionPending"| "onSelectFiles"| "onSelectFolder"-> & { onSelectApplePhotos: () => void; onSelectGooglePhotos: () => void };+> & { onSelectApplePhotos?: () => void; onSelectGooglePhotos: () => void };function UploadOptions({isFileSelectionPending,@@ -247,15 +249,20 @@ function UploadOptions({label={t("google_takeout")}onClick={onSelectGooglePhotos}/>- <OptionRowButton- icon={- <AppleIcon- sx={{ color: "text.muted", fontSize: "20px" }}- />- }- label={t("apple_photos")}- onClick={onSelectApplePhotos}- />+ {onSelectApplePhotos ? (+ <OptionRowButton+ icon={+ <AppleIcon+ sx={{+ color: "text.muted",+ fontSize: "20px",+ }}+ />+ }+ label="Apple Photos"+ onClick={onSelectApplePhotos}+ />+ ) : null}</Stack></ImportSection></Stack>