From b6e0ef1c3c7beb7510e2f9e3dfe9bbcf3cc33061 Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Sun, 7 Jun 2026 10:30:14 -0300 Subject: [PATCH] fix: load album art via fetch+blob to bypass WebEngine URL restrictions Direct background-image URLs to external hosts are blocked in the local WebEngineView context; fetch the image as a blob and convert to data URL instead. Co-Authored-By: Claude Sonnet 4.6 --- plugin/contents/ui/dancer.html | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/plugin/contents/ui/dancer.html b/plugin/contents/ui/dancer.html index 35aab65..1fbf1bd 100644 --- a/plugin/contents/ui/dancer.html +++ b/plugin/contents/ui/dancer.html @@ -1053,15 +1053,29 @@ function applyTheme(rgb) { const albumArtEl = document.getElementById('albumArt'); +let lastArtUrl = ''; + +function setAlbumArt(url) { + if (!url || url === lastArtUrl) return; + lastArtUrl = url; + fetch(url) + .then(r => r.blob()) + .then(blob => { + const reader = new FileReader(); + reader.onload = () => { + albumArtEl.style.backgroundImage = `url('${reader.result}')`; + }; + reader.readAsDataURL(blob); + }) + .catch(() => {}); +} + function fetchTheme() { fetch('http://127.0.0.1:8765/current') .then(r => r.json()) .then(d => { if (d.rgb) applyTheme(d.rgb); - if (d.art_url) { - albumArtEl.style.backgroundImage = `url('${d.art_url}')`; - albumArtEl.style.opacity = '1'; - } + if (d.art_url) setAlbumArt(d.art_url); }) .catch(() => {}); }