mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-09 04:19:27 -07:00
docs: add mpv.launchMode to config docs, add changelog:docs generator, format
- Document the new mpv.launchMode option in the configuration docs page - Add changelog:docs command to auto-generate docs-site/changelog.md from root CHANGELOG.md - Add breaking changes support to the changelog fragment generator - Fix docs-sync test to only compare current minor release headings - Apply prettier formatting to source files
This commit is contained in:
@@ -2125,10 +2125,7 @@ test('template generator includes known keys', () => {
|
||||
/"dpadFallback": "horizontal",? \/\/ Optional D-pad fallback used when this analog controller action should also read D-pad input\. Values: none \| horizontal \| vertical/,
|
||||
);
|
||||
assert.match(output, /"port": 6678,? \/\/ Annotated subtitle websocket server port\./);
|
||||
assert.match(
|
||||
output,
|
||||
/"openBrowser": false,? \/\/ Open browser setting\. Values: true \| false/,
|
||||
);
|
||||
assert.match(output, /"openBrowser": false,? \/\/ Open browser setting\. Values: true \| false/);
|
||||
assert.match(
|
||||
output,
|
||||
/"enabled": false,? \/\/ Enable overlay controller support through the Chrome Gamepad API\. Values: true \| false/,
|
||||
|
||||
@@ -251,8 +251,7 @@ export function buildIntegrationConfigOptionRegistry(
|
||||
kind: 'enum',
|
||||
enumValues: MPV_LAUNCH_MODE_VALUES,
|
||||
defaultValue: defaultConfig.mpv.launchMode,
|
||||
description:
|
||||
'Default window state for SubMiner-managed mpv launches.',
|
||||
description: 'Default window state for SubMiner-managed mpv launches.',
|
||||
},
|
||||
{
|
||||
path: 'jellyfin.enabled',
|
||||
|
||||
@@ -237,10 +237,7 @@ test('detectInstalledFirstRunPlugin detects plugin installed in canonical mpv co
|
||||
fs.mkdirSync(path.dirname(pluginEntrypointPath), { recursive: true });
|
||||
fs.writeFileSync(pluginEntrypointPath, '-- plugin');
|
||||
|
||||
assert.equal(
|
||||
detectInstalledFirstRunPlugin(installPaths),
|
||||
true,
|
||||
);
|
||||
assert.equal(detectInstalledFirstRunPlugin(installPaths), true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -256,10 +253,7 @@ test('detectInstalledFirstRunPlugin ignores scoped plugin layout path', () => {
|
||||
fs.mkdirSync(path.dirname(pluginEntrypointPath), { recursive: true });
|
||||
fs.writeFileSync(pluginEntrypointPath, '-- plugin');
|
||||
|
||||
assert.equal(
|
||||
detectInstalledFirstRunPlugin(installPaths),
|
||||
false,
|
||||
);
|
||||
assert.equal(detectInstalledFirstRunPlugin(installPaths), false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -272,10 +266,7 @@ test('detectInstalledFirstRunPlugin ignores legacy loader file', () => {
|
||||
fs.mkdirSync(path.dirname(legacyLoaderPath), { recursive: true });
|
||||
fs.writeFileSync(legacyLoaderPath, '-- plugin');
|
||||
|
||||
assert.equal(
|
||||
detectInstalledFirstRunPlugin(installPaths),
|
||||
false,
|
||||
);
|
||||
assert.equal(detectInstalledFirstRunPlugin(installPaths), false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -288,9 +279,6 @@ test('detectInstalledFirstRunPlugin requires main.lua in subminer directory', ()
|
||||
fs.mkdirSync(pluginDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(pluginDir, 'not_main.lua'), '-- plugin');
|
||||
|
||||
assert.equal(
|
||||
detectInstalledFirstRunPlugin(installPaths),
|
||||
false,
|
||||
);
|
||||
assert.equal(detectInstalledFirstRunPlugin(installPaths), false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -152,13 +152,7 @@ export async function launchWindowsMpv(
|
||||
try {
|
||||
await deps.spawnDetached(
|
||||
mpvPath,
|
||||
buildWindowsMpvLaunchArgs(
|
||||
targets,
|
||||
extraArgs,
|
||||
binaryPath,
|
||||
pluginEntrypointPath,
|
||||
launchMode,
|
||||
),
|
||||
buildWindowsMpvLaunchArgs(targets, extraArgs, binaryPath, pluginEntrypointPath, launchMode),
|
||||
);
|
||||
return { ok: true, mpvPath };
|
||||
} catch (error) {
|
||||
|
||||
@@ -126,9 +126,7 @@ export function createKeyboardHandlers(
|
||||
}
|
||||
|
||||
function acceleratorToKeyString(accelerator: string): string | null {
|
||||
const normalized = accelerator
|
||||
.replace(/\s+/g, '')
|
||||
.replace(/cmdorctrl/gi, 'CommandOrControl');
|
||||
const normalized = accelerator.replace(/\s+/g, '').replace(/cmdorctrl/gi, 'CommandOrControl');
|
||||
if (!normalized) return null;
|
||||
const parts = normalized.split('+').filter(Boolean);
|
||||
const keyToken = parts.pop();
|
||||
|
||||
@@ -75,7 +75,10 @@ function createListStub() {
|
||||
}
|
||||
|
||||
test.afterEach(() => {
|
||||
if (Object.prototype.hasOwnProperty.call(globalThis, 'window') && globalThis.window === undefined) {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(globalThis, 'window') &&
|
||||
globalThis.window === undefined
|
||||
) {
|
||||
Reflect.deleteProperty(globalThis, 'window');
|
||||
}
|
||||
if (
|
||||
|
||||
@@ -22,17 +22,12 @@ function daysFromCivil(year: number, month: number, day: number): bigint {
|
||||
const yearOfEra = adjustedYear - era * 400;
|
||||
const monthIndex = month + (month > 2 ? -3 : 9);
|
||||
const dayOfYear = floorDiv(153 * monthIndex + 2, 5) + day - 1;
|
||||
const dayOfEra =
|
||||
yearOfEra * 365 + floorDiv(yearOfEra, 4) - floorDiv(yearOfEra, 100) + dayOfYear;
|
||||
const dayOfEra = yearOfEra * 365 + floorDiv(yearOfEra, 4) - floorDiv(yearOfEra, 100) + dayOfYear;
|
||||
return BigInt(era * 146097 + dayOfEra - 719468);
|
||||
}
|
||||
|
||||
function dateToEpochMs(date: Date): bigint {
|
||||
const dayCount = daysFromCivil(
|
||||
date.getUTCFullYear(),
|
||||
date.getUTCMonth() + 1,
|
||||
date.getUTCDate(),
|
||||
);
|
||||
const dayCount = daysFromCivil(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate());
|
||||
const timeOfDayMs = BigInt(
|
||||
((date.getUTCHours() * 60 + date.getUTCMinutes()) * 60 + date.getUTCSeconds()) * 1000 +
|
||||
date.getUTCMilliseconds(),
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { MpvLaunchMode } from '../types/config';
|
||||
|
||||
export const MPV_LAUNCH_MODE_VALUES = ['normal', 'maximized', 'fullscreen'] as const satisfies
|
||||
readonly MpvLaunchMode[];
|
||||
export const MPV_LAUNCH_MODE_VALUES = [
|
||||
'normal',
|
||||
'maximized',
|
||||
'fullscreen',
|
||||
] as const satisfies readonly MpvLaunchMode[];
|
||||
|
||||
export function parseMpvLaunchMode(value: unknown): MpvLaunchMode | undefined {
|
||||
if (typeof value !== 'string') {
|
||||
|
||||
@@ -203,13 +203,7 @@ test('resolveDefaultMpvInstallPaths resolves linux, macOS, and Windows defaults'
|
||||
'main.lua',
|
||||
),
|
||||
pluginDir: path.posix.join(macHomeDir, '.config', 'mpv', 'scripts', 'subminer'),
|
||||
pluginConfigPath: path.posix.join(
|
||||
macHomeDir,
|
||||
'.config',
|
||||
'mpv',
|
||||
'script-opts',
|
||||
'subminer.conf',
|
||||
),
|
||||
pluginConfigPath: path.posix.join(macHomeDir, '.config', 'mpv', 'script-opts', 'subminer.conf'),
|
||||
});
|
||||
|
||||
assert.deepEqual(resolveDefaultMpvInstallPaths('win32', 'C:\\Users\\tester', undefined), {
|
||||
|
||||
@@ -242,8 +242,8 @@ export function resolveDefaultMpvInstallPaths(
|
||||
const platformPath = getPlatformPath(platform);
|
||||
const mpvConfigDir =
|
||||
platform === 'linux' || platform === 'darwin'
|
||||
? platformPath.join(xdgConfigHome?.trim() || platformPath.join(homeDir, '.config'), 'mpv')
|
||||
: platformPath.join(homeDir, 'AppData', 'Roaming', 'mpv');
|
||||
? platformPath.join(xdgConfigHome?.trim() || platformPath.join(homeDir, '.config'), 'mpv')
|
||||
: platformPath.join(homeDir, 'AppData', 'Roaming', 'mpv');
|
||||
|
||||
return {
|
||||
supported: platform === 'linux' || platform === 'darwin' || platform === 'win32',
|
||||
|
||||
Reference in New Issue
Block a user