diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 1263ff7..780ac8f 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -27,6 +27,22 @@ .filter-checkbox { margin: 0 10px; } + #share-button { + margin-left: 20px; + padding: 5px 15px; + background-color: #4CAF50; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 14px; + } + #share-button:hover { + background-color: #45a049; + } + #share-button:active { + background-color: #3d8b40; + } .blinking-tooltip { background: white; color: black; @@ -42,6 +58,9 @@
Show Routers Only
+
+ +
diff --git a/meshview/web.py b/meshview/web.py index ad36c4e..87cea2b 100644 --- a/meshview/web.py +++ b/meshview/web.py @@ -1135,11 +1135,30 @@ async def map(request): for node in nodes: if hasattr(node, "last_update") and isinstance(node.last_update, datetime.datetime): node.last_update = node.last_update.isoformat() + + # Parse optional URL parameters for custom view + map_center_lat = request.query.get("lat") + map_center_lng = request.query.get("lng") + map_zoom = request.query.get("zoom") + + # Validate and convert parameters if provided + custom_view = None + if map_center_lat and map_center_lng: + try: + lat = float(map_center_lat) + lng = float(map_center_lng) + zoom = int(map_zoom) if map_zoom else 13 + custom_view = {"lat": lat, "lng": lng, "zoom": zoom} + except (ValueError, TypeError): + # Invalid parameters, ignore and use defaults + pass + template = env.get_template("map.html") return web.Response( text=template.render( nodes=nodes, + custom_view=custom_view, site_config=CONFIG, SOFTWARE_RELEASE=SOFTWARE_RELEASE), content_type="text/html",