mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-27 04:49:49 -07:00
5d8673f299
- `sync --ui` now launches detached; closing standalone Sync window exits app - `--check` uses BatchMode + ConnectTimeout + 15s timeoutMs on all SSH calls - `runSyncLauncher` settles on `exit` (not just `close`) for Electron pipe inheritance - Added `timeoutMs` to `runSyncLauncher`; check-host passes 30s deadline - `handleSyncCliAtEntry` wraps exit deps for testability; fixes Linux AppImage GUI fallthrough - `config-settings-window` gains optional `onClosed` hook - Added preload-syncui bundle to `build:syncui` script
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import {
|
|
launchAppCommandDetached,
|
|
launchAppBackgroundDetached,
|
|
launchTexthookerOnly,
|
|
runAppCommandWithInherit,
|
|
} from '../mpv.js';
|
|
import type { LauncherCommandContext } from './context.js';
|
|
|
|
type AppCommandDeps = {
|
|
runAppCommandWithInherit: (appPath: string, appArgs: string[]) => void;
|
|
launchSyncUiDetached: (
|
|
appPath: string,
|
|
logLevel: LauncherCommandContext['args']['logLevel'],
|
|
) => void;
|
|
launchAppBackgroundDetached: (
|
|
appPath: string,
|
|
logLevel: LauncherCommandContext['args']['logLevel'],
|
|
) => void;
|
|
};
|
|
|
|
const defaultAppCommandDeps: AppCommandDeps = {
|
|
runAppCommandWithInherit,
|
|
launchSyncUiDetached: (appPath, logLevel) =>
|
|
launchAppCommandDetached(appPath, ['--sync-window'], logLevel, 'sync-ui'),
|
|
launchAppBackgroundDetached,
|
|
};
|
|
|
|
export function runAppPassthroughCommand(
|
|
context: LauncherCommandContext,
|
|
deps: AppCommandDeps = defaultAppCommandDeps,
|
|
): boolean {
|
|
const { args, appPath } = context;
|
|
if (!appPath) {
|
|
return false;
|
|
}
|
|
if (args.settings) {
|
|
deps.runAppCommandWithInherit(appPath, ['--settings']);
|
|
return true;
|
|
}
|
|
if (args.syncUi) {
|
|
deps.launchSyncUiDetached(appPath, args.logLevel);
|
|
return true;
|
|
}
|
|
if (!args.appPassthrough) {
|
|
return false;
|
|
}
|
|
if (args.appArgs.length === 0) {
|
|
deps.launchAppBackgroundDetached(appPath, args.logLevel);
|
|
return true;
|
|
}
|
|
deps.runAppCommandWithInherit(appPath, args.appArgs);
|
|
return true;
|
|
}
|
|
|
|
export function runTexthookerCommand(context: LauncherCommandContext): boolean {
|
|
const { args, appPath } = context;
|
|
if (!args.texthookerOnly || !appPath) {
|
|
return false;
|
|
}
|
|
launchTexthookerOnly(appPath, args);
|
|
return true;
|
|
}
|