From 4ce68dd9a0e3e577f67b4e832c09e92e3bc1323e Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sat, 18 May 2024 22:05:37 +1200 Subject: [PATCH] implement api to get path table --- web.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web.py b/web.py index 5bc736f..a89a9de 100644 --- a/web.py +++ b/web.py @@ -217,6 +217,21 @@ class ReticulumWebChat: "interface_stats": interface_stats, }) + # get path table + @routes.get("/api/v1/path-table") + async def index(request): + + # get path table, making sure hash and via are in hex as json_response can't serialize bytes + path_table = [] + for path in self.reticulum.get_path_table(): + path["hash"] = path["hash"].hex() + path["via"] = path["via"].hex() + path_table.append(path) + + return web.json_response({ + "path_table": path_table, + }) + # delete lxmf message @routes.delete("/api/v1/lxmf-messages/{id}") async def index(request):