Make hostNum empty when changing sync server

Should fix an error encountered when the user used AnkiWeb in the
past and receives a JSON decode error because an unrecognized
endpoint (/[somenumber]sync instead of /sync) doesn't return what
the client expects.

Closes #10, fixes #8.
This commit is contained in:
flan
2018-12-24 16:04:26 +01:00
parent 32a81dc028
commit 360b2d08ed
2 changed files with 12 additions and 4 deletions

View File

@@ -58,10 +58,13 @@ Create a new directory in `~/Anki/addons21` (name it something like ankisyncd),
create a file named `__init__.py` containing the code below and put it in
`~/Anki/addons21/ankisyncd`.
import anki.sync
import anki.sync, anki.hooks, aqt
addr = "http://127.0.0.1:27701/" # put your server address here
anki.sync.SYNC_BASE = addr + "%s"
def resetHostNum():
aqt.mw.pm.profile['hostNum'] = None
anki.hooks.addHook("profileLoaded", resetHostNum)
### Anki 2.0