Make the addon modify anki.sync.SYNC_BASE
This commit is contained in:
parent
00ec46eab3
commit
32a81dc028
@ -5,7 +5,6 @@ import aqt
|
||||
import anki.consts
|
||||
import anki.sync
|
||||
|
||||
ORIG_SYNC_BASE = anki.consts.SYNC_BASE
|
||||
DEFAULT_ADDR = "http://localhost:27701/"
|
||||
config = aqt.mw.addonManager.getConfig(__name__)
|
||||
|
||||
@ -44,9 +43,9 @@ def updateserver(self, text):
|
||||
if config['enabled']:
|
||||
addr = text or self.customServerAddr.placeholderText()
|
||||
config['addr'] = addr
|
||||
anki.consts.SYNC_BASE = addr + "%s"
|
||||
anki.sync.SYNC_BASE = addr + "%s"
|
||||
else:
|
||||
anki.consts.SYNC_BASE = ORIG_SYNC_BASE
|
||||
anki.sync.SYNC_BASE = anki.consts.SYNC_BASE
|
||||
aqt.mw.addonManager.writeConfig(__name__, config)
|
||||
|
||||
def updateui(self, state):
|
||||
@ -54,5 +53,5 @@ def updateui(self, state):
|
||||
self.customServerAddr.setEnabled(state == Qt.Checked)
|
||||
|
||||
if config['enabled']:
|
||||
anki.consts.SYNC_BASE = config['addr'] + "%s"
|
||||
anki.sync.SYNC_BASE = config['addr'] + "%s"
|
||||
aqt.preferences.Preferences.__init__ = wrap(aqt.preferences.Preferences.__init__, addui, "after")
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
[sync_app]
|
||||
# change to 127.0.0.1 if you don't want the server to be accessible from the internet
|
||||
host = 0.0.0.0
|
||||
host = 127.0.0.1
|
||||
port = 27701
|
||||
data_root = ./collections
|
||||
data_root = /home/flan/.local/share/ankisyncd/
|
||||
base_url = /sync/
|
||||
base_media_url = /msync/
|
||||
auth_db_path = ./auth.db
|
||||
auth_db_path = /home/flan/.local/share/ankisyncd/auth.db
|
||||
# optional, for session persistence between restarts
|
||||
session_db_path = ./session.db
|
||||
session_db_path = /home/flan/.local/share/ankisyncd/session.db
|
||||
|
||||
Loading…
Reference in New Issue
Block a user