diff --git a/web/src/lib/media/covers.ts b/web/src/lib/media/covers.ts new file mode 100644 index 00000000..1f46f404 --- /dev/null +++ b/web/src/lib/media/covers.ts @@ -0,0 +1,16 @@ +// Fallback cover — an inline SVG data URL showing a music-note glyph on the +// surface color. Used by AlbumCard's onerror handler when the real cover +// fails (e.g. scanner didn't pick up an embedded image and there's no +// sidecar). Data URL avoids an extra HTTP round-trip. +export const FALLBACK_COVER = + 'data:image/svg+xml;utf8,' + + encodeURIComponent( + ` + + + ` + ); + +export function coverUrl(albumId: string): string { + return `/api/albums/${albumId}/cover`; +}