mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-26 04:46:07 -08:00
feat(jimaku): auto-open modal when a video has no Japanese subtitle (#319)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ivan Melck <ivan@spec-kitty.ai>
This commit is contained in:
24 files changed
+907
-22
No files matched your search
@@ -57,3 +57,18 @@ test('resolveConfig warns for invalid mpv launch mode', () => {
|
||||
message: "Expected one of: 'normal', 'maximized', 'fullscreen'.",
|
||||
});
|
||||
});
|
||||
|
||||
test('resolveConfig parses the Jimaku auto-open toggle and warns on non-boolean values', () => {
|
||||
const enabled = resolveConfig({ jimaku: { autoOpenWhenPrimarySubtitleMissing: true } });
|
||||
assert.equal(enabled.resolved.jimaku.autoOpenWhenPrimarySubtitleMissing, true);
|
||||
assert.deepEqual(enabled.warnings, []);
|
||||
|
||||
const invalid = resolveConfig({
|
||||
jimaku: { autoOpenWhenPrimarySubtitleMissing: 'sometimes' as never },
|
||||
});
|
||||
assert.equal(invalid.resolved.jimaku.autoOpenWhenPrimarySubtitleMissing, false);
|
||||
assert.deepEqual(
|
||||
invalid.warnings.map((warning) => warning.path),
|
||||
['jimaku.autoOpenWhenPrimarySubtitleMissing'],
|
||||
);
|
||||
});
|
||||
@@ -90,6 +90,18 @@ export function applySubtitleDomainConfig(context: ResolveContext): void {
|
||||
'Expected positive number.',
|
||||
);
|
||||
}
|
||||
|
||||
const autoOpen = asBoolean(src.jimaku.autoOpenWhenPrimarySubtitleMissing);
|
||||
if (autoOpen !== undefined) {
|
||||
resolved.jimaku.autoOpenWhenPrimarySubtitleMissing = autoOpen;
|
||||
} else if (src.jimaku.autoOpenWhenPrimarySubtitleMissing !== undefined) {
|
||||
warn(
|
||||
'jimaku.autoOpenWhenPrimarySubtitleMissing',
|
||||
src.jimaku.autoOpenWhenPrimarySubtitleMissing,
|
||||
resolved.jimaku.autoOpenWhenPrimarySubtitleMissing,
|
||||
'Expected boolean.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const currentTsukihimeSource = isObject(src.tsukihime) ? src.tsukihime : null;
|
||||
|
||||
Reference in new issue
Block a user