diff --git a/src/backend/common/infrastructure/config/client/index.ts b/src/backend/common/infrastructure/config/client/index.ts index 967d7381..0d6d704b 100644 --- a/src/backend/common/infrastructure/config/client/index.ts +++ b/src/backend/common/infrastructure/config/client/index.ts @@ -166,15 +166,6 @@ export type CommonClientOptions = z.infer; export const commonClientConfigSchema = z.object({ ...commonConfigSchema.shape, - /** - * Vanity name for this client - * - * @examples ["MyConfig"] - * */ - name: z.string().meta({ - description: "Vanity name for this client.", - examples: ["Foxx's Cool Client"] - }), /** * Specific data required to configure this client * */ diff --git a/src/backend/common/infrastructure/config/common.ts b/src/backend/common/infrastructure/config/common.ts index 0acc997b..4f314cdf 100644 --- a/src/backend/common/infrastructure/config/common.ts +++ b/src/backend/common/infrastructure/config/common.ts @@ -19,7 +19,15 @@ export const commonDataSchema = z.record(z.string(), z.any()); // keyOmit<{ [key export type CommonData = z.infer; export const commonConfigSchema = z.object({ - name: z.string().optional(), + /** + * Vanity name for this Source/Client + * + * @examples ["My Cool Component"] + * */ + name: z.string().optional().meta({ + description: "Vanity name for this Source/Client", + examples: ["Foxx's Cool Client"] + }), /** A UNIQUE identifier for this Source/Client * * It should be unique for the given Source/Client type. No other Source/Client of the same type should have this ID. This ID will be used to register this Source/Client in the database so that it can be identified even if you change the name of the component. @@ -150,13 +158,23 @@ export type MonitorOptions = z.infer; export type UnparsedConfig = {config: object, type: T, source?: 'file' | 'aio' | 'env', pos: string}; export const generateConfigLocation = (configType: string, config: UnparsedConfig): string => { + const identifiers: string[] = []; + if(config.config !== undefined) { + if('id' in config.config) { + identifiers.push(`ID ${config.config.id}`); + } + if('name' in config.config) { + identifiers.push(`Name ${config.config.name}`); + } + } + if(config.source === 'file') { - return `${capitalize(configType)} #${config.pos} in ${config.type}.json`; + return `${capitalize(configType)} #${config.pos}${identifiers.length > 0 ? ` (${identifiers.join(',')})` : ''} in ${config.type}.json`; } if(config.source === 'aio') { - return `${capitalize(configType)} ${config.type} #${config.pos} in config.json`; + return `${capitalize(configType)} ${config.type} #${config.pos}${identifiers.length > 0 ? ` (${identifiers.join(',')})` : ''} in config.json`; } - return `${capitalize(configType)} ${config.type} from ENV`; + return `${capitalize(configType)} ${config.type}${identifiers.length > 0 ? ` (${identifiers.join(',')})` : ''} from ENV`; } export const transformPresetEnv = (prefix: string, existing: T = undefined): undefined | T => { diff --git a/src/backend/common/infrastructure/config/source/index.ts b/src/backend/common/infrastructure/config/source/index.ts index 5698d38b..641daf60 100644 --- a/src/backend/common/infrastructure/config/source/index.ts +++ b/src/backend/common/infrastructure/config/source/index.ts @@ -186,20 +186,13 @@ export type CommonSourceData = {}; export const commonSourceConfigSchema = z.object({ ...commonConfigSchema.shape, /** - * Vanity anme for this source. - * */ - name: z.string().optional().meta({ - description: "Vanity Name for this source.", - examples: ["Foxx's Cool Source"] - }), - /** - * Restrict scrobbling tracks played from this source to Clients with names from this list. If list is empty is not present Source scrobbles to all configured Clients. + * Restrict scrobbling tracks played from this source to Clients with IDs from this list. If list is empty is not present Source scrobbles to all configured Clients. * * @examples [["MyMalojaConfigName","MyLastFMConfigName"]] * */ clients: z.array(z.string()).optional().meta({ - description: "Restrict scrobbling tracks played from this source to Clients with names from this list.", - examples: [["MyMalojaConfigName","MyLastFMConfigName"]] + description: "Restrict scrobbling tracks played from this Source to Clients with IDs from this list.", + examples: [["MyMalojaConfigId","MyLastFMConfigId"]] }), data: commonSourceDataSchema.optional(), options: commonSourceOptionsSchema.optional(), diff --git a/src/backend/scrobblers/ScrobbleClients.ts b/src/backend/scrobblers/ScrobbleClients.ts index be39182f..eca9d64a 100644 --- a/src/backend/scrobblers/ScrobbleClients.ts +++ b/src/backend/scrobblers/ScrobbleClients.ts @@ -239,7 +239,7 @@ export default class ScrobbleClients { } if (parsedConfig.enable === false) { - this.logger.debug(`Not using Config ${parsedConfig.id} (${parsedConfig.name}) because it was marked as not enabled.`); + this.logger.debug(`Not using Config ${parsedConfig.id}${parsedConfig.name !== undefined ? ` (${parsedConfig.name}) ` :''} because it was marked as not enabled.`); } else { strongConfigs.push(parsedConfig); } diff --git a/src/backend/sources/ScrobbleSources.ts b/src/backend/sources/ScrobbleSources.ts index 7181053e..9e4b93c2 100644 --- a/src/backend/sources/ScrobbleSources.ts +++ b/src/backend/sources/ScrobbleSources.ts @@ -261,7 +261,7 @@ export default class ScrobbleSources { } if (parsedConfig.enable === false) { - this.logger.debug(`Not using Config ${parsedConfig.id} (${parsedConfig.name}) because it was marked as not enabled.`); + this.logger.debug(`Not using Config ${parsedConfig.id}${parsedConfig.name !== undefined ? ` (${parsedConfig.name}) ` :''} because it was marked as not enabled.`); } else { strongConfigs.push(parsedConfig); }