Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with Anki iOS app #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GarrisonBaird
Copy link

It still has some problems in media sync with iOS app, app will crash after "/msync/begin", I'm not familiar with iOS develop and don't have time to play with it.
But anyway, it gets to work. :)

GarrisonBaird added 2 commits March 4, 2017 19:54
Tested with the latest iOS client (20028.3) on iOS 10
Tested with the latest iOS client (20028.3) on iOS 10, Apache/2.4.23 (Debian)
1. Generate a self-signed CA, import it to your iOS device (warning: this may break the original CA security system, keep your CA key carefuly)
2. Sign a cert with -subj "/CN=sync.ankiweb.net", config your apache/nginx server to proxy anki-sync-server with this cert
3. Change your router's config (hosts), point sync.ankiweb.net to your server
4. Then you should be able to sync with your personal sync server! But it will only be usable under your own wifi, or you can setup a VPN as a workaround
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editing /etc/hosts on a jailbroken device might work as well, that way it would be per-device, not per-network. Note that I can't test if it actually works, since I don't have an iOS device.

Copy link
Author

@GarrisonBaird GarrisonBaird Mar 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically this will work too, this is the best way to implement on the jailbroken device. I don't have the environment to test it ether :(
But there still are some ways to implement on the non-jailbroken device: with new NetworkExtension in iOS 9.
With some custom VPN apps using NE (like Potatso, those apps are actually developped for Chinese to bypass thier firewall...), it is possible to define DNS server and/or hosts on non-jailbroken devices and keep network traffic go through as is.
I personally play in this way, it's very tricky though...... :)

@GarrisonBaird
Copy link
Author

Few days later, with many changes to my decks, I tried to debug the problem about media sync, it works well......
Maybe the problem isn't at server side, which means anki-sync-server is compatible with Anki iOS app, including media sync, cheers!

@tsudoko
Copy link
Contributor

tsudoko commented Mar 12, 2017

Shouldn't the 5th list item be removed then?

@GarrisonBaird
Copy link
Author

GarrisonBaird commented Apr 3, 2017

The problem seems still exist :(
Log from App (debug.log at Documents, can get it from iTunes)

[148****127]: ( reinit, "20028.3" )
[148****127]: ( updateCutoff, 174, 148****400 )
[148****128]: ( "Connecting..." )
[148****129]: ( reinit, "20028.3" )
[148****129]: ( updateCutoff, 174, 148****400 )
[148****129]: ( "Checking media..." )
[148****129]: ( findChanges )
[148****129]: ( "Downloading changes..." )
[148****129]: ( "last local usn in 0" )
[148****130]: ( "mediaChanges resp count: 20832" )
Then it crashes

From captured packages: (not the same session as the one above)

POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2Fmeta
POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2Fstart
POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2FapplyChanges
POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2Fchunk
POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2FapplyChunk
POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2FsanityCheck2
POST - https%3A%2F%2Fsync.ankiweb.net%2Fsync%2Ffinish
POST - https%3A%2F%2Fsync.ankiweb.net%2Fmsync%2Fbegin
POST - https%3A%2F%2Fsync.ankiweb.net%2Fmsync%2FmediaChanges
Then it crashes (Connection closed by client)


Last request body: (/msync/mediaChanges)
--Anki-sync-boundary
Content-Disposition: form-data; name="sk"

***key***
--Anki-sync-boundary
Content-Disposition: form-data; name="c"

1
--Anki-sync-boundary
Content-Disposition: form-data; name="data"; filename="data"
Content-Type: application/octet-stream

***binary***
--Anki-sync-boundary--


Last response body: (about 1.5MB)
{"data": [["*******.mp3", 24138, "********hash********"], ["*******.mp3", 24138, "********hash********"], .................., ["*******.mp3", 24138, "********hash********"]], "err": ""}

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.

2 participants