rclone icon indicating copy to clipboard operation
rclone copied to clipboard

Add iCloud GCBD (China Mainland) Option in iCloud Drive backend

Open BingoKingo opened this issue 1 year ago • 14 comments

          > Hi, I got these when using a Apple ID (cn) 

NOTICE: Fatal error: HTTP error 302 (302 Found) returned body: "{\"domainToUse\":\"iCloud.com.cn\"}"

CRITICAL: Failed to create file system for "iCloud:": missing icloud trust token: try refreshing it with "rclone config reconnect iCloud:"

Any progress?

china right? not supported right now (china uses a different server)

could you create an issue for this? will add it soon

Originally posted by @lostb1t in https://github.com/rclone/rclone/issues/7717#issuecomment-2555260059

BingoKingo avatar Dec 19 '24 19:12 BingoKingo

Same problem when using the v1.69.1 version, try to update the url by adding ".cn" in each url in the file with "https://github.com/rclone/rclone/blob/master/backend/iclouddrive/api/client.go", ''' const ( baseEndpoint = "https://www.icloud.com" homeEndpoint = "https://www.icloud.com" setupEndpoint = "https://setup.icloud.com/setup/ws/1" authEndpoint = "https://idmsa.apple.com/appleauth/auth" ) ''', However, the go build command didn't go well, as it needs to download massive package from internet, and my connection is unstable. Can someone could fix it. Thank you very much

wcumsjy avatar Feb 15 '25 16:02 wcumsjy

@wcumsjy I updated all the urls to .cn ones. I don't know if it will work - please report back!

v1.70.0-beta.8597.7f715befb.fix-8257-iclouddrive-cn on branch fix-8257-iclouddrive-cn (uploaded in 15-30 mins)

ncw avatar Feb 15 '25 16:02 ncw

@ncw Dear Nick, thank you very much for your timely feedback and for quickly compiling the new version. However, I regret to inform you that my computer has an x86 architecture and cannot execute the arm64 version. I was wondering if you have an x86 version available? If so, I can try testing it immediately. “rclone v1.69.1

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 6.8.0-53-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.24.0
  • go/linking: static
  • go/tags: none ”

wcumsjy avatar Feb 15 '25 17:02 wcumsjy

@ncw Dear Nick, I confirmed that I can connect and mount the iCloud to my Unbuntu through this version with my China iCloud account! BIG THANKS TO YOU!!!

"~$ rclone version rclone v1.70.0-beta.8597.7f715befb.fix-8257-iclouddrive-cn

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 6.8.0-53-generic (x86_64)
  • os/type: linux
  • os/arch: 386
  • go/version: go1.24.0
  • go/linking: static
  • go/tags: none "

wcumsjy avatar Feb 15 '25 17:02 wcumsjy

failed with 1 errors and: corrupted on transfer: sizes differ src() 10679453 vs dst(Local file system at /Users/admin/Downloads) 10501687 rclone was able to list the file but got the wrong file size.

BingoKingo avatar Feb 16 '25 07:02 BingoKingo

We probably need @lostb1t to do this properly, but I thought it would be interesting to do an experiment to see if changing the URLs was enough or not.

@BingoKingo what kind of file was that? Do any fillers transfer ok?

ncw avatar Feb 16 '25 07:02 ncw

rclone works fine with most files. This issue can be closed.

It's a new problem with iWork files generated or modified by iWork Web and it can be reproduced on iCloud backend. Just create any file through iWork Web, and then download it using rclone.

BingoKingo avatar Feb 16 '25 08:02 BingoKingo

@BingoKingo

rclone works fine with most files. This issue can be closed.

Is that with the patched rclone with the .cn domain names I linked above?

It's a new problem with iWork files generated or modified by iWork Web and it can be reproduced on iCloud backend. Just create any file through iWork Web, and then download it using rclone.

ncw avatar Feb 17 '25 20:02 ncw

Yes, .cn domain patch works well.

BingoKingo avatar Feb 18 '25 13:02 BingoKingo

Great. I'll re-open this as we need to merge the fix (and likely do it a bit better!)

ncw avatar Feb 19 '25 20:02 ncw

failed with 1 errors and: corrupted on transfer: sizes differ src() 10679453 vs dst(Local file system at /Users/admin/Downloads) 10501687 rclone was able to list the file but got the wrong file size.

rclone ls is working well, no error for me

xz-dev avatar Mar 05 '25 11:03 xz-dev

Great. I'll re-open this as we need to merge the fix (and likely do it a bit better!)

Maybe simply add a CN option in config?

If everyone is busy, maybe I can try to write a PR

xz-dev avatar Mar 05 '25 11:03 xz-dev

太好了。我会重新打开这个,因为我们需要合并修复程序(而且可能会做得更好!)

Oh, I really need this feature now.

Kbstsn avatar May 10 '25 15:05 Kbstsn

@wcumsjy I updated all the urls to .cn ones. I don't know if it will work - please report back!

v1.70.0-beta.8597.7f715befb.fix-8257-iclouddrive-cn on branch fix-8257-iclouddrive-cn (uploaded in 15-30 mins)

When will this feature be merged into master?

Kbstsn avatar May 13 '25 13:05 Kbstsn

Is it possible to add a configuration item for users to set the address of iCloud?

chuxubank avatar Jun 22 '25 00:06 chuxubank

please help to merge this patch, thanks

powerLambda avatar Jul 06 '25 13:07 powerLambda

If that patch worked (I have no way of testing) then someone needs to turn it into a config option. So maybe a region which could be global or china and that should change the 4 URLS in use. These will need to be variables instead of const like they are at the moment.

I don't think it would be too hard if someone wants to have a go.

ncw avatar Jul 06 '25 14:07 ncw