mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-09 16:19:25 -07:00
fix launcher runtime feedback
This commit is contained in:
5
changes/274-launcher-runtime-fixes.md
Normal file
5
changes/274-launcher-runtime-fixes.md
Normal file
@@ -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.
|
||||||
@@ -79,7 +79,7 @@ function createSmokeCase(name: string): SmokeCase {
|
|||||||
|
|
||||||
writeExecutable(
|
writeExecutable(
|
||||||
fakeMpvPath,
|
fakeMpvPath,
|
||||||
`#!/usr/bin/env node
|
`#!/usr/bin/env bun
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const net = require('node:net');
|
const net = require('node:net');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
@@ -118,7 +118,7 @@ process.on('SIGTERM', closeAndExit);
|
|||||||
|
|
||||||
writeExecutable(
|
writeExecutable(
|
||||||
fakeAppPath,
|
fakeAppPath,
|
||||||
`#!/usr/bin/env node
|
`#!/usr/bin/env bun
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
|
|
||||||
const logPath = ${JSON.stringify(fakeAppLogPath)};
|
const logPath = ${JSON.stringify(fakeAppLogPath)};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ async function withTempDir<T>(fn: (dir: string) => Promise<T>): Promise<T> {
|
|||||||
function makeFakeYtDlpScript(dir: string, payload: string): void {
|
function makeFakeYtDlpScript(dir: string, payload: string): void {
|
||||||
const scriptPath = path.join(dir, 'yt-dlp');
|
const scriptPath = path.join(dir, 'yt-dlp');
|
||||||
const script = process.platform === 'win32'
|
const script = process.platform === 'win32'
|
||||||
? `#!/usr/bin/env node
|
? `#!/usr/bin/env bun
|
||||||
process.stdout.write(${JSON.stringify(payload)});
|
process.stdout.write(${JSON.stringify(payload)});
|
||||||
`
|
`
|
||||||
: `#!/usr/bin/env sh
|
: `#!/usr/bin/env sh
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ async function withTempDir<T>(fn: (dir: string) => Promise<T>): Promise<T> {
|
|||||||
function makeFakeYtDlpScript(dir: string, payload: string): void {
|
function makeFakeYtDlpScript(dir: string, payload: string): void {
|
||||||
const scriptPath = path.join(dir, 'yt-dlp');
|
const scriptPath = path.join(dir, 'yt-dlp');
|
||||||
const script = process.platform === 'win32'
|
const script = process.platform === 'win32'
|
||||||
? `#!/usr/bin/env node
|
? `#!/usr/bin/env bun
|
||||||
process.stdout.write(${JSON.stringify(payload)});
|
process.stdout.write(${JSON.stringify(payload)});
|
||||||
`
|
`
|
||||||
: `#!/usr/bin/env sh
|
: `#!/usr/bin/env sh
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ async function withTempDir<T>(fn: (dir: string) => Promise<T>): Promise<T> {
|
|||||||
|
|
||||||
function makeFakeYtDlpScript(dir: string): string {
|
function makeFakeYtDlpScript(dir: string): string {
|
||||||
const scriptPath = path.join(dir, 'yt-dlp');
|
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 fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function makeFakeYtDlpScript(dir: string, payload: unknown, rawScript = false):
|
|||||||
process.platform === 'win32'
|
process.platform === 'win32'
|
||||||
? rawScript
|
? rawScript
|
||||||
? stdoutBody
|
? stdoutBody
|
||||||
: `#!/usr/bin/env node
|
: `#!/usr/bin/env bun
|
||||||
process.stdout.write(${JSON.stringify(stdoutBody)});
|
process.stdout.write(${JSON.stringify(stdoutBody)});
|
||||||
`
|
`
|
||||||
: `#!/usr/bin/env sh
|
: `#!/usr/bin/env sh
|
||||||
|
|||||||
@@ -396,7 +396,8 @@ export function createHandleFirstRunSetupNavigationHandler(deps: {
|
|||||||
}) {
|
}) {
|
||||||
return (params: { url: string; preventDefault: () => void }): boolean => {
|
return (params: { url: string; preventDefault: () => void }): boolean => {
|
||||||
if (!params.url.startsWith('subminer://first-run-setup')) {
|
if (!params.url.startsWith('subminer://first-run-setup')) {
|
||||||
return false;
|
params.preventDefault();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
params.preventDefault();
|
params.preventDefault();
|
||||||
let submission: FirstRunSetupSubmission | null;
|
let submission: FirstRunSetupSubmission | null;
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ export function resolveWindowsMpvPath(
|
|||||||
configuredMpvPath = '',
|
configuredMpvPath = '',
|
||||||
): string {
|
): string {
|
||||||
const configPath = normalizeCandidate(configuredMpvPath);
|
const configPath = normalizeCandidate(configuredMpvPath);
|
||||||
if (configPath && deps.fileExists(configPath)) {
|
if (configPath) {
|
||||||
return configPath;
|
if (deps.fileExists(configPath)) {
|
||||||
|
return configPath;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const envPath = normalizeCandidate(deps.getEnv('SUBMINER_MPV_PATH'));
|
const envPath = normalizeCandidate(deps.getEnv('SUBMINER_MPV_PATH'));
|
||||||
@@ -107,11 +110,14 @@ export function launchWindowsMpv(
|
|||||||
pluginEntrypointPath?: string,
|
pluginEntrypointPath?: string,
|
||||||
configuredMpvPath?: string,
|
configuredMpvPath?: string,
|
||||||
): { ok: boolean; mpvPath: string } {
|
): { ok: boolean; mpvPath: string } {
|
||||||
const mpvPath = resolveWindowsMpvPath(deps, configuredMpvPath);
|
const normalizedConfiguredPath = normalizeCandidate(configuredMpvPath);
|
||||||
|
const mpvPath = resolveWindowsMpvPath(deps, normalizedConfiguredPath);
|
||||||
if (!mpvPath) {
|
if (!mpvPath) {
|
||||||
deps.showError(
|
deps.showError(
|
||||||
'SubMiner mpv launcher',
|
'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: '' };
|
return { ok: false, mpvPath: '' };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user