From 828273a78f3e892ccf175dd323849b65523881cb Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 23 Apr 2026 08:23:59 -0400 Subject: [PATCH] feat(web): add cover URL helper + fallback SVG data URL --- web/src/lib/media/covers.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 web/src/lib/media/covers.ts 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`; +}