diff --git a/src/widgets/navidrome/component.jsx b/src/widgets/navidrome/component.jsx index 343eb0fe7..360dac97e 100644 --- a/src/widgets/navidrome/component.jsx +++ b/src/widgets/navidrome/component.jsx @@ -11,11 +11,11 @@ export default function Component({ service }) { const { data: navidromeData, error: navidromeError } = useWidgetAPI(widget, "getNowPlaying"); - if (navidromeError) { + if (navidromeError || navidromeData?.error || navidromeData?.["subsonic-response"]?.error) { return ; } - if (!navidromeData || Object.keys(navidromeData["subsonic-response"].nowPlaying).length === 0) { + if (!navidromeData) { return ( @@ -26,10 +26,18 @@ export default function Component({ service }) { ); } - const nowPlaying = Object.values(navidromeData["subsonic-response"].nowPlaying.entry); + const nowPlaying = navidromeData["subsonic-response"].nowPlaying; + if (!nowPlaying.entry) { + // nothing playing + return ( + + ); + } + + const nowPlayingEntries = Object.values(nowPlaying.entry); const songList = []; - nowPlaying.forEach(userPlay => { + nowPlayingEntries.forEach(userPlay => { const playing = ( diff --git a/src/widgets/navidrome/widget.js b/src/widgets/navidrome/widget.js index 9b8614350..9d7c03d45 100644 --- a/src/widgets/navidrome/widget.js +++ b/src/widgets/navidrome/widget.js @@ -1,7 +1,7 @@ import genericProxyHandler from "utils/proxy/handlers/generic"; const widget = { - api: "{url}/rest/{endpoint}?u={user}&t={token}&s={salt}&v={version}&c={client}&f=json", + api: "{url}/rest/{endpoint}?u={user}&t={token}&s={salt}&v=1.16.1&c=homepage&f=json", proxyHandler: genericProxyHandler, mappings: {