From b02c96ada832c3aa46062efb01fba8901b822313 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 17 Jul 2024 09:51:44 -0400 Subject: [PATCH] docs: Parse and render config examples from repository --- docsite/docs/configuration/configuration.mdx | 500 +++++++++++++++---- docsite/docusaurus.config.ts | 1 + docsite/package-lock.json | 72 ++- docsite/package.json | 2 + docsite/src/components/AIOExample.tsx | 50 ++ docsite/src/components/SchemaLink.tsx | 27 + 6 files changed, 545 insertions(+), 107 deletions(-) create mode 100644 docsite/src/components/AIOExample.tsx create mode 100644 docsite/src/components/SchemaLink.tsx diff --git a/docsite/docs/configuration/configuration.mdx b/docsite/docs/configuration/configuration.mdx index 0e19cef6..ad52731e 100644 --- a/docsite/docs/configuration/configuration.mdx +++ b/docsite/docs/configuration/configuration.mdx @@ -5,7 +5,28 @@ toc_max_heading_level: 3 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import Admonition from '@theme/Admonition'; +import CodeBlock from '@theme/CodeBlock'; +import SchemaLink from "../../src/components/SchemaLink"; +import AIOExample from "../../src/components/AIOExample"; + +import AIOConfig from '!!raw-loader!../../../config/config.json.example'; +import ChromecastConfig from '!!raw-loader!../../../config/chromecast.json.example'; +import DeezerConfig from '!!raw-loader!../../../config/chromecast.json.example'; +import JellyfinConfig from '!!raw-loader!../../../config/jellyfin.json.example'; +import JriverfinConfig from '!!raw-loader!../../../config/jriver.json.example'; +import KodiConfig from '!!raw-loader!../../../config/kodi.json.example'; +import LastfmConfig from '!!raw-loader!../../../config/lastfm.json.example'; +import ListenbrainzConfig from '!!raw-loader!../../../config/listenbrainz.json.example'; +import MalojaConfig from '!!raw-loader!../../../config/maloja.json.example'; +import MopidyConfig from '!!raw-loader!../../../config/mopidy.json.example'; +import MprisConfig from '!!raw-loader!../../../config/mpris.json.example'; +import MusikcubeConfig from '!!raw-loader!../../../config/musikcube.json.example'; +import PlexConfig from '!!raw-loader!../../../config/plex.json.example'; +import SpotifyConfig from '!!raw-loader!../../../config/spotify.json.example'; +import SubsonicConfig from '!!raw-loader!../../../config/subsonic.json.example'; +import TautulliConfig from '!!raw-loader!../../../config/tautulli.json.example'; +import WebscrobblerConfig from '!!raw-loader!../../../config/webscrobbler.json.example'; +import YTMusicConfig from '!!raw-loader!../../../config/ytmusic.json.example'; # Configuration @@ -41,7 +62,7 @@ Check the [**FAQ**](../FAQ.md) if you have any issues after configuration! MS will parse configuration files located in the directory specified by the `CONFIG_DIR` environmental variable. This variable defaults to: * Local installation -> `PROJECT_DIR/config` - * Docker -> `/config` (in the container) -- see the [install docs](../installation/installation.md#docker) for how to configure this correctly + * Docker -> `/config` (in the container) -- see the [install docs](../installation/installation.mdx#docker) for how to configure this correctly
@@ -56,8 +77,11 @@ Check the [**FAQ**](../FAQ.md) if you have any issues after configuration!
- There are **example configurations** for all Source/Client types and AIO config located in the [`/config`](https://github.com/FoxxMD/multi-scrobbler/tree/master/config) directory of this project. These can be used as-is by renaming them to `.json`. - For docker installations these examples are copied to your configuration directory on first-time use. There is also a [**kitchensink example**](kitchensink.md) that provides examples of using all sources/clients in a complex configuration. + :::tip + * There are **example configurations** for all Source/Client types and AIO config located in the [`/config`](https://github.com/FoxxMD/multi-scrobbler/tree/master/config) directory of this project. These can be used as-is by renaming them to `.json`. + * For docker/flatpak installations these examples are copied to your configuration directory on first-time use. + * There is also a [**kitchensink example**](kitchensink.md) that provides examples of using all sources/clients in a complex configuration. + ::: Each file is named by the **type** of the Client/Source found in below sections. Each file as an **array** of that type of Client/Source. @@ -73,25 +97,7 @@ Check the [**FAQ**](../FAQ.md) if you have any issues after configuration!
Config Example - ```json5 title="/CONFIG_DIR/maloja.json" - [ - { - "name": "myFirstMalojaClient", - "data": { - "url": "http://myMalojaServer.example", - "apiKey": "myKey" - } - }, - { - "name": "mySecondMalojaClient", - "data": { - "url": "http://my2ndMalojaServer.example", - "apiKey": "myKey" - } - } - ] - - ``` + {SpotifyConfig}
@@ -99,7 +105,7 @@ Check the [**FAQ**](../FAQ.md) if you have any issues after configuration! MS will parse an **all-in-one** configuration file located in the directory specified by the `CONFIG_DIR` environmental variable. This variable defaults to: * Local installation -> `PROJECT_DIR/config/config.json` - * Docker -> `/config/config.json` (in the container) -- see the [install docs](../installation/installation.md#docker) for how to configure this correctly + * Docker -> `/config/config.json` (in the container) -- see the [install docs](../installation/installation.mdx#docker) for how to configure this correctly
@@ -116,7 +122,11 @@ Check the [**FAQ**](../FAQ.md) if you have any issues after configuration! **The AIO config also enables setting default options for sources/clients as well as global options for MS itself.** - An example AIO config files can be found at [/config/config.json.example](https://github.com/FoxxMD/multi-scrobbler/tree/master/config/config.json.example) in the project directory. For docker installations theis example is copied to your configuration directory on first-time use. There is also a [**kitchensink example**](kitchensink.md) that provides examples of using all sources/clients in a complex AOI configuration. + :::tip + * An example AIO config files can be found in the project directory at [`/config/config.json.example`](https://github.com/FoxxMD/multi-scrobbler/tree/master/config/config.json.example) + * For docker/flatpak installations this example is copied to your configuration directory on first-time use. + * There is also a [**kitchensink example**](kitchensink.md) that provides examples of using all sources/clients in a complex configuration. + ::: [**Explore the schema for this configuration, along with an example generator and validator, here**](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Faio.json) @@ -124,34 +134,7 @@ Check the [**FAQ**](../FAQ.md) if you have any issues after configuration! Config Example - ```json title="/CONFIG_DIR/config.json" - { - "sources": [ - { - "name": "myConfig", - "type": "spotify", - "clients": [ - "myMalojaClient" - ], - "data": { - "clientId": "anExample" - "clientSecret": "anExample", - "redirectUri": "http://localhost:9078/callback" - } - } - ], - "clients": [ - { - "name": "myMalojaClient", - "type": "maloja", - "data": { - "url": "http://myMalojaServer.example", - "apiKey": "myKey" - } - } - ] - } - ``` + {AIOConfig}
@@ -169,7 +152,7 @@ Defines the URL that is used to generate default redirect URLs for authenticatio * Set with [ENV](./configuration?configType=env#configuration-types) `BASE_URL` or `baseUrl` [all-in-one configuration](./configuration?configType=aio#configuration-types) * If protocol is `http` or no protocol is specified MS will try to use port `9078` -- to override this explicitly set the port or use `https` -Useful when running with [docker](../installation/installation.md#docker) so that you do not need to specify redirect URLs for each configuration. +Useful when running with [docker](../installation/installation.mdx#docker) so that you do not need to specify redirect URLs for each configuration.
@@ -231,10 +214,25 @@ If your Spotify player has [Automix](https://community.spotify.com/t5/FAQs/What- | `SPOTIFY_REDIRECT_URI` | No | `http://localhost:9078/callback` | URI must end in `callback` | - See [`spotify.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/spotify.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FSpotifySourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {SpotifyConfig} + +
+ + or
- See [`spotify.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/spotify.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FSpotifySourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ or
@@ -251,10 +249,27 @@ Check the [instructions](plex.md) on how to setup a [webhooks](https://support.p | `PLEX_USER` | No | | The a comma-delimited list of usernames to scrobble tracks for. No usernames specified means all tracks by all users will be scrobbled. | - See [`plex.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/plex.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FPlexSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) + +
+ + Example + + {PlexConfig} + +
+ + or
- See [`plex.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/plex.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FPlexSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -271,10 +286,27 @@ Check the [instructions](plex.md) on how to setup a notification agent. | `TAUTULLI_USER` | No | | The a comma-delimited list of usernames to scrobble tracks for. No usernames specified means all tracks by all users will be scrobbled. | - See [`tautulli.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/tautulli.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FTautulliSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) + +
+ + Example + + {TautulliConfig} + +
+ + or
- See [`tautulli.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/tautulli.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FTautulliSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -300,10 +332,26 @@ Can use this source for any application that implements the [Subsonic API](http: | `SUBSONIC_URL` | Yes | | Base url of your subsonic-api server | - See [`subsonic.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/subsonic.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FSubSonicSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {SubsonicConfig} + +
+ + or
- See [`subsonic.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/subsonic.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FSubSonicSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -340,10 +388,27 @@ If you see errors in the MS logs regarding `missing headers` when using Jellyfin | `JELLYFIN_SERVER` | | | Comma-separated list of Jellyfin server names to scrobble from | - See [`jellyfin.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/jellyfin.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FJellySourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {JellyfinConfig} + +
+ + or +
- See [`jellyfin.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/jellyfin.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FJellySourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -358,10 +423,28 @@ See the [Last.fm (Client)](#lastfm) setup for registration instructions. No support for ENV based for Last.fm as a client (only source) - See [`lastfm.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/lastfm.json.example), change `configureAs` to `source`. Or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FLastfmSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) - +
+ Change `configureAs` to `source` + + Example + + {LastfmConfig} + +
+ + or + - See [`lastfm.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/lastfm.json.example), change `configureAs` to `source`. Or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FLastfmSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ Change `configureAs` to `source` + + Example + + + +
+ + or
@@ -376,19 +459,33 @@ On your [profile page](https://listenbrainz.org/profile/) find your **User Token - + :::note You cannot use ENV variables shown in the [Listenbrainz Client config](#listenbrainz) -- multi-scrobbler assumes Listenbrainz ENVs are always used for the **client** configuration. You must use the file-based config from below to setup Listenbrainz as a Source. - + ::: - See [`listenbrainz.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/listenbrainz.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FListenBrainzSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ Change `configureAs` to `source` + + Example - **Change `configureAs` to `source`** + {ListenbrainzConfig} + +
+ + or
- See [`listenbrainz.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/listenbrainz.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FListenBrainzSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ Change `configureAs` to `source` + + Example + + + +
- **Change `configureAs` to `source`** + or
@@ -421,10 +518,26 @@ After starting multi-scrobbler with credentials in-place open the dashboard (`ht | `DEEZER_REDIRECT_URI` | No | `http://localhost:9078/deezer/callback` | URI must end in `deezer/callback` | - See [`deezer.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/deezer.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FDeezerSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {DeezerConfig} + +
+ + or
- See [`deezer.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/deezer.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FDeezerSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -459,10 +572,26 @@ Then... No ENV support - See [`ytmusic.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/ytmusic.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FYTMusicSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {YTMusicConfig} + +
+ + or
- See [`ytmusic.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/ytmusic.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FYTMusicSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -478,7 +607,7 @@ multi-scrobbler can listen to this interface and scrobble tracks played by **any :::note -multi-scrobbler needs to be running as a [**Local Installation**](../installation/installation.md#nodejs) in order to use MPRIS. This cannot be used from docker. +multi-scrobbler needs to be running as a [**Local Installation**](../installation/installation.mdx#nodejs) in order to use MPRIS. This cannot be used from docker. ::: @@ -493,10 +622,26 @@ multi-scrobbler needs to be running as a [**Local Installation**](../installatio | MPRIS_WHITELIST | No | | Comma-delimited list of players names to ONLY scrobble from. Overrides blacklist | - See [`mpris.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/mpris.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FMPRISSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {MprisConfig} + +
+ + or
- See [`mpris.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/mpris.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FMPRISSourceConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -513,10 +658,26 @@ multi-scrobbler can scrobble tracks played from any Mopidy backend source, regar No ENV support - See [`mopidy.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/mopidy.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FMopidySourceConfig/%23%2Fdefinitions%2FMopidyData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {MopidyConfig} + +
+ + or
- See [`mopidy.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/mopidy.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FMopidySourceConfig/%23%2Fdefinitions%2FMopidyData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -670,10 +831,26 @@ MS transforms this to: `http://mydomain.com:80/jriverReverse/MCWS/v1/` | JRIVER_PASSWORD | No | | If authenticated is enabled, the password set | - See [`jriver.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/jriver.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FJRiverSourceConfig/%23%2Fdefinitions%2FJRiverData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) - +
+ + Example + + {JriverfinConfig} + +
+ + or + - See [`jriver.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/jriver.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FJRiverSourceConfig/%23%2Fdefinitions%2FJRiverData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -742,10 +919,26 @@ MS transforms this to: `http://mydomain.com:80/kodiReverse/jsonrpc` | KODI_PASSWORD | No | | The password set | - See [`kodi.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/kodi.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FKodiSourceConfig/%23%2Fdefinitions%2FKodiData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {KodiConfig} + +
+ + or
- See [`kodi.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/kodi.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FKodiSourceConfig/%23%2Fdefinitions%2FKodiData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -770,9 +963,7 @@ If you would like use multiple WebScrobbler sources they can be matched using a Example: -In `webscrobbler.json` - -```json +```json title="webscrobbler.json" [ { "name": "aUserWS", @@ -825,10 +1016,26 @@ This affects **only** MS's behavior and does not affect the general connector be | WS_BLACKLIST | No | | Do not scrobble from these WebScrobbler Connectors. Comma-delimited list | - See [`webscrobbler.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/webscrobbler.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FWebScrobblerSourceConfig/%23%2Fdefinitions%2FWebScrobblerData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {WebscrobblerConfig} + +
+ + or
- See [`webscrobbler.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/webscrobbler.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FWebScrobblerSourceConfig/%23%2Fdefinitions%2FWebScrobblerData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -954,9 +1161,9 @@ To diagnose bad/incomplete track information or strange MS player behavior pleas - + :::note [Manually configuring cast device connections](#connecting-devices) is only available through file-based config. - + ::: | Environmental Variable | Required? | Default | Description | |------------------------|-----------|---------|--------------------------------------------------------------------------------------| @@ -967,10 +1174,27 @@ To diagnose bad/incomplete track information or strange MS player behavior pleas | CC_BLACKLIST_APPS | No | | Do not scrobble from these casted Apps. Comma-delimited list | - See [`chromecast.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/chromecast.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FChromecastSourceConfig/%23%2Fdefinitions%2FChromecastData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) + +
+ + Example + + {ChromecastConfig} + +
+ + or
- See [`chromecast.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/chromecast.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FChromecastSourceConfig/%23%2Fdefinitions%2FChromecastData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -1005,10 +1229,26 @@ If no URL is provided to MS it will try to use `ws://localhost:7905` | `MC_PASSWORD` | Yes | | | - See [`musikcube.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/chromecast.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FMuikcubeSourceConfig/%23%2Fdefinitions%2FMuikcubeData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + {MusikcubeConfig} + +
+ + or
- See [`musikcube.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/chromecast.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FMuikcubeSourceConfig/%23%2Fdefinitions%2FMuikcubeData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json) +
+ + Example + + + +
+ + or
@@ -1026,10 +1266,27 @@ If no URL is provided to MS it will try to use `ws://localhost:7905` | `MALOJA_API_KEY` | Yes | | Api Key | - See [`maloja.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/maloja.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FMalojaClientConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json) + +
+ + Example + + {MalojaConfig} + +
+ + or
- See [`maloja.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/maloja.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FMalojaClientConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json) +
+ + Example + + + +
+ + or
@@ -1053,12 +1310,30 @@ or replace `localhost:9078` with your own base URL | `LASTFM_SECRET` | Yes | | Shared secret from your API Account | | `LASTFM_REDIRECT_URI` | No | `http://localhost:9078/lastfm/callback` | Url to use for authentication. Must include `lastfm/callback` somewhere in it | | `LASTFM_SESSION` | No | | Session id. Will be generated by authentication flow if not provided. | + LastfmClientConfig - See [`lastfm.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/lastfm.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FLastfmClientConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json) + +
+ + Example + + {LastfmConfig} + +
+ + or
- See [`lastfm.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/lastfm.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23/%23%2Fdefinitions%2FLastfmClientConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json) +
+ + Example + + + +
+ + or
@@ -1079,10 +1354,27 @@ On your [profile page](https://listenbrainz.org/profile/) find your **User Token | LZ_URL | No | https://api.listenbrainz.org/ | The base URL for the LZ server | - See [`listenbrainz.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/listenbrainz.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FListenBrainzClientConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json) + +
+ + Example + + {ListenbrainzConfig} + +
+ + or
- See [`listenbrainz.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/listenbrainz.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FListenBrainzClientConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json) +
+ + Example + + + +
+ + or
diff --git a/docsite/docusaurus.config.ts b/docsite/docusaurus.config.ts index 42bd1fd9..9771fa08 100644 --- a/docsite/docusaurus.config.ts +++ b/docsite/docusaurus.config.ts @@ -155,6 +155,7 @@ const config: Config = { prism: { theme: themes.themes.github, darkTheme: themes.themes.dracula, + additionalLanguages: ['json','json5','typescript'] }, colorMode: { defaultMode: 'dark', diff --git a/docsite/package-lock.json b/docsite/package-lock.json index 029a3bc8..3e072045 100644 --- a/docsite/package-lock.json +++ b/docsite/package-lock.json @@ -14,7 +14,9 @@ "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", "docusaurus-json-schema-plugin": "^1.12.1", + "micromark-extension-directive": "^3.0.1", "prism-react-renderer": "^2.3.0", + "raw-loader": "^4.0.2", "react": "^18.0.0", "react-dom": "^18.0.0" }, @@ -9137,9 +9139,9 @@ ] }, "node_modules/micromark-extension-directive": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-3.0.0.tgz", - "integrity": "sha512-61OI07qpQrERc+0wEysLHMvoiO3s2R56x5u7glHq2Yqq6EHbH4dW25G9GfDdGCDYqA21KE6DWgNSzxSwHc2hSg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-3.0.1.tgz", + "integrity": "sha512-VGV2uxUzhEZmaP7NSFo2vtq7M2nUD+WfmYQD+d8i/1nHbzE+rMy9uzTvUybBbNiVbrhOZibg3gbyoARGqgDWyg==", "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", @@ -12192,6 +12194,70 @@ "node": ">= 0.8" } }, + "node_modules/raw-loader": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-4.0.2.tgz", + "integrity": "sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==", + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/raw-loader/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/raw-loader/node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/raw-loader/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/raw-loader/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", diff --git a/docsite/package.json b/docsite/package.json index 4f2e7b07..211a9aa6 100644 --- a/docsite/package.json +++ b/docsite/package.json @@ -20,7 +20,9 @@ "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", "docusaurus-json-schema-plugin": "^1.12.1", + "micromark-extension-directive": "^3.0.1", "prism-react-renderer": "^2.3.0", + "raw-loader": "^4.0.2", "react": "^18.0.0", "react-dom": "^18.0.0" }, diff --git a/docsite/src/components/AIOExample.tsx b/docsite/src/components/AIOExample.tsx new file mode 100644 index 00000000..df388432 --- /dev/null +++ b/docsite/src/components/AIOExample.tsx @@ -0,0 +1,50 @@ +import React, { Fragment } from "react" +import CodeBlock from '@theme/CodeBlock'; +import Admonition from '@theme/Admonition'; +import ErrorBoundary from "@docusaurus/ErrorBoundary" +import Error from "@theme/Error" +import { Simulate } from "react-dom/test-utils"; +import error = Simulate.error; + +export interface AIOProps { + data: string + client?: boolean + name: string +} + +const AIOExample = (props: AIOProps) => { + const { + data, + name, + client = false + } = props; + + let configObj; + // eslint-disable-next-line prefer-const + try { + configObj = JSON.parse(data); + } catch (e) { + console.error(e); + return +

Example component crashed because of error!

+ {e.message} +
+ } + configObj[0].type = name; + const configType = client ? 'clients' : 'sources'; + + const aio = {[configType]: configObj}; + return {JSON.stringify(aio, null, 2)} +} + +const WrappedAIOExample = (props: AIOProps) => { + return ( +
+

Example component crashed because of error: {error.message}.

+
+ )} + >
+} + +export default WrappedAIOExample; diff --git a/docsite/src/components/SchemaLink.tsx b/docsite/src/components/SchemaLink.tsx new file mode 100644 index 00000000..ad50983b --- /dev/null +++ b/docsite/src/components/SchemaLink.tsx @@ -0,0 +1,27 @@ +import React, {PropsWithChildren, Fragment} from "react" + +export interface SchemaLinkProps { + objectName: string + lower?: boolean + client?: boolean +} + +const sourceURL = 'https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json'; +const clientURL = 'https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fclient.json'; + +const SchemaLink = (props: PropsWithChildren) => { + const { + children, + lower, + client = false + } = props; + let content = children; + if(content === undefined) { + content = {lower ? 'explore' : 'Explore'} the schema with an example and live editor/validator + } + const definition = `https://json-schema.app/view/%23/%23%2Fdefinitions%2F${props.objectName}`; + const url = client ? clientURL : sourceURL; + return {content} +} + +export default SchemaLink; -- 2.51.2