mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-10 03:13:32 -07:00
fix(anki): honor runtime AnkiConnect URL override in Open in Anki fallba
- Use getEffectiveAnkiConnectConfig for fallback client URL resolution - Fall back to DEFAULT_CONFIG.ankiConnect.url when effective URL is unset
This commit is contained in:
+7
-1
@@ -3491,7 +3491,13 @@ async function openAnkiCardFromNotification(noteId: number): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const fallbackClient = new AnkiConnectClient(getResolvedConfig().ankiConnect.url);
|
||||
const resolvedConfig = getResolvedConfig();
|
||||
const effectiveAnkiConfig =
|
||||
appState.runtimeOptionsManager?.getEffectiveAnkiConnectConfig(resolvedConfig.ankiConnect) ??
|
||||
resolvedConfig.ankiConnect;
|
||||
const fallbackClient = new AnkiConnectClient(
|
||||
effectiveAnkiConfig.url || DEFAULT_CONFIG.ankiConnect.url,
|
||||
);
|
||||
await fallbackClient.openNoteInBrowser(noteId);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,8 @@ test('update overlay notification action triggers install flow', () => {
|
||||
assert.match(source, /installWhenAvailable:\s*true/);
|
||||
assert.match(source, /actionId === OPEN_ANKI_CARD_ACTION_ID && noteId !== undefined/);
|
||||
assert.match(source, /appState\.ankiIntegration\?\.openNoteInAnki\(noteId\)/);
|
||||
assert.match(source, /new AnkiConnectClient\(getResolvedConfig\(\)\.ankiConnect\.url/);
|
||||
assert.match(source, /appState\.runtimeOptionsManager\?\.getEffectiveAnkiConnectConfig/);
|
||||
assert.match(source, /new AnkiConnectClient\(\s*effectiveAnkiConfig\.url \|\| DEFAULT_CONFIG\.ankiConnect\.url/);
|
||||
assert.match(source, /fallbackClient\.openNoteInBrowser\(noteId\)/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user