Harden Yomitan settings open flow for external profile mode

- Return status from `openYomitanSettings` and show user-facing warning when external read-only profile mode blocks settings
- Thread `yomitanSession` through settings runtime/opener deps so settings window uses the active session
- Expand tests for session forwarding and external profile path propagation
- Move AniList setup/token/CLI docs into the AniList section in configuration docs
This commit is contained in:
2026-03-11 18:32:16 -07:00
parent a64af69365
commit 504793eaed
8 changed files with 84 additions and 41 deletions

View File

@@ -1,5 +1,6 @@
type YomitanExtensionLike = unknown;
type BrowserWindowLike = unknown;
type SessionLike = unknown;
export function createOpenYomitanSettingsHandler(deps: {
ensureYomitanExtensionLoaded: () => Promise<YomitanExtensionLike | null>;
@@ -7,10 +8,12 @@ export function createOpenYomitanSettingsHandler(deps: {
yomitanExt: YomitanExtensionLike;
getExistingWindow: () => BrowserWindowLike | null;
setWindow: (window: BrowserWindowLike | null) => void;
yomitanSession?: SessionLike | null;
onWindowClosed?: () => void;
}) => void;
getExistingWindow: () => BrowserWindowLike | null;
setWindow: (window: BrowserWindowLike | null) => void;
getYomitanSession?: () => SessionLike | null;
logWarn: (message: string) => void;
logError: (message: string, error: unknown) => void;
}) {
@@ -25,6 +28,7 @@ export function createOpenYomitanSettingsHandler(deps: {
yomitanExt: extension,
getExistingWindow: deps.getExistingWindow,
setWindow: deps.setWindow,
yomitanSession: deps.getYomitanSession?.() ?? null,
});
})().catch((error) => {
deps.logError('Failed to open Yomitan settings window.', error);