This commit is contained in:
恍兮惚兮 2025-01-08 22:57:07 +08:00
parent 195bcefaa1
commit 63e5dfd27b
3 changed files with 4 additions and 1 deletions

View File

@ -768,6 +768,7 @@ class AnkiWindow(QWidget):
autoUpdateModel = globalconfig["ankiconnect"]["autoUpdateModel"] autoUpdateModel = globalconfig["ankiconnect"]["autoUpdateModel"]
allowDuplicate = globalconfig["ankiconnect"]["allowDuplicate"] allowDuplicate = globalconfig["ankiconnect"]["allowDuplicate"]
anki.global_port = globalconfig["ankiconnect"]["port"] anki.global_port = globalconfig["ankiconnect"]["port"]
anki.global_host = globalconfig["ankiconnect"]["host"]
ModelName = globalconfig["ankiconnect"]["ModelName6"] ModelName = globalconfig["ankiconnect"]["ModelName6"]
try: try:
DeckName = globalconfig["ankiconnect"]["DeckNameS"][ DeckName = globalconfig["ankiconnect"]["DeckNameS"][

View File

@ -1,6 +1,7 @@
import requests import requests
global_port = 999 global_port = 999
global_host = "127.0.0.1"
class AnkiException(Exception): class AnkiException(Exception):
@ -13,7 +14,7 @@ class AnkiModelExists(AnkiException):
def invoke(action, **params): def invoke(action, **params):
response = requests.get( response = requests.get(
"http://127.0.0.1:{}".format(global_port), "http://{}:{}".format(global_host, global_port),
json={"action": action, "params": params, "version": 6}, json={"action": action, "params": params, "version": 6},
).json() ).json()
if len(response) != 2: if len(response) != 2:

View File

@ -465,6 +465,7 @@
"is_tracetime_strict": true, "is_tracetime_strict": true,
"jiamingcolor": "black", "jiamingcolor": "black",
"ankiconnect": { "ankiconnect": {
"host": "127.0.0.1",
"port": 8765, "port": 8765,
"DeckName_i": 0, "DeckName_i": 0,
"DeckNameS": [ "DeckNameS": [