Files
minstrel/web/src/lib/media/covers.ts
T
bvandeusenandClaude Opus 4.7 564e0bf7ca feat(web): use static SVG asset for album fallback cover
Replaces the hand-rolled inline-data-URL placeholder with a static SVG
asset at /placeholders/album-fallback.svg. SvelteKit's adapter-static
publishes everything in web/static/ at the URL root and the Go binary
embeds the build output, so this resolves identically in dev and prod.

Operator can swap the artwork by replacing the file — no code changes.

Test updated to use toContain rather than strict equality, since jsdom
resolves relative URLs against the test origin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 23:21:25 -04:00

12 lines
594 B
TypeScript

// Fallback cover used when the real cover fails to load (e.g. scanner
// didn't pick up embedded art and there's no sidecar). Served as a static
// asset from web/static/placeholders/ so the operator can swap the artwork
// without touching code. SvelteKit + adapter-static publishes everything
// under web/static/ at the URL root, and the Go binary embeds the build
// output, so this resolves identically in dev and production.
export const FALLBACK_COVER = '/placeholders/album-fallback.svg';
export function coverUrl(albumId: string): string {
return `/api/albums/${albumId}/cover`;
}