fix(web): show non-Japanese names as-is with Romaji on (e.g. ☆NoAki☆ kept its stars)
With 'show Romaji' enabled, dispArtist/dispArtistById/dispArtistParts/dispTitle substituted the sort tag for the display name unconditionally. For non-Japanese names the sort tag is just a sort key (leading symbols/articles stripped, so '☆NoAki☆' → 'NoAki'), which wrongly replaced the real name. Guard the substitution on the original being Japanese — mirroring what dispAlbumName already did — so Romaji only applies to Japanese names and everything else shows unchanged. SW cache -> ns-v73. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
d195518dfb
commit
16f76a4236
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const CACHE = 'ns-v72';
|
const CACHE = 'ns-v73';
|
||||||
const PRECACHE = ['/', 'index.html', 'manifest.json', 'icon.svg'];
|
const PRECACHE = ['/', 'index.html', 'manifest.json', 'icon.svg'];
|
||||||
const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js'];
|
const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js'];
|
||||||
// Auth token params stripped from cache keys so artwork survives across sessions/token refreshes.
|
// Auth token params stripped from cache keys so artwork survives across sessions/token refreshes.
|
||||||
|
|||||||
@@ -198,6 +198,9 @@ export function dispArtistById(id, name) {
|
|||||||
if (!S.cfg.showRomaji) return name || '';
|
if (!S.cfg.showRomaji) return name || '';
|
||||||
const ov = getRomajiOverrides();
|
const ov = getRomajiOverrides();
|
||||||
if (name && ov[name]) return ov[name];
|
if (name && ov[name]) return ov[name];
|
||||||
|
// Only romanize Japanese names — for non-JP names the sort tag is a sort key (symbols/articles
|
||||||
|
// stripped, e.g. "☆NoAki☆" → "NoAki"), not a romaji, so it must not replace the display name.
|
||||||
|
if (!_isJp(name || '')) return name || '';
|
||||||
const sort = _artistSortMap?.get(String(id));
|
const sort = _artistSortMap?.get(String(id));
|
||||||
if (sort) return sort;
|
if (sort) return sort;
|
||||||
return _artistRomajiMap?.get(String(id)) || name || '';
|
return _artistRomajiMap?.get(String(id)) || name || '';
|
||||||
@@ -225,6 +228,7 @@ export function dispTitle(s) {
|
|||||||
if (!S.cfg.showRomaji) return s.title || '';
|
if (!S.cfg.showRomaji) return s.title || '';
|
||||||
const ov = getRomajiOverrides();
|
const ov = getRomajiOverrides();
|
||||||
if (s.title && ov[s.title]) return ov[s.title];
|
if (s.title && ov[s.title]) return ov[s.title];
|
||||||
|
if (!_isJp(s.title || '')) return s.title || ''; // non-JP title → sort tag is not a romaji
|
||||||
const st = s.sortName || s.titleSort;
|
const st = s.sortName || s.titleSort;
|
||||||
if (st && !_isJp(st)) return st;
|
if (st && !_isJp(st)) return st;
|
||||||
return romajiLookup(s.id)?.titleRomaji || s.title || '';
|
return romajiLookup(s.id)?.titleRomaji || s.title || '';
|
||||||
@@ -236,6 +240,7 @@ export function dispArtist(s) {
|
|||||||
const ov = getRomajiOverrides();
|
const ov = getRomajiOverrides();
|
||||||
if (s.artist && ov[s.artist]) return ov[s.artist];
|
if (s.artist && ov[s.artist]) return ov[s.artist];
|
||||||
if (s.albumArtist && ov[s.albumArtist]) return ov[s.albumArtist];
|
if (s.albumArtist && ov[s.albumArtist]) return ov[s.albumArtist];
|
||||||
|
if (!_isJp(s.artist || '')) return s.artist || ''; // non-JP artist → no romaji substitution
|
||||||
return romajiLookup(s.id)?.artistRomaji || s.artist || '';
|
return romajiLookup(s.id)?.artistRomaji || s.artist || '';
|
||||||
}
|
}
|
||||||
// Songs don't carry album sort — Navidrome only puts sortName on album objects.
|
// Songs don't carry album sort — Navidrome only puts sortName on album objects.
|
||||||
@@ -254,6 +259,7 @@ export function dispArtistParts(s, parseArtistsFn) {
|
|||||||
const ov = getRomajiOverrides();
|
const ov = getRomajiOverrides();
|
||||||
if (s.artist && ov[s.artist]) return [{ name: ov[s.artist], originalName: s.artist, id: parts[0]?.id || '' }];
|
if (s.artist && ov[s.artist]) return [{ name: ov[s.artist], originalName: s.artist, id: parts[0]?.id || '' }];
|
||||||
if (s.albumArtist && ov[s.albumArtist]) return [{ name: ov[s.albumArtist], originalName: s.albumArtist, id: parts[0]?.id || '' }];
|
if (s.albumArtist && ov[s.albumArtist]) return [{ name: ov[s.albumArtist], originalName: s.albumArtist, id: parts[0]?.id || '' }];
|
||||||
|
if (!_isJp(s.artist || parts[0]?.name || '')) return parts; // non-JP artist → keep original (e.g. ☆NoAki☆)
|
||||||
const st = s.sortArtist || s.artistSort;
|
const st = s.sortArtist || s.artistSort;
|
||||||
if (st && !_isJp(st)) return [{ name: st, originalName: s.artist || parts[0]?.name || '', id: parts[0]?.id || '' }];
|
if (st && !_isJp(st)) return [{ name: st, originalName: s.artist || parts[0]?.name || '', id: parts[0]?.id || '' }];
|
||||||
const info = romajiLookup(s.id);
|
const info = romajiLookup(s.id);
|
||||||
|
|||||||
Reference in new issue
Block a user