mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-09 16:19:25 -07:00
fix latest review feedback
This commit is contained in:
10
src/main.ts
10
src/main.ts
@@ -2244,14 +2244,18 @@ const openFirstRunSetupWindowHandler = createOpenFirstRunSetupWindowHandler({
|
||||
}
|
||||
if (submission.action === 'configure-mpv-executable-path') {
|
||||
const mpvExecutablePath = submission.mpvExecutablePath?.trim() ?? '';
|
||||
const pathStatus = getConfiguredWindowsMpvPathStatus(mpvExecutablePath);
|
||||
configService.patchRawConfig({
|
||||
mpv: {
|
||||
executablePath: mpvExecutablePath,
|
||||
},
|
||||
});
|
||||
firstRunSetupMessage = mpvExecutablePath
|
||||
? `Saved mpv executable path: ${mpvExecutablePath}`
|
||||
: 'Cleared mpv executable path. SubMiner will auto-discover mpv.exe from PATH.';
|
||||
firstRunSetupMessage =
|
||||
pathStatus === 'invalid'
|
||||
? `Saved mpv executable path, but the file was not found: ${mpvExecutablePath}`
|
||||
: mpvExecutablePath
|
||||
? `Saved mpv executable path: ${mpvExecutablePath}`
|
||||
: 'Cleared mpv executable path. SubMiner will auto-discover mpv.exe from SUBMINER_MPV_PATH or PATH.';
|
||||
return;
|
||||
}
|
||||
if (submission.action === 'configure-windows-mpv-shortcuts') {
|
||||
|
||||
@@ -61,6 +61,7 @@ test('buildFirstRunSetupHtml switches plugin action to reinstall when already in
|
||||
assert.match(html, /Reinstall mpv plugin/);
|
||||
assert.match(html, /mpv executable path/);
|
||||
assert.match(html, /Leave blank to auto-discover mpv\.exe from PATH\./);
|
||||
assert.match(html, /aria-label="Path to mpv\.exe"/);
|
||||
assert.match(
|
||||
html,
|
||||
/Finish stays unlocked once the mpv plugin is installed and Yomitan reports at least one installed dictionary\./,
|
||||
|
||||
@@ -130,6 +130,7 @@ export function buildFirstRunSetupHtml(model: FirstRunSetupHtmlModel): string {
|
||||
<input
|
||||
id="mpv-executable-path"
|
||||
type="text"
|
||||
aria-label="Path to mpv.exe"
|
||||
value="${escapeHtml(model.mpvExecutablePath)}"
|
||||
placeholder="C:\\Program Files\\mpv\\mpv.exe"
|
||||
/>
|
||||
|
||||
@@ -134,6 +134,34 @@ test('buildWindowsMpvLaunchArgs mirrors a custom input-ipc-server into script op
|
||||
);
|
||||
});
|
||||
|
||||
test('buildWindowsMpvLaunchArgs includes socket script opts when plugin entrypoint is present without binary path', () => {
|
||||
assert.deepEqual(
|
||||
buildWindowsMpvLaunchArgs(
|
||||
['C:\\video.mkv'],
|
||||
['--input-ipc-server', '\\\\.\\pipe\\custom-subminer-socket'],
|
||||
undefined,
|
||||
'C:\\Program Files\\SubMiner\\resources\\plugin\\subminer\\main.lua',
|
||||
),
|
||||
[
|
||||
'--player-operation-mode=pseudo-gui',
|
||||
'--force-window=immediate',
|
||||
'--script=C:\\Program Files\\SubMiner\\resources\\plugin\\subminer\\main.lua',
|
||||
'--input-ipc-server=\\\\.\\pipe\\custom-subminer-socket',
|
||||
'--alang=ja,jp,jpn,japanese,en,eng,english,enus,en-us',
|
||||
'--slang=ja,jp,jpn,japanese,en,eng,english,enus,en-us',
|
||||
'--sub-auto=fuzzy',
|
||||
'--sub-file-paths=subs;subtitles',
|
||||
'--sid=auto',
|
||||
'--secondary-sid=auto',
|
||||
'--secondary-sub-visibility=no',
|
||||
'--script-opts=subminer-socket_path=\\\\.\\pipe\\custom-subminer-socket',
|
||||
'--input-ipc-server',
|
||||
'\\\\.\\pipe\\custom-subminer-socket',
|
||||
'C:\\video.mkv',
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test('launchWindowsMpv reports missing mpv path', async () => {
|
||||
const errors: string[] = [];
|
||||
const result = await launchWindowsMpv(
|
||||
|
||||
@@ -96,14 +96,17 @@ export function buildWindowsMpvLaunchArgs(
|
||||
const launchIdle = targets.length === 0;
|
||||
const inputIpcServer =
|
||||
readExtraArgValue(extraArgs, '--input-ipc-server') ?? DEFAULT_WINDOWS_MPV_SOCKET;
|
||||
const scriptOpts =
|
||||
typeof binaryPath === 'string' && binaryPath.trim().length > 0
|
||||
? `--script-opts=subminer-binary_path=${binaryPath.trim().replace(/,/g, '\\,')},subminer-socket_path=${inputIpcServer.replace(/,/g, '\\,')}`
|
||||
: null;
|
||||
const scriptEntrypoint =
|
||||
typeof pluginEntrypointPath === 'string' && pluginEntrypointPath.trim().length > 0
|
||||
? `--script=${pluginEntrypointPath.trim()}`
|
||||
: null;
|
||||
const scriptOptPairs = scriptEntrypoint
|
||||
? [`subminer-socket_path=${inputIpcServer.replace(/,/g, '\\,')}`]
|
||||
: [];
|
||||
if (scriptEntrypoint && typeof binaryPath === 'string' && binaryPath.trim().length > 0) {
|
||||
scriptOptPairs.unshift(`subminer-binary_path=${binaryPath.trim().replace(/,/g, '\\,')}`);
|
||||
}
|
||||
const scriptOpts = scriptOptPairs.length > 0 ? `--script-opts=${scriptOptPairs.join(',')}` : null;
|
||||
|
||||
return [
|
||||
'--player-operation-mode=pseudo-gui',
|
||||
|
||||
Reference in New Issue
Block a user