mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-22 17:16:19 -07:00
fix(dictionary): complete Hachidori imports and mining integration
This commit is contained in:
+1
-4
@@ -108,10 +108,7 @@ export function loadLauncherDictionaryBackend(): DictionaryBackend {
|
||||
}
|
||||
|
||||
export function hasLauncherExternalYomitanProfileConfig(): boolean {
|
||||
const config = readLauncherMainConfigObject();
|
||||
return (
|
||||
config?.dictionaryBackend !== 'hachidori' && readExternalYomitanProfilePath(config) !== null
|
||||
);
|
||||
return readExternalYomitanProfilePath(readLauncherMainConfigObject()) !== null;
|
||||
}
|
||||
|
||||
export function readPluginRuntimeConfig(logLevel: LogLevel): PluginRuntimeConfig {
|
||||
|
||||
@@ -1112,3 +1112,54 @@ test('classifyJellyfinChildSelection keeps container drilldown state instead of
|
||||
id: 'season-2',
|
||||
});
|
||||
});
|
||||
|
||||
test('external Yomitan profile remains available while a running app awaits a backend switch', () => {
|
||||
withTempDir((dir) => {
|
||||
const env = makeTestEnv(dir, path.join(dir, 'config'));
|
||||
const configPath = resolveConfigFilePath({
|
||||
appDataDir: env.APPDATA,
|
||||
xdgConfigHome: env.XDG_CONFIG_HOME,
|
||||
homeDir: dir,
|
||||
existsSync: () => false,
|
||||
});
|
||||
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
configPath,
|
||||
JSON.stringify({
|
||||
dictionaryBackend: 'hachidori',
|
||||
yomitan: { externalProfilePath: '/external/yomitan-profile' },
|
||||
}),
|
||||
);
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
'--eval',
|
||||
`
|
||||
import assert from 'node:assert/strict';
|
||||
import { hasLauncherExternalYomitanProfileConfig } from './launcher/config.ts';
|
||||
import { ensureLauncherSetupReady } from './launcher/setup-gate.ts';
|
||||
import { createDefaultSetupState } from './src/shared/setup-state.ts';
|
||||
for (const running of [true, false]) {
|
||||
let launches = 0;
|
||||
let tick = 0;
|
||||
const ready = await ensureLauncherSetupReady({
|
||||
dictionaryBackend: 'hachidori',
|
||||
isAppRunning: async () => running,
|
||||
readSetupState: () => ({ ...createDefaultSetupState(), dictionaryBackend: 'yomitan' }),
|
||||
isExternalYomitanConfigured: hasLauncherExternalYomitanProfileConfig,
|
||||
launchSetupApp: () => { launches += 1; },
|
||||
sleep: async () => {},
|
||||
now: () => tick++,
|
||||
timeoutMs: 2,
|
||||
pollIntervalMs: 1,
|
||||
});
|
||||
assert.equal(ready, running);
|
||||
assert.equal(launches, running ? 0 : 1);
|
||||
}
|
||||
`,
|
||||
],
|
||||
{ cwd: process.cwd(), env, encoding: 'utf8', timeout: LAUNCHER_RUN_TIMEOUT_MS },
|
||||
);
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user