From 8dec274045230f73e5cd7a8e2021a108eab462a7 Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Fri, 12 Sep 2025 17:42:19 -0700 Subject: [PATCH] New charts added to stats as we have access not to nodes via API --- meshview/templates/firehose.html | 28 ++++++------------- meshview/templates/map.html | 48 +++++++++++--------------------- meshview/web.py | 10 +++++-- 3 files changed, 33 insertions(+), 53 deletions(-) diff --git a/meshview/templates/firehose.html b/meshview/templates/firehose.html index 72c8120..22ac346 100644 --- a/meshview/templates/firehose.html +++ b/meshview/templates/firehose.html @@ -6,20 +6,6 @@ margin: 0 auto; } - /* Removed .packet-fade-in animation CSS */ - /* - .packet-fade-in { - animation: fadeIn 0.5s ease forwards; - opacity: 0; - } - - @keyframes fadeIn { - to { - opacity: 1; - } - } - */ - #pause-button { white-space: nowrap; padding: 2px 8px; @@ -58,8 +44,12 @@ let lastTime = null; let portnum = "{{ portnum if portnum is not none else '' }}"; let updatesPaused = false; +// Use firehose_interval from config (seconds), default to 3s if not set +const firehoseInterval = {{ site_config["site"]["firehose_interal"] | default(3) }}; +if (firehoseInterval < 0) firehoseInterval = 0; + function fetchUpdates() { - if (updatesPaused) return; + if (updatesPaused || firehoseInterval === 0) return; const url = new URL("/firehose/updates", window.location.origin); if (lastTime) url.searchParams.set("last_time", lastTime); @@ -74,7 +64,6 @@ function fetchUpdates() { for (const html of data.packets.reverse()) { list.insertAdjacentHTML("afterbegin", html); - // No animation here anymore } } }) @@ -86,7 +75,6 @@ function fetchUpdates() { document.addEventListener("DOMContentLoaded", () => { const pauseBtn = document.getElementById("pause-button"); - // Assuming you have a portnum selector somewhere (not shown in your snippet) const portnumSelector = document.querySelector('select[name="portnum"]'); if (portnumSelector) { portnumSelector.addEventListener("change", (e) => { @@ -102,9 +90,11 @@ document.addEventListener("DOMContentLoaded", () => { pauseBtn.textContent = updatesPaused ? "Resume" : "Pause"; }); - // Start fetching updates + // Start fetching updates with configurable interval fetchUpdates(); - setInterval(fetchUpdates, 1000); + if (firehoseInterval > 0) { + setInterval(fetchUpdates, firehoseInterval * 1000); + } }); diff --git a/meshview/templates/map.html b/meshview/templates/map.html index c0320a5..e476d81 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -46,11 +46,9 @@ - - - + crossorigin> {% endblock %} diff --git a/meshview/web.py b/meshview/web.py index f2660c3..ff7af8a 100644 --- a/meshview/web.py +++ b/meshview/web.py @@ -178,10 +178,16 @@ env.filters["node_id_to_hex"] = node_id_to_hex env.filters["format_timestamp"] = format_timestamp routes = web.RouteTableDef() -# Make the Map the home page @routes.get("/") async def index(request): - raise web.HTTPFound(location="/map") + """ + Redirect root URL '/' to the page specified in CONFIG['site']['starting']. + Defaults to '/map' if not set. + """ + # Get the starting page from config + starting_url = CONFIG["site"].get("starting", "/map") # default to /map if not set + raise web.HTTPFound(location=starting_url) + def generate_response(request, body, raw_node_id="", node=None):