From 90510bf9e655fd3b432ea945c8260c92422e073d Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sat, 14 Nov 2026 19:26:28 -0800 Subject: [PATCH] Read satellite fire hits in Context only while the FIRMS layer is on FIRMS needs a key the browser cannot see. Without one the proxy answers 503, so Context no longer asks for fire hits unless the FIRMS layer is on. Co-authored-by: Manjunath Paparaju --- src/ui/spotConditions.js | 13 ++++++++++--- src/ui/views/panels/SpotConditions.vue | 8 ++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ui/spotConditions.js b/src/ui/spotConditions.js index 60fa21f20..a03d013c1 100644 --- a/src/ui/spotConditions.js +++ b/src/ui/spotConditions.js @@ -101,15 +101,22 @@ function stormTitle(storm) { /** * Hazards within a radius of a spot, nearest first within each kind: * `[{kind, icon, title, detail, distanceKm, at}]`. Every kind uses the same - * radius, the one Context's radius control sets. + * radius, the one Context's radius control sets. Satellite fire hits need a + * FIRMS key the browser cannot see, so they are read only with `fires`: while + * the FIRMS layer is on, which has found the key works. */ -export async function hazardsNear(lat, lon, radiusKm = 250) { +export async function hazardsNear( + lat, + lon, + radiusKm = 250, + { fires: withFires = false } = {}, +) { const here = { lat, lon }; const [quakeRows, stormSnap, perimeterRows, fireSnap] = await Promise.all([ quakes(), storms(), perimeters(), - fires(), + withFires ? fires() : null, ]); const found = []; const add = (row) => { diff --git a/src/ui/views/panels/SpotConditions.vue b/src/ui/views/panels/SpotConditions.vue index 6e70a3bed..d0da5b0e4 100644 --- a/src/ui/views/panels/SpotConditions.vue +++ b/src/ui/views/panels/SpotConditions.vue @@ -48,6 +48,10 @@ const radiusText = computed(() => t('{n} km', { n: formatNumber(radiusKm.value) const radiusIndex = computed(() => Math.max(0, CONTEXT_RADIUS_STEPS.indexOf(radiusKm.value))); const pickRadius = (index) => setContextRadiusKm(CONTEXT_RADIUS_STEPS[index]); +// Satellite fire hits come only while the FIRMS layer is on (spotConditions.js). +const firesOn = () => + Boolean((omnibar.controls?.layers() || []).find((layer) => layer.id === HAZARD_LAYER.hotspots)?.enabled); + async function read(lat, lon) { if (readAt && distanceKm(readAt, { lat, lon }) <= props.settleKm) return; readAt = { lat, lon }; @@ -56,7 +60,7 @@ async function read(lat, lon) { loading.value = true; const [nextBrief, nextHazards] = await Promise.all([ regionalBrief(lat, lon), - hazardsNear(lat, lon, radiusKm.value).catch(() => []), + hazardsNear(lat, lon, radiusKm.value, { fires: firesOn() }).catch(() => []), ]); if (reading !== mine) return; brief.value = nextBrief; @@ -76,7 +80,7 @@ watch( async function rereadHazards(km) { const at = readAt || { lat: props.lat, lon: props.lon }; const mine = ++readingHazards; - const next = await hazardsNear(at.lat, at.lon, km).catch(() => []); + const next = await hazardsNear(at.lat, at.lon, km, { fires: firesOn() }).catch(() => []); if (readingHazards !== mine) return; hazards.value = next; }