diff --git a/search-app/live-search.js b/search-app/live-search.js index f685f9d..5089382 100644 --- a/search-app/live-search.js +++ b/search-app/live-search.js @@ -961,9 +961,13 @@ // Get (or create) an Immich API key for the heatmap iframe so the user // isn't prompted to paste one. Cached in this origin's localStorage. - async function getHeatmapApiKey() { - const cached = localStorage.getItem('ls-heatmap-api-key'); - if (cached) return cached; + // Uses the ['all'] permission so the heatmap's /api/search/metadata and + // thumbnail fetches never 403. + async function getHeatmapApiKey(force) { + if (!force) { + const cached = localStorage.getItem('ls-heatmap-api-key'); + if (cached) return cached; + } try { const r = await fetch('/api/api-keys', { method: 'POST', @@ -971,11 +975,11 @@ credentials: 'include', body: JSON.stringify({ name: 'Heatmap iframe (auto)', - permissions: ['asset.read', 'asset.view'] + permissions: ['all'] }) }); if (!r.ok) { - console.warn('[live-search] api-key create failed', r.status); + console.warn('[live-search] api-key create failed', r.status, await r.text().catch(() => '')); return null; } const j = await r.json(); @@ -997,17 +1001,28 @@ banner.innerHTML = `