diff --git a/README.md b/README.md index 6ca0611..8a15064 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ git clone --recurse-submodules https://github.com/pablorevilla-meshtastic/meshvi Create a python virtual environment: ``` bash cd meshview +``` +``` bash python3 -m venv env ``` Install the environment requirements: diff --git a/meshview/templates/base.html b/meshview/templates/base.html index c089e4d..c21c916 100644 --- a/meshview/templates/base.html +++ b/meshview/templates/base.html @@ -36,7 +36,7 @@
Bay Area Mesh - http://bayme.sh
Quick Links:  Nodes - Conversations - See everything  - Mesh Graph LF - MS  - Stats -  - Weekly Net

+  - Weekly Net - Map
Loading...
diff --git a/meshview/web.py b/meshview/web.py index 4956426..2669546 100644 --- a/meshview/web.py +++ b/meshview/web.py @@ -344,7 +344,7 @@ async def chat_events(request): ) except ConnectionResetError: # Log when a client disconnects unexpectedly - logging.warning("Client disconnected from SSE stream.") + print("Client disconnected from SSE stream.") return # Exit the loop and close the connection @@ -439,7 +439,7 @@ async def events(request): ) except ConnectionResetError: - logging.warning("Client disconnected from SSE stream.") + print("Client disconnected from SSE stream.") return # Gracefully exit on disconnection @dataclass @@ -1573,7 +1573,7 @@ async def net(request): raise # Let aiohttp handle HTTP exceptions properly except Exception as e: - logging.exception("Error processing chat request") + print("Error processing chat request") return web.Response( text="An internal server error occurred.", status=500, @@ -1617,6 +1617,23 @@ async def net_events(request): return # Gracefully exit on disconnection +@routes.get("/map") +async def map(request): + try: + nodes= await store.get_nodes() + template = env.get_template("map.html") + return web.Response( + text=template.render(nodes=nodes), + content_type="text/html", + ) + except Exception as e: + + return web.Response( + text="An error occurred while processing your request.", + status=500, + content_type="text/plain", + ) + async def run_server(bind, port, tls_cert): app = web.Application() app.add_routes(routes)