diff --git a/js/layers/fires.js b/js/layers/fires.js index 01062b0..ebc1ea2 100644 --- a/js/layers/fires.js +++ b/js/layers/fires.js @@ -59,7 +59,7 @@ export default function create(ctx) { if (!loc) continue; const title = ev.title || 'Wildfire'; const category = (ev.categories && ev.categories[0] && ev.categories[0].title) || 'Wildfires'; - const link = ev.link || (ev.id ? `https://eonet.gsfc.nasa.gov/api/v3/events/${ev.id}` : null); + const link = lib.safeUrl(ev.link || (ev.id ? `https://eonet.gsfc.nasa.gov/api/v3/events/${encodeURIComponent(ev.id)}` : '')); const dateTxt = loc.date ? new Date(loc.date).toISOString().replace('T', ' ').replace('.000Z', ' UTC') : '—'; ds.entities.add({ @@ -88,11 +88,11 @@ export default function create(ctx) { }, description: `
| Event | ${title} |
|---|---|
| Category | ${category} |
| Event | ${lib.escapeHtml(title)} |
| Category | ${lib.escapeHtml(category)} |
| Last report | ${dateTxt} |
Active wildfire event from NASA EONET (real data).
`, }); count++; diff --git a/js/layers/quakes.js b/js/layers/quakes.js index 02f30d1..d8c252a 100644 --- a/js/layers/quakes.js +++ b/js/layers/quakes.js @@ -64,7 +64,8 @@ export default function create(ctx) { const depth = coords[2]; const mag = p.mag; const timeMs = p.time; - const place = p.place || 'Unknown location'; + const place = p.place || 'Unknown location'; // raw: used in name/label (text contexts) + const url = lib.safeUrl(p.url); const size = baseSize(mag); const color = magColor(mag); const recentAtBuild = typeof timeMs === 'number' && (Date.now() - timeMs) < 3_600_000; @@ -93,11 +94,11 @@ export default function create(ctx) { description: `| Magnitude | M${mag.toFixed(1)} |
|---|---|
| Place | ${place} |
| Place | ${lib.escapeHtml(place)} |
| Depth | ${depth != null ? depth.toFixed(1) + ' km' : '—'} |
| Time (UTC) | ${timeMs != null ? new Date(timeMs).toISOString().replace('T', ' ').replace('.000Z', ' UTC') : '—'} |