From c572f0ee608e6cc152d8f2962ff17eb6af23fd39 Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Sat, 14 Nov 2026 00:30:04 -0500 Subject: [PATCH 01/14] fix(hud): hide vessel and FIRMS rows when those feeds are unset Read feeds.vessels.configured and feeds.fires.configured from /api/stats. A missing feeds object leaves both rows visible. WFIGS and trains stay. --- app/static/index.html | 18 +++++ tests/test_feed_rail.py | 152 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 tests/test_feed_rail.py diff --git a/app/static/index.html b/app/static/index.html index acca754..956f4d5 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -1508,6 +1508,23 @@ function setLayerCount(id, value) { } } +function applyFeedConfig(s) { + // Hide only when /api/stats says the key is unset. Missing feeds (old image) + // leaves both rows visible. Never infer from a zero count. Never touch WFIGS or trains. + const feeds = (s && typeof s.feeds === 'object' && s.feeds) ? s.feeds : null; + setFeedRow('lp-vessels-on', feeds && feeds.vessels); + setFeedRow('lp-fires-on', feeds && feeds.fires); +} +function setFeedRow(id, flag) { + const el = document.getElementById(id); + const row = el && el.closest ? el.closest('.lp-layer') : null; + if (!row) return; + const hide = !!(flag && flag.configured === false); + row.hidden = hide; + // .lp-layer { display:flex } beats the UA [hidden] rule — inline display is what hides it. + row.style.display = hide ? 'none' : ''; +} + async function pollLayerStats() { if (statsPollDisabled) return; try { @@ -1516,6 +1533,7 @@ async function pollLayerStats() { if (!r.ok) return; const s = await r.json(); if (!s || typeof s !== 'object') return; + applyFeedConfig(s); statsRailActive = true; const skipIfOn = { fires: firesOn, diff --git a/tests/test_feed_rail.py b/tests/test_feed_rail.py new file mode 100644 index 0000000..cde7d53 --- /dev/null +++ b/tests/test_feed_rail.py @@ -0,0 +1,152 @@ +"""Layer rail hides Vessels and FIRMS only when /api/stats says the key is unset.""" + +from __future__ import annotations + +import json +import subprocess +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +HTML = (ROOT / "app/static/index.html").read_text() + + +def _between(start: str, end: str) -> str: + return HTML.split(start, 1)[1].split(end, 1)[0] + + +def _feed_fns() -> str: + return _between("function applyFeedConfig", "async function pollLayerStats") + + +def _layer_chunk(elem_id: str) -> str: + idx = HTML.index(f'id="{elem_id}"') + start = HTML.rfind(' +
+
+ + 0 +
+
@@ -1121,6 +1144,7 @@
CAMS —
BLIPS —
NEWS —
+
ARTICLES —