refactor(launcher): split config parser and CLI builder

Decompose launcher/config.ts into focused domain parser and CLI normalization modules to reduce refactor risk while preserving command behavior. Align Jellyfin launcher config with session-based auth by dropping config token/userId dependency.
This commit is contained in:
2026-02-22 12:01:04 -08:00
parent 82a9d83820
commit 420b985c7a
14 changed files with 907 additions and 728 deletions

View File

@@ -127,6 +127,7 @@ export async function resolveJellyfinSelection(
left.localeCompare(right, undefined, { sensitivity: 'base', numeric: true });
const sortEntries = (
entries: Array<{
id: string;
type: string;
name: string;
parentIndex: number | null;
@@ -355,10 +356,12 @@ export async function runJellyfinPlayMenu(
mpvSocketPath: string,
): Promise<never> {
const config = loadLauncherJellyfinConfig();
const envAccessToken = (process.env.SUBMINER_JELLYFIN_ACCESS_TOKEN || '').trim();
const envUserId = (process.env.SUBMINER_JELLYFIN_USER_ID || '').trim();
const session: JellyfinSessionConfig = {
serverUrl: sanitizeServerUrl(args.jellyfinServer || config.serverUrl || ''),
accessToken: config.accessToken || '',
userId: config.userId || '',
accessToken: envAccessToken,
userId: envUserId,
defaultLibraryId: config.defaultLibraryId || '',
pullPictures: config.pullPictures === true,
iconCacheDir: config.iconCacheDir || '',
@@ -366,7 +369,7 @@ export async function runJellyfinPlayMenu(
if (!session.serverUrl || !session.accessToken || !session.userId) {
fail(
'Missing Jellyfin session config. Run `subminer --jellyfin` or `subminer --jellyfin-login` first.',
'Missing Jellyfin session. Set SUBMINER_JELLYFIN_ACCESS_TOKEN and SUBMINER_JELLYFIN_USER_ID, then retry.',
);
}