diff --git a/assets/README.md b/assets/README.md new file mode 100644 index 00000000..080fffbc --- /dev/null +++ b/assets/README.md @@ -0,0 +1 @@ +* Attribution for [`default-artwork.png`](/assets/default-artwork.png): https://www.flaticon.com/free-icon/music_15795471 \ No newline at end of file diff --git a/assets/default-artwork.png b/assets/default-artwork.png new file mode 100644 index 00000000..f9eeec72 Binary files /dev/null and b/assets/default-artwork.png differ diff --git a/docsite/docs/configuration/clients/discord.mdx b/docsite/docs/configuration/clients/discord.mdx index 47417873..a3dc539f 100644 --- a/docsite/docs/configuration/clients/discord.mdx +++ b/docsite/docs/configuration/clients/discord.mdx @@ -11,7 +11,7 @@ import JsonConfig from '!!raw-loader!@site/../config/discord.json.example'; This scrobbler uses **[Now Playing](/configuration/clients#now-playing)** functionality to set your Discord [Rich Presence](https://docs.discord.com/developers/rich-presence/overview) to the music you are currently monitoring with multi-scrobbler. - + :::warning[Discord TOS Violation] @@ -257,7 +257,7 @@ Discord needs an **external, internet-facing** URL to correctly display this ima When [**Application Id**](#discord-application) is **not** configured Discord will show its own default image. - + When [**Application Id**](#discord-application) **is** configured and any of these conditions is true: @@ -272,7 +272,7 @@ Discord needs an **external, internet-facing** URL to correctly display this ima Without any other configuration, the default URL is for the the MS logo: - + This default image can be customized: diff --git a/docsite/static/img/discord_presence_art.png b/docsite/static/img/discord_presence_art.png index 61049259..3a2fcfa5 100644 Binary files a/docsite/static/img/discord_presence_art.png and b/docsite/static/img/discord_presence_art.png differ diff --git a/docsite/static/img/discord_presence_default.png b/docsite/static/img/discord_presence_discord_default.png similarity index 100% rename from docsite/static/img/discord_presence_default.png rename to docsite/static/img/discord_presence_discord_default.png diff --git a/docsite/static/img/discord_presence_ms_default.png b/docsite/static/img/discord_presence_ms_default.png new file mode 100644 index 00000000..4ee097c0 Binary files /dev/null and b/docsite/static/img/discord_presence_ms_default.png differ diff --git a/src/backend/common/vendor/discord/DiscordWSClient.ts b/src/backend/common/vendor/discord/DiscordWSClient.ts index 6e7004b5..7a27b1bd 100644 --- a/src/backend/common/vendor/discord/DiscordWSClient.ts +++ b/src/backend/common/vendor/discord/DiscordWSClient.ts @@ -19,8 +19,8 @@ import { isSuperAgentResponseError } from "../../errors/ErrorUtils.js"; import { urlToMusicService } from "../ListenbrainzApiClient.js"; import { fa } from "@faker-js/faker"; -const ARTWORK_PLACEHOLDER = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/icon.png'; -const MB_ART = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/musicbrainz-logo-small.png'; +const ARTWORK_PLACEHOLDER = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/default-artwork.png'; +const MS_ART = 'https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/master/assets/icon.png'; const API_GATEWAY_ENDPOINT = 'https://discord.com/api/gateway'; /** @@ -432,7 +432,8 @@ export class DiscordWSClient extends AbstractApiClient { artwork = false } = this.config; const { - artworkDefaultUrl = ARTWORK_PLACEHOLDER + artworkDefaultUrl = ARTWORK_PLACEHOLDER, + applicationId } = this.config; let art = artworkDefaultUrl; @@ -458,15 +459,14 @@ export class DiscordWSClient extends AbstractApiClient { if(usedUrl !== undefined) { activity.assets.large_image = usedUrl; } - if(activity.assets.small_text !== undefined) { - const smallArt = await this.getArtworkUrl(MB_ART); - if(smallArt !== undefined) { + } + if(art !== MS_ART && applicationId !== undefined) { + const smallArt = await this.getArtworkUrl(MS_ART); + if(smallArt !== undefined) { activity.assets.small_image = smallArt; - } else { - delete activity.assets.small_text; - delete activity.assets.small_url; - } - } + activity.assets.small_text = 'Via Multi-Scrobbler' + activity.assets.small_url = 'https://multi-scrobbler.app' + } } return activity; @@ -738,7 +738,7 @@ export const playStateToActivityData = (data: SourceData, opts: { useArt?: boole if(url !== undefined) { const knownService = urlToMusicService(url); if(knownService !== undefined) { - activity.assets.large_url = url; + activity.details_url = url; // when including buttons discord accepts the presence update but does not actually use it // I think buttons may now be limited to official RPC or restricted to preset actions via things like secrets or registering commands @@ -752,11 +752,10 @@ export const playStateToActivityData = (data: SourceData, opts: { useArt?: boole } if(recording !== undefined) { const mb = `https://musicbrainz.org/recording/${recording}`; - if(activity.assets.large_url === undefined) { - activity.assets.large_url = mb; + if(activity.details_url === undefined) { + activity.details_url = mb; } else { - activity.assets.small_url = mb; - activity.assets.small_text = 'Open On Musicbrainz'; + activity.state_url = mb; } // buttons.push({ // label: 'Open on Musicbrainz',