diff --git a/meshview/static/live-map.html b/meshview/static/live-map.html
index b1d957f..113d7a0 100644
--- a/meshview/static/live-map.html
+++ b/meshview/static/live-map.html
@@ -79,7 +79,7 @@
legend.appendChild(item);
}
- // Pulse marker animation
+ // Pulse marker animation (dot shrinks but stays full color)
function pulseMarker(marker, highlightColor="red") {
if (!marker) return;
const originalColor = marker.options.originalColor;
@@ -131,11 +131,35 @@
});
const markersWithCoords = Array.from(nodeMarkers.values()).filter(m=>m instanceof L.CircleMarker);
- if(markersWithCoords.length>0) map.fitBounds(L.featureGroup(markersWithCoords).getBounds().pad(0.2));
- else map.setView([37.77,-122.42],9);
+ if(markersWithCoords.length>0) {
+ // Fit bounds from /api/config instead of default
+ await setMapBoundsFromConfig();
+ } else {
+ map.setView([37.77,-122.42],9);
+ }
} catch(err){ console.error(err); }
}
+ // Set map bounds dynamically from /api/config
+ async function setMapBoundsFromConfig() {
+ try {
+ const res = await fetch("/api/config");
+ const config = await res.json();
+ const topLeft = [
+ parseFloat(config.site.map_top_left_lat),
+ parseFloat(config.site.map_top_left_lon)
+ ];
+ const bottomRight = [
+ parseFloat(config.site.map_bottom_right_lat),
+ parseFloat(config.site.map_bottom_right_lon)
+ ];
+ map.fitBounds([topLeft, bottomRight]);
+ } catch(err) {
+ console.error("Failed to load map bounds from config:", err);
+ map.setView([37.77,-122.42],9);
+ }
+ }
+
// Update ticket tape
function updateTicketTape(pkt) {
const nodeId = pkt.from_node_id;
diff --git a/meshview/web.py b/meshview/web.py
index d4e389d..278b314 100644
--- a/meshview/web.py
+++ b/meshview/web.py
@@ -1695,6 +1695,18 @@ async def api_stats(request):
return web.json_response(stats)
+
+
+@routes.get("/api/config")
+async def api_config(request):
+ try:
+ # Return CONFIG as JSON
+ return web.json_response(CONFIG)
+ except Exception as e:
+ return web.json_response({"error": str(e)}, status=500)
+
+
+
# Generic static HTML route
@routes.get("/{page}")
async def serve_page(request):