Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@coughlanio
Copy link

@coughlanio coughlanio commented Aug 6, 2025

What is the purpose of this change?

This PR adds iCloud Photos support to the existing iclouddrive backend, creating a unified iCloud backend that allows users to access both iCloud Drive and iCloud Photos through a single backend with service selection.

Key changes:

  • Unified Backend: Users can now select "Drive" or "Photos" when configuring the iclouddrive backend, eliminating the need for a separate icloudphotos backend
  • Shared Authentication: Both services use the same authentication flow and session management, reducing code duplication
  • Photos Functionality: Full read-only access to iCloud Photos including:
    • Library and album listing with accurate file counts
    • Smart albums support (All Photos, Videos, Favorites, etc.)
    • Photo and video downloading with range request support
    • Proper metadata handling (file sizes, modification times)
  • Clean Architecture: Router-based design that delegates to service-specific implementations while maintaining separation of concerns
  • Backward Compatibility: Existing iclouddrive configurations continue to work unchanged (defaults to Drive service)

Technical Implementation:

  • Added service configuration option to select between "drive" and "photos"
  • Created icloud.go as the main router handling authentication and service routing
  • Added Photos implementation to icloudphotos.go within the iclouddrive package
  • Shared API client code between Drive and Photos (api/client.go, api/session.go)

Was the change discussed in an issue or in the forum before?

#7982

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@coughlanio
Copy link
Author

Recent updates since yesterday:

Architecture improvements:

  • Integrated the code into the existing iclouddrive backend with a new configuration option to toggle between iCloud Drive and iCloud Photos modes during setup. This approach aligns with previous discussions in the project—though we might want to consider renaming the backend to simply icloud at some point.
  • Added DirCache functionality for better performance.

API challenges (the joys of undocumented APIs!):

  • Running into some inconsistent behavior—I can successfully retrieve user albums but can't fetch photos from within those albums. Shared albums also aren't appearing as expected.
  • Discovered a sync issue where the reported photo count doesn't match what actually downloads. For example, my "All Photos" album shows 2,686 photos via API call, but only ~2,512 actually sync (interestingly, my iPhone's Photos app shows 2,685). The discrepancy seems related to duplicate detection:
    2025/08/06 22:27:21 NOTICE: All Photos/IMG_3731.HEIC: Duplicate object found in source - ignoring
    This duplicate handling behavior could be problematic and needs a workaround.

I'm continuing to test and refine these issues.

@voltagex
Copy link

voltagex commented Oct 4, 2025

I don't know if this helps but I have noticed some of the same duplication if you request your photos via data and privacy from Apple

@fschoenfeldt
Copy link

@coughlanio

Thanks for your work! 🚀

Out of curiosity: does this add support for also uploading photos and if not, do you plan adding it here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.