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

Your client is using unsupported sync protocol (10, supported version: 9) with latest version of Anki #13

Closed
kalehmann opened this issue Jun 23, 2020 · 15 comments

Comments

@kalehmann
Copy link

How to reproduce ?

  • First I set up the latest master of the anki-sync-server
  • Then I go to apps.ankiweb.net and download the latest stable release (2.1.22).
  • After that I follow the instructions in the Readme to setup my sync server in Anki.
  • Now I hit synchronize

Expected behavior

Everything synchronizes just fine

Actual behavior

I get a dialog with the message

Your client is using unsupported sync protocol (10, supported version: 9)

Additional information

The message is issued in sync_app.py#L90

@VikashKothary
Copy link
Member

Hi, thanks for raising this issue. I've had a look at this issue.

TL;DR;

Currently Anki 2.1.22 is not officially supported by Anki Sync Server as stated in the README. That being said, there have been users who've patched it to make it work.
This needs considerable testing before it will officially be supported.

  1. Commenting lines 89 and 90 will allow the basic sync to work.
  2. Updating __init__.py should fix media sync.
import anki.sync, anki.hooks, aqt

addr = "http://127.0.0.1:27701/"
anki.sync.SYNC_BASE = "%s" + addr
aqt.mediasync.SYNC_BASE = "%s" + addr

def resetHostNum():
    aqt.mw.pm.profile['hostNum'] = None

anki.hooks.addHook("profileLoaded", resetHostNum)

NOTE: You will still get an error AnkiWeb ID or password was incorrect; please try again. You can ignore this. The sync should have worked. See this notebook to see how to read your collections.

@VikashKothary
Copy link
Member

More information for Official Fix

The problem as you stated is that the sync_app.py#L90 is blocking the sync. It is doing this because the sync version (SYN_VER) in the Anki Sync Server is 9 while the one used by your client is 10.

To fix this, we'd need to update the anki submodule to any commit after ankitects/anki@131d37d. But this is easier said than done because there has been multiple project structures changes. In the latest version of the module, the SYNC_VER constant is no longer available.

A change in the sync version is likely to indicate a breaking change. I don't quite know what this change it. Testing is needed to check which features may have been broken. Basic trial and error using the above fix does not show any issues as of yet.

@kalehmann
Copy link
Author

Hi, thanks for the input.

To fix this, we'd need to update the anki submodule to any commit after ankitects/anki@131d37d. But this is easier said than done because there has been multiple project structures changes. In the latest version of the module, the SYNC_VER constant is no longer available.

I am still interested in patching the code to work with the latest version of the anki codebase. I will update this issue in the next few days with a summary of all the components needed by the sync server, that have moved form the python to the rust codebase.

Hopefully I can then provide a pull request that works with the latest version of anki. In my opinion this is necessary for this project to survive in the long term.

@VikashKothary
Copy link
Member

Hi @kalehmann,

That would be amazing if you could. I totally agree with you in the keeping this project in sync with the latest versions of Anki client is key to the success of this project.

I've created a new issue for the upgrade (see #16). I'd be interested to see what you come up with.

@bartowski-l
Copy link

i have a problem desktop app 2.1.22 always show user or passwd wrong and retry . the others is be ok ,but this session when i shut the app it will show . i can't find how to fix it?who can help me ? thank you

@VikashKothary
Copy link
Member

Hi @bartowski-l,

So this is an known issue that hasn't been fixed as it does not stop the actual sync functionality of the sync server. See below:

NOTE: You will still get an error AnkiWeb ID or password was incorrect; please try again. You can ignore this. The sync should have worked. See this notebook to see how to read your collections.

I know it may be annoying but officially the latest clients aren't supported. A possible fix, if you don't want to see the message, maybe to use an older Anki client. See below:

The currently supported version range is 2.1.1〜2.1.11, with the exception of 2.1.9

Hopefully this helps.

@kalehmann
Copy link
Author

Hi @bartowski-l,
I am still working on patching anki-sync-server to work with the latest version of Anki. During this work I will also try to patch the message you are mentioning.

@kalehmann
Copy link
Author

kalehmann commented Aug 25, 2020

I am making progress on this issue. My current target is to get the sync-server working with Anki 2.1.26, without any client side errors or notifications.

Newer versions of Anki are currently excluded because of #19.

@AntonOfTheWoods
Copy link
Contributor

AntonOfTheWoods commented Aug 26, 2020

Newer versions of Anki are currently excluded because of #19.

It turns out #19 is a bit of a non-issue (see my comment to that issue) - the addon will do less and it will be a little less flexible but it will be quite easy to create platform-dependent application launch links so that you can point to a custom sync server.

That obviously doesn't solve any of our other issues with compatibility though - I just think it's important to know that we can still easily (without forking) run untouched upstream Anki against our own server implementations.

@kalehmann
Copy link
Author

kalehmann commented Aug 28, 2020

I now have a version of anki-sync-server working with the latest version of Anki and decide to make the changes public: #20.

@kalehmann
Copy link
Author

As #20 is now merged, this issue can be closed

@update-freak
Copy link

Is the docker container really up to date on the URL kuklinistvan/anki-sync-server:latest ?
I got the same error measage.

@kalehmann
Copy link
Author

kalehmann commented Jan 10, 2024

I moved away from this anki sync server implementation, so I probably won't be able to help you out much.

However, I checked the image you provided and it seems like the contents have been last updated in February or August of 2020:

$ docker pull kuklinistvan/anki-sync-server
$ docker run -it --entrypoint=/bin/sh kuklinistvan/anki-sync-server
/app/anki-sync-server # ls -lah
total 68
drwxr-xr-x    1 root     root         254 Aug 26  2020 .
drwxr-xr-x    1 root     root          66 Aug 26  2020 ..
-rw-r--r--    1 root     root          51 Feb  6  2020 .git
-rw-r--r--    1 root     root          54 Feb  6  2020 .gitignore
-rw-r--r--    1 root     root          87 Feb  6  2020 .gitmodules
-rw-r--r--    1 root     root       33.7K Feb  6  2020 COPYING
-rw-r--r--    1 root     root        6.4K Feb  6  2020 README.md
drwxr-xr-x    1 root     root          44 Feb  6  2020 addon
drwxr-xr-x    1 root     root         440 Feb  6  2020 anki-bundled
-rwxr-xr-x    1 root     root        2.1K Feb  6  2020 ankisyncctl.py
drwxr-xr-x    1 root     root         190 Feb  6  2020 ankisyncd
lrwxrwxrwx    1 root     root          24 Aug 26  2020 ankisyncd.conf -> /app/data/ankisyncd.conf
-rw-r--r--    1 root     root         884 Feb  6  2020 ankisyncd.conf.example
drwxr-xr-x    1 root     root         386 Feb  6  2020 tests
drwxr-xr-x    1 root     root          44 Feb  6  2020 utils

Since my pull request #20 has been merged in September 2020, my changes are missing in the image you provided.

However, you can build your own docker image from the current state of the repository at any time with:

$ git clone https://github.com/ankicommunity/anki-sync-server.git
$ cd anki-sync-server
$ docker build -t anki-sync-server .

@update-freak
Copy link

Thank you with your idea to create it via the commands.
I tried it and got this error message when I try to login via AnkiDroid:

log.txt

@LuckyTurtleDev
Copy link
Contributor

see also #158

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

No branches or pull requests

6 participants