From 51babd9e41c4df69a6fc2c0c3d913aacd3d52270 Mon Sep 17 00:00:00 2001 From: Honey Date: Tue, 28 Apr 2026 00:13:13 +0200 Subject: [PATCH] fix: bump SW cache to v39, split multi-artists by ' / ', name-search fallback for artist nav MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sw.js: ns-v38 → ns-v39 forces PWA cache clear so previous fixes take effect - components: split s.artist by ' / ' in makeSongItem — each part becomes its own clickable link; noArtistLink turns all parts into plain text - views: s_goArtist searches Navidrome by name when no artistId is available (needed for secondary artists that only have the primary artistId in the song) Co-Authored-By: Claude Sonnet 4.6 --- public/sw.js | 2 +- src/components.js | 12 ++++++++---- src/views.js | 11 +++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/public/sw.js b/public/sw.js index ff3af43..09af483 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,4 @@ -const CACHE = 'ns-v38'; +const CACHE = 'ns-v39'; const PRECACHE = ['/', 'index.html', 'manifest.json', 'icon.svg']; const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js']; diff --git a/src/components.js b/src/components.js index 7396a1c..3f35e2e 100644 --- a/src/components.js +++ b/src/components.js @@ -32,10 +32,14 @@ export function makeSongItem(s, idx, list, { noArtistLink = false, noAlbumLink = if(s.starred && !s._starred) s._starred = true; el.className = 'song-item' + (S.queue[S.qIdx]?.id === s.id ? ' playing' : ''); const cv = coverUrl(s.coverArt, 60); - const artistHtml = s.artistId||s.artist - ? (noArtistLink - ? `${esc(s.artist||'')}` - : `${esc(s.artist||'')}`) + const artistParts = (s.artist || '').split(' / ').filter(Boolean); + const artistHtml = artistParts.length + ? artistParts.map((name, i) => { + const aid = i === 0 ? (s.artistId || '') : ''; + return noArtistLink + ? `${esc(name)}` + : `${esc(name)}`; + }).join(' / ') : ''; const albumHtml = !noAlbumLink && (s.albumId||s.album) ? ` · ${esc(s.album||'')}` diff --git a/src/views.js b/src/views.js index e19ea53..9191eb6 100644 --- a/src/views.js +++ b/src/views.js @@ -840,9 +840,16 @@ export async function searchAndPreview(trackName, artistName) { } catch { toast('Suche fehlgeschlagen'); } } -export function s_goArtist(e, name, id) { +export async function s_goArtist(e, name, id) { if(!name) return; - navigate('artist-detail', {id: id||name, name}); + if(id) { navigate('artist-detail', {id, name}); return; } + try { + const r = await api('search3', `&query=${encodeURIComponent(name)}&artistCount=5&albumCount=0&songCount=0`); + const artists = r.searchResult3?.artist || []; + const match = artists.find(a => a.name.toLowerCase() === name.toLowerCase()) || artists[0]; + if(match) navigate('artist-detail', {id: match.id, name: match.name}); + else toast('Künstler nicht gefunden'); + } catch { toast('Suche fehlgeschlagen'); } } export function s_goAlbum(e, albumId, albumName, artist, artistId) {