diff --git a/webui/static/init.js b/webui/static/init.js index f00e5852..3a0cf496 100644 --- a/webui/static/init.js +++ b/webui/static/init.js @@ -2171,6 +2171,20 @@ function buildArtistDetailPath(artistId, source = null) { return '/artist-detail/' + encodeURIComponent(normalizedSource) + '/' + encodeURIComponent(String(artistId)); } +function parseArtistDetailPath(pathname = window.location.pathname) { + const segs = String(pathname || '').split('/').filter(Boolean); + if (segs[0] !== 'artist-detail' || segs.length < 3) return null; + + const source = decodeURIComponent(segs[1] || ''); + const artistId = decodeURIComponent(segs.slice(2).join('/')); + if (!source || !artistId) return null; + + return { + artistId, + source: source.toLowerCase() === 'library' ? null : source, + }; +} + // =============================== // MOBILE NAVIGATION // =============================== diff --git a/webui/static/search.js b/webui/static/search.js index 4974fad9..7a2214fc 100644 --- a/webui/static/search.js +++ b/webui/static/search.js @@ -1175,6 +1175,14 @@ async function loadInitialData() { return; } + if (targetPage === 'artist-detail') { + const artistRoute = typeof parseArtistDetailPath === 'function' ? parseArtistDetailPath() : null; + if (artistRoute && typeof navigateToArtistDetail === 'function') { + navigateToArtistDetail(artistRoute.artistId, '', artistRoute.source); + } + return; + } + // Always apply the target page to the legacy shell chrome. const router = getWebRouter(); const route = router?.routeManifest?.find((entry) => entry.pageId === targetPage);