mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 16:46:06 -08:00
- Add `subminer youtube`/`yt` and tray "Browse YouTube" window that plays or queues picked videos in mpv - Add `youtube.subtitleSource` (`youtube` | `whisper`) to transcribe YouTube audio via subtitle generation - Allow the subtitle generation modal on YouTube videos - Pick the real Japanese track over machine-translated ones and fall back to yt-dlp on HTTP 429 - Remove legacy launcher youtubeSubgen/whisper/AI args and `--youtube-mode` - Fix EPIPE crash when the launching terminal is closed with Ctrl+C - Thin media timing review handles with orange original-boundary bars - Update docs and change fragments
82 lines
3.3 KiB
TypeScript
82 lines
3.3 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
createBuildResolveTrayIconPathMainDepsHandler,
|
|
createBuildTrayMenuTemplateMainDepsHandler,
|
|
} from './tray-main-deps';
|
|
|
|
test('tray main deps builders return mapped handlers', () => {
|
|
const calls: string[] = [];
|
|
const resolveDeps = createBuildResolveTrayIconPathMainDepsHandler({
|
|
resolveTrayIconPathRuntime: () => '/tmp/icon.png',
|
|
platform: 'darwin',
|
|
resourcesPath: '/resources',
|
|
appPath: '/app',
|
|
dirname: '/dir',
|
|
joinPath: (...parts) => parts.join('/'),
|
|
fileExists: () => true,
|
|
})();
|
|
|
|
assert.equal(resolveDeps.platform, 'darwin');
|
|
assert.equal(resolveDeps.joinPath('a', 'b'), 'a/b');
|
|
|
|
const menuDeps = createBuildTrayMenuTemplateMainDepsHandler({
|
|
buildTrayMenuTemplateRuntime: () => [{ label: 'tray' }] as never,
|
|
initializeOverlayRuntime: () => calls.push('init'),
|
|
isOverlayRuntimeInitialized: () => false,
|
|
openSessionHelpModal: () => calls.push('help'),
|
|
openChangelogModal: () => calls.push('changelog'),
|
|
openTexthookerInBrowser: () => calls.push('texthooker'),
|
|
showTexthookerPage: () => true,
|
|
showFirstRunSetup: () => true,
|
|
openFirstRunSetupWindow: (force?: boolean) => calls.push(force ? 'setup-forced' : 'setup'),
|
|
showWindowsMpvLauncherSetup: () => true,
|
|
getDictionaryBackend: () => 'yomitan',
|
|
openHachidoriSettings: () => {},
|
|
openYomitanSettings: () => calls.push('yomitan'),
|
|
openConfigSettingsWindow: () => calls.push('configuration'),
|
|
openSyncUiWindow: () => calls.push('sync-ui'),
|
|
openYoutubeBrowserWindow: () => calls.push('youtube'),
|
|
exportLogs: () => calls.push('export-logs'),
|
|
openJellyfinSetupWindow: () => calls.push('jellyfin'),
|
|
isJellyfinConfigured: () => true,
|
|
isJellyfinDiscoveryActive: () => false,
|
|
toggleJellyfinDiscovery: (checked) => {
|
|
calls.push(`jellyfin-discovery:${checked}`);
|
|
},
|
|
platform: 'linux',
|
|
openAnilistSetupWindow: () => calls.push('anilist'),
|
|
checkForUpdates: () => calls.push('updates'),
|
|
quitApp: () => calls.push('quit'),
|
|
})();
|
|
|
|
assert.equal(menuDeps.platform, 'linux');
|
|
const template = menuDeps.buildTrayMenuTemplateRuntime({
|
|
platform: menuDeps.platform,
|
|
openSessionHelp: () => calls.push('open-help'),
|
|
openChangelog: () => calls.push('open-changelog'),
|
|
openTexthookerInBrowser: () => calls.push('open-texthooker'),
|
|
showTexthookerPage: true,
|
|
openFirstRunSetup: () => calls.push('open-setup'),
|
|
showFirstRunSetup: true,
|
|
openWindowsMpvLauncherSetup: () => calls.push('open-windows-mpv'),
|
|
showWindowsMpvLauncherSetup: true,
|
|
dictionaryBackend: 'yomitan',
|
|
openHachidoriSettings: () => {},
|
|
openYomitanSettings: () => calls.push('open-yomitan'),
|
|
openConfigSettings: () => calls.push('open-configuration'),
|
|
openSyncUi: () => {},
|
|
openYoutubeBrowser: () => {},
|
|
exportLogs: () => calls.push('open-export-logs'),
|
|
openJellyfinSetup: () => calls.push('open-jellyfin'),
|
|
showJellyfinDiscovery: true,
|
|
jellyfinDiscoveryActive: false,
|
|
toggleJellyfinDiscovery: (checked) => calls.push(`open-jellyfin-discovery:${checked}`),
|
|
openAnilistSetup: () => calls.push('open-anilist'),
|
|
checkForUpdates: () => calls.push('open-updates'),
|
|
quitApp: () => calls.push('quit-app'),
|
|
});
|
|
|
|
assert.deepEqual(template, [{ label: 'tray' }]);
|
|
});
|