mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 06:22:44 -08:00
refactor: extract main runtime dependency builders
This commit is contained in:
33
src/main/runtime/jellyfin-client-info.ts
Normal file
33
src/main/runtime/jellyfin-client-info.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
export function createGetResolvedJellyfinConfigHandler(deps: {
|
||||
getResolvedConfig: () => { jellyfin: unknown };
|
||||
}) {
|
||||
return () => deps.getResolvedConfig().jellyfin as never;
|
||||
}
|
||||
|
||||
export function createGetJellyfinClientInfoHandler(deps: {
|
||||
getResolvedJellyfinConfig: () => {
|
||||
clientName?: string;
|
||||
clientVersion?: string;
|
||||
deviceId?: string;
|
||||
};
|
||||
getDefaultJellyfinConfig: () => {
|
||||
clientName?: string;
|
||||
clientVersion?: string;
|
||||
deviceId?: string;
|
||||
};
|
||||
}) {
|
||||
return (
|
||||
config = deps.getResolvedJellyfinConfig(),
|
||||
): {
|
||||
clientName: string;
|
||||
clientVersion: string;
|
||||
deviceId: string;
|
||||
} => {
|
||||
const defaults = deps.getDefaultJellyfinConfig();
|
||||
return {
|
||||
clientName: config.clientName || defaults.clientName || '',
|
||||
clientVersion: config.clientVersion || defaults.clientVersion || '',
|
||||
deviceId: config.deviceId || defaults.deviceId || '',
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user