Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
4.1 kB · 119 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120import * as z from "zod";import {requestRetryOptionsSchema} from "../common.ts";import {commonClientConfigSchema, commonClientDataSchema, type EnvClientSchema} from "./index.ts";import {lastfmClientOptionsSchema} from "./lastfm.ts";import { httpUrl } from "../../../../utils/ZodUtils.ts";
export const librefmDataSchema = z.object({ ...commonClientDataSchema.shape, ...requestRetryOptionsSchema.shape, /** * Optional Secret for Libre.fm account * * This can be anything, or it will be generated by multi-scrobbler * * @examples ["anyValue"] * */ apiKey: z.string().optional().meta({ description: "Optional Secret for Libre.fm account", examples: ["anyValue"] }), /** * Optional Secret for Libre.fm account * * This can be anything, or it will be generated by multi-scrobbler * * @examples ["anyValue"] * */ secret: z.string().optional().meta({ description: "Optional Secret for Libre.fm account", examples: ["anyValue"] }),
/** * Optional session id returned from a completed auth flow * */ session: z.string().optional().meta({ description: "Optional session id returned from a completed auth flow" }),
path: z.string().optional(),
/** * (Optional) The host and path prefix for your Libre.fm instance * * @default 'https://libre.fm/2.0/' */ urlBase: httpUrl.optional().meta({ description: "(Optional) The host and path prefix for your Libre.fm instance", default: "https://libre.fm/2.0/" }), /** * Optional URI to use for callback. Specify this if callback should be different than the default. MUST have "librefm/callback" in the URL somewhere. * * @default "http://localhost:9078/librefm/callback" * @examples ["http://localhost:9078/librefm/callback"] * */ redirectUri: z.string().optional().meta({ description: "Optional URI to use for callback.", default: "http://localhost:9078/librefm/callback", examples: ["http://localhost:9078/librefm/callback"] }),});
export type LibrefmData = z.infer<typeof librefmDataSchema>;
const envDataSchema = z.object({ LIBREFM_API_KEY: librefmDataSchema.shape.apiKey, LIBREFM_SECRET: librefmDataSchema.shape.secret, LIBREFM_REDIRECT_URI: librefmDataSchema.shape.redirectUri, LIBREFM_SESSION: librefmDataSchema.shape.session, LIBREFM_URLBASE: librefmDataSchema.shape.urlBase,});
export const envSchemas: EnvClientSchema<typeof envDataSchema, LibrefmClientConfig> = { env: envDataSchema, prefix: 'LIBREFM', toConfig: (partial) => ({ configureAs: 'client', data: { apiKey: partial.LIBREFM_API_KEY, secret: partial.LIBREFM_SECRET, redirectUri: partial.LIBREFM_REDIRECT_URI, session: partial.LIBREFM_SESSION, urlBase: partial.LIBREFM_URLBASE } })};
export const librefmClientOptionsSchema = z.object({ ...lastfmClientOptionsSchema.shape,});
export type LibrefmClientOptions = z.infer<typeof librefmClientOptionsSchema>;
export const librefmClientConfigSchema = z.object({ ...commonClientConfigSchema.shape, /** * Should always be `client` when using Librefm as a client * * @default client * @examples ["client"] * */ configureAs: z.union([z.literal('client'), z.literal('source')]).optional().meta({ description: "Should always be `client` when using Librefm as a client", default: "client", examples: ["client"] }), data: librefmDataSchema, options: librefmClientOptionsSchema.optional(),});
export type LibrefmClientConfig = z.infer<typeof librefmClientConfigSchema>;
export const librefmClientAIOConfigSchema = z.object({ ...librefmClientConfigSchema.shape, type: z.literal('librefm'),}).meta({title: 'Libre.fm'});
export type LibrefmClientAIOConfig = z.infer<typeof librefmClientAIOConfigSchema>;