New GET /api/v1/art/album?artist=&album= resolves and streams an album's cover art. Lookups go through MusicBrainz release-group search then Cover Art Archive's release-group front-image endpoint, both free and keyless - no setup required by self-hosters. Results (hits, misses and errors) are cached in a new album_art table keyed case-insensitively on (artist, album), since Scrobble.mbid can't be trusted as a release identifier. The service layer separates resolving where the art is (lookup()) from fetching the bytes (fetch_image()) so a future move to storing the bytes ourselves only touches the latter. Also widens the UI's CSP (img-src) to allow blob: URLs, since the frontend will fetch art with the existing bearer-auth header and hand the browser a blob: object URL rather than hotlinking. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
33 lines
1.3 KiB
Plaintext
33 lines
1.3 KiB
Plaintext
# Rendered by the nginx image's envsubst step (API_BASE_URL comes from the environment).
|
|
|
|
# Behind a TLS proxy, keep its scheme; otherwise use ours.
|
|
map $http_x_forwarded_proto $scrobbler_forwarded_proto {
|
|
default $http_x_forwarded_proto;
|
|
"" $scheme;
|
|
}
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
server_tokens off;
|
|
|
|
# add_header isn't inherited by locations that set their own, so the security
|
|
# headers live in the location that serves pages.
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
# Files aren't fingerprinted, so always revalidate.
|
|
add_header Cache-Control "no-cache";
|
|
add_header Content-Security-Policy "default-src 'self'; connect-src 'self' ${API_BASE_URL}; img-src 'self' data: blob:; style-src 'self'; font-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'" always;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header Referrer-Policy same-origin always;
|
|
}
|
|
|
|
# Fediverse paths forwarded to the API (written at start-up; empty if API_INTERNAL_URL is unset).
|
|
include /etc/nginx/scrobbler/federation.conf;
|
|
|
|
location /fonts/ {
|
|
add_header Cache-Control "public, max-age=2592000, immutable";
|
|
}
|
|
}
|