mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-28 04:19:27 -07:00
chore(release): prepare v0.12.0
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { filterMpvPollResultBySocketPath, matchesMpvSocketPathInCommandLine } from './mpv-socket-match';
|
||||
import {
|
||||
filterMpvPollResultBySocketPath,
|
||||
matchesMpvSocketPathInCommandLine,
|
||||
} from './mpv-socket-match';
|
||||
import type { MpvPollResult } from './win32';
|
||||
|
||||
function createPollResult(commandLines: Array<string | null>): MpvPollResult {
|
||||
@@ -51,7 +54,10 @@ test('filterMpvPollResultBySocketPath keeps only matches for the requested socke
|
||||
'\\\\.\\pipe\\subminer-b',
|
||||
);
|
||||
|
||||
assert.deepEqual(result.matches.map((match) => match.hwnd), [2]);
|
||||
assert.deepEqual(
|
||||
result.matches.map((match) => match.hwnd),
|
||||
[2],
|
||||
);
|
||||
assert.equal(result.windowState, 'visible');
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ export function findWindowsMpvTargetWindowHandle(result?: MpvPollResult): number
|
||||
const poll = result ?? loadWin32().findMpvWindows();
|
||||
const focused = poll.matches.find((match) => match.isForeground);
|
||||
const best =
|
||||
focused ?? [...poll.matches].sort((a, b) => b.area - a.area || b.bounds.width - a.bounds.width)[0];
|
||||
focused ??
|
||||
[...poll.matches].sort((a, b) => b.area - a.area || b.bounds.width - a.bounds.width)[0];
|
||||
return best?.hwnd ?? null;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ import { WindowsWindowTracker } from './windows-tracker';
|
||||
import type { MpvPollResult } from './win32';
|
||||
|
||||
function mpvVisible(
|
||||
overrides: Partial<MpvPollResult & { x?: number; y?: number; width?: number; height?: number; focused?: boolean }> = {},
|
||||
overrides: Partial<
|
||||
MpvPollResult & { x?: number; y?: number; width?: number; height?: number; focused?: boolean }
|
||||
> = {},
|
||||
): MpvPollResult {
|
||||
return {
|
||||
matches: [
|
||||
|
||||
@@ -55,7 +55,8 @@ export class WindowsWindowTracker extends BaseWindowTracker {
|
||||
constructor(_targetMpvSocketPath?: string, deps: WindowsTrackerDeps = {}) {
|
||||
super();
|
||||
this.targetMpvSocketPath = _targetMpvSocketPath?.trim() || null;
|
||||
this.pollMpvWindows = deps.pollMpvWindows ?? (() => defaultPollMpvWindows(this.targetMpvSocketPath));
|
||||
this.pollMpvWindows =
|
||||
deps.pollMpvWindows ?? (() => defaultPollMpvWindows(this.targetMpvSocketPath));
|
||||
this.maxConsecutiveMisses = Math.max(1, Math.floor(deps.maxConsecutiveMisses ?? 2));
|
||||
this.trackingLossGraceMs = Math.max(0, Math.floor(deps.trackingLossGraceMs ?? 1_500));
|
||||
this.minimizedTrackingLossGraceMs = Math.max(
|
||||
|
||||
Reference in New Issue
Block a user