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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user