mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-28 00:55:16 -07:00
feat: add mark-watched action, background app reuse, and N+1 compat
- Add `--mark-watched` CLI flag + mpv session binding; marks video watched, shows OSD, advances playlist - Launcher detects running background app via `--app-ping` and borrows it instead of owning its lifecycle - Preserve N+1 highlighting for existing configs with `knownWords.highlightEnabled` set - Fix `resolveConfiguredShortcuts` to respect explicit `null` overrides (disabling defaults) - Split session-help modal into focused modules (colors, render, sections, tabs)
This commit is contained in:
+25
-1
@@ -1004,6 +1004,7 @@ export async function startOverlay(
|
||||
): Promise<void> {
|
||||
const backend = detectBackend(args.backend);
|
||||
log('info', args.logLevel, `Starting SubMiner overlay (backend: ${backend})...`);
|
||||
const appAlreadyRunning = isAppAlreadyRunning(appPath, args.logLevel);
|
||||
|
||||
const overlayArgs = ['--start', '--backend', backend, '--socket', socketPath, ...extraAppArgs];
|
||||
if (args.logLevel !== 'info') overlayArgs.push('--log-level', args.logLevel);
|
||||
@@ -1015,7 +1016,16 @@ export async function startOverlay(
|
||||
env: buildAppEnv(process.env, target.env),
|
||||
});
|
||||
attachAppProcessLogging(state.overlayProc);
|
||||
markOverlayManagedByLauncher(appPath);
|
||||
if (appAlreadyRunning) {
|
||||
log(
|
||||
'debug',
|
||||
args.logLevel,
|
||||
'SubMiner app is already running; launcher will not stop it after playback',
|
||||
);
|
||||
clearOverlayManagedByLauncher();
|
||||
} else {
|
||||
markOverlayManagedByLauncher(appPath);
|
||||
}
|
||||
|
||||
const [socketReady] = await Promise.all([
|
||||
waitForUnixSocketReady(socketPath, OVERLAY_START_SOCKET_READY_TIMEOUT_MS),
|
||||
@@ -1042,6 +1052,20 @@ export function markOverlayManagedByLauncher(appPath?: string): void {
|
||||
state.overlayManagedByLauncher = true;
|
||||
}
|
||||
|
||||
function clearOverlayManagedByLauncher(): void {
|
||||
state.appPath = '';
|
||||
state.overlayManagedByLauncher = false;
|
||||
}
|
||||
|
||||
function isAppAlreadyRunning(appPath: string, logLevel: LogLevel): boolean {
|
||||
const result = runSyncAppCommand(appPath, ['--app-ping'], false);
|
||||
if (result.error) {
|
||||
log('debug', logLevel, `App ping failed before overlay start: ${result.error.message}`);
|
||||
return false;
|
||||
}
|
||||
return result.status === 0;
|
||||
}
|
||||
|
||||
export function openUrlInDefaultBrowser(url: string, logLevel: LogLevel): void {
|
||||
const target =
|
||||
process.platform === 'darwin'
|
||||
|
||||
Reference in New Issue
Block a user