diff --git a/changes/274-launcher-runtime-fixes.md b/changes/274-launcher-runtime-fixes.md new file mode 100644 index 00000000..ebe9bfc1 --- /dev/null +++ b/changes/274-launcher-runtime-fixes.md @@ -0,0 +1,5 @@ +type: fixed +area: launcher + +- Kept the first-run setup window from navigating away on unexpected URLs. +- Made Windows mpv honor an explicitly configured executable path instead of silently falling back to PATH. diff --git a/launcher/smoke.e2e.test.ts b/launcher/smoke.e2e.test.ts index 82798fd7..439e9955 100644 --- a/launcher/smoke.e2e.test.ts +++ b/launcher/smoke.e2e.test.ts @@ -79,7 +79,7 @@ function createSmokeCase(name: string): SmokeCase { writeExecutable( fakeMpvPath, - `#!/usr/bin/env node + `#!/usr/bin/env bun const fs = require('node:fs'); const net = require('node:net'); const path = require('node:path'); @@ -118,7 +118,7 @@ process.on('SIGTERM', closeAndExit); writeExecutable( fakeAppPath, - `#!/usr/bin/env node + `#!/usr/bin/env bun const fs = require('node:fs'); const logPath = ${JSON.stringify(fakeAppLogPath)}; diff --git a/src/core/services/youtube/metadata-probe.test.ts b/src/core/services/youtube/metadata-probe.test.ts index 5ae196e0..2c8f1ec7 100644 --- a/src/core/services/youtube/metadata-probe.test.ts +++ b/src/core/services/youtube/metadata-probe.test.ts @@ -17,7 +17,7 @@ async function withTempDir(fn: (dir: string) => Promise): Promise { function makeFakeYtDlpScript(dir: string, payload: string): void { const scriptPath = path.join(dir, 'yt-dlp'); const script = process.platform === 'win32' - ? `#!/usr/bin/env node + ? `#!/usr/bin/env bun process.stdout.write(${JSON.stringify(payload)}); ` : `#!/usr/bin/env sh diff --git a/src/core/services/youtube/playback-resolve.test.ts b/src/core/services/youtube/playback-resolve.test.ts index 1eee56d4..708ea6d2 100644 --- a/src/core/services/youtube/playback-resolve.test.ts +++ b/src/core/services/youtube/playback-resolve.test.ts @@ -17,7 +17,7 @@ async function withTempDir(fn: (dir: string) => Promise): Promise { function makeFakeYtDlpScript(dir: string, payload: string): void { const scriptPath = path.join(dir, 'yt-dlp'); const script = process.platform === 'win32' - ? `#!/usr/bin/env node + ? `#!/usr/bin/env bun process.stdout.write(${JSON.stringify(payload)}); ` : `#!/usr/bin/env sh diff --git a/src/core/services/youtube/track-download.test.ts b/src/core/services/youtube/track-download.test.ts index f340f714..54a4a85c 100644 --- a/src/core/services/youtube/track-download.test.ts +++ b/src/core/services/youtube/track-download.test.ts @@ -16,7 +16,7 @@ async function withTempDir(fn: (dir: string) => Promise): Promise { function makeFakeYtDlpScript(dir: string): string { const scriptPath = path.join(dir, 'yt-dlp'); - const script = `#!/usr/bin/env node + const script = `#!/usr/bin/env bun const fs = require('node:fs'); const path = require('node:path'); diff --git a/src/core/services/youtube/track-probe.test.ts b/src/core/services/youtube/track-probe.test.ts index b5460105..00891851 100644 --- a/src/core/services/youtube/track-probe.test.ts +++ b/src/core/services/youtube/track-probe.test.ts @@ -21,7 +21,7 @@ function makeFakeYtDlpScript(dir: string, payload: unknown, rawScript = false): process.platform === 'win32' ? rawScript ? stdoutBody - : `#!/usr/bin/env node + : `#!/usr/bin/env bun process.stdout.write(${JSON.stringify(stdoutBody)}); ` : `#!/usr/bin/env sh diff --git a/src/main/runtime/first-run-setup-window.ts b/src/main/runtime/first-run-setup-window.ts index fe31d358..c52199cb 100644 --- a/src/main/runtime/first-run-setup-window.ts +++ b/src/main/runtime/first-run-setup-window.ts @@ -396,7 +396,8 @@ export function createHandleFirstRunSetupNavigationHandler(deps: { }) { return (params: { url: string; preventDefault: () => void }): boolean => { if (!params.url.startsWith('subminer://first-run-setup')) { - return false; + params.preventDefault(); + return true; } params.preventDefault(); let submission: FirstRunSetupSubmission | null; diff --git a/src/main/runtime/windows-mpv-launch.ts b/src/main/runtime/windows-mpv-launch.ts index 0d966e86..681edc4b 100644 --- a/src/main/runtime/windows-mpv-launch.ts +++ b/src/main/runtime/windows-mpv-launch.ts @@ -18,8 +18,11 @@ export function resolveWindowsMpvPath( configuredMpvPath = '', ): string { const configPath = normalizeCandidate(configuredMpvPath); - if (configPath && deps.fileExists(configPath)) { - return configPath; + if (configPath) { + if (deps.fileExists(configPath)) { + return configPath; + } + return ''; } const envPath = normalizeCandidate(deps.getEnv('SUBMINER_MPV_PATH')); @@ -107,11 +110,14 @@ export function launchWindowsMpv( pluginEntrypointPath?: string, configuredMpvPath?: string, ): { ok: boolean; mpvPath: string } { - const mpvPath = resolveWindowsMpvPath(deps, configuredMpvPath); + const normalizedConfiguredPath = normalizeCandidate(configuredMpvPath); + const mpvPath = resolveWindowsMpvPath(deps, normalizedConfiguredPath); if (!mpvPath) { deps.showError( 'SubMiner mpv launcher', - 'Could not find mpv.exe. Set mpv.executablePath, set SUBMINER_MPV_PATH, or add mpv.exe to PATH.', + normalizedConfiguredPath + ? `Configured mpv.executablePath was not found: ${normalizedConfiguredPath}` + : 'Could not find mpv.exe. Set mpv.executablePath, set SUBMINER_MPV_PATH, or add mpv.exe to PATH.', ); return { ok: false, mpvPath: '' }; }