From 76406ea778e87b9a60fa6156e96d3a658b519a52 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Sat, 30 May 2026 21:16:49 -0700 Subject: [PATCH] Support using the graphs service for traceroute graph links --- mqttbridge/README.md | 2 ++ mqttbridge/mqtt.py | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mqttbridge/README.md b/mqttbridge/README.md index 84826b4..37ab0c6 100644 --- a/mqttbridge/README.md +++ b/mqttbridge/README.md @@ -53,6 +53,7 @@ The MqttBridge cog connects your Discord server to a Meshtastic MQTT broker, ena - SNR (Signal-to-Noise Ratio) data - Network topology insights - **MeshView Integration**: Direct links to visualize routes on MeshView +- **Graphs Service Integration**: Multiple graph views for route analysis (full, outbound, reply) ### Node Ownership System - **Node Claiming**: Users can claim ownership of their nodes through a secure verification process @@ -86,6 +87,7 @@ The MqttBridge cog connects your Discord server to a Meshtastic MQTT broker, ena - **`!mqtt meshviewdomain `**: Set MeshView instance URL for packet links - **`!mqtt mapdomain `**: Set map service URL for location links - **`!mqtt metricsdomain `**: Set metrics dashboard URL +- **`!mqtt graphsdomain `**: Set graphs service URL for traceroute visualizations #### Node Administration (`!nodeadmin` commands) - **`!nodeadmin unclaim `**: Remove ownership from a node diff --git a/mqttbridge/mqtt.py b/mqttbridge/mqtt.py index 54255a1..66f965e 100644 --- a/mqttbridge/mqtt.py +++ b/mqttbridge/mqtt.py @@ -38,6 +38,7 @@ def __init__(self, bot): "meshview_domain": None, "map_domain": None, "metrics_domain": None, + "graphs_domain": None, "enabled": False } @@ -1208,7 +1209,13 @@ async def process_traceroute(self, mp, se): name="Links", value=( f"[View Packet on MeshView]({settings['meshview_domain']}/packet/{mp.id})\n" - f"[View Graph on MeshView]({settings['meshview_domain']}/graph/traceroute/{mp.id})\n" + + ( "View graphs: " + f"[Full Graph]({settings['graphs_domain']}/graph/trace/{mp.id}) | " + f"[Outbound]({settings['graphs_domain']}/graph/trace/{mp.id}?direction=out) | " + f"[Reply]({settings['graphs_domain']}/graph/trace/{mp.id}?direction=in)" + if settings.get('graphs_domain') + else f"[View Graph on MeshView]({settings['meshview_domain']}/graph/traceroute/{mp.id})" + ) ), inline=False ) @@ -1741,6 +1748,12 @@ async def set_metrics_domain(self, ctx: commands.Context, domain: str): await self.config.metrics_domain.set(domain) await ctx.send(f"Links will use metrics domain: {domain}") + @mqtt.command(name="graphsdomain") + async def set_graphs_domain(self, ctx: commands.Context, domain: str): + """Set the graphs domain for traceroute links""" + await self.config.graphs_domain.set(domain) + await ctx.send(f"Graphs links will use domain: {domain}") + @mqtt.command(name="enable") async def enable_bridge(self, ctx: commands.Context): """Enable the MQTT bridge""" @@ -1795,6 +1808,9 @@ async def bridge_status(self, ctx: commands.Context): if settings["metrics_domain"]: embed.add_field(name="Metrics Domain", value=settings["metrics_domain"]) + + if settings["graphs_domain"]: + embed.add_field(name="Graphs Domain", value=settings["graphs_domain"]) await ctx.send(embed=embed) @@ -3016,4 +3032,4 @@ async def on_timeout(self): for item in self.children: item.disabled = True if hasattr(item, 'label'): - item.label = "Expired" \ No newline at end of file + item.label = "Expired"