diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..5760cde --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index fae142f..9d36d55 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ This project watches a MQTT topic for meshtastic messages, imports them to a database and has a web UI to view them. -Requires **`python3.12`** and **`graphviz`**. +An example of a currently running instace for the San Francisco Bay Area mesh runs at https://meshview.bayme.sh + +Requires **`python3.11`** or above. ## Preparing @@ -17,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: @@ -30,7 +34,7 @@ sudo apt-get install graphviz Edit `config.ini` to change the MQTT server, username, password, and topic(s) as necessary. You may also change the web server port from the ***default 8081***. -https://github.com/madeofstown/meshview/blob/c9d65a078af5e71a6815c142dbb11e5868f8885b/config.ini#L1-L15 +https://github.com/pablorevilla-meshtastic/meshview/blob/20bc89a21feb23b0dde51e10e21638c11f4e4443/config.ini#L1-L15 ## Running Meshview diff --git a/images/main.png b/images/main.png deleted file mode 100644 index d2aab24..0000000 Binary files a/images/main.png and /dev/null differ 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 a8c6183..2669546 100644 --- a/meshview/web.py +++ b/meshview/web.py @@ -307,19 +307,7 @@ async def _packet_list(request, raw_packets, packet_event): @routes.get("/chat_events") async def chat_events(request): - """ - Server-Sent Events (SSE) endpoint for real-time chat packet updates. - This endpoint listens for new chat packets related to `PortNum.TEXT_MESSAGE_APP` - and streams them to connected clients. Messages matching the pattern `"seq \d+$"` - are filtered out before sending. - - Args: - request (aiohttp.web.Request): The incoming HTTP request. - - Returns: - aiohttp.web.StreamResponse: SSE response streaming chat events. - """ chat_packet = env.get_template("chat_packet.html") # Precompile regex for filtering out unwanted messages (case insensitive) @@ -356,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 @@ -451,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 @@ -1585,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, @@ -1629,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) diff --git a/screenshots/conversations.png b/screenshots/conversations.png new file mode 100644 index 0000000..0f969cf Binary files /dev/null and b/screenshots/conversations.png differ diff --git a/screenshots/firehose.png b/screenshots/firehose.png new file mode 100644 index 0000000..00a6280 Binary files /dev/null and b/screenshots/firehose.png differ diff --git a/screenshots/main.png b/screenshots/main.png new file mode 100644 index 0000000..98b203d Binary files /dev/null and b/screenshots/main.png differ diff --git a/screenshots/map.png b/screenshots/map.png new file mode 100644 index 0000000..886cb4d Binary files /dev/null and b/screenshots/map.png differ diff --git a/screenshots/node_details.png b/screenshots/node_details.png new file mode 100644 index 0000000..364e058 Binary files /dev/null and b/screenshots/node_details.png differ diff --git a/screenshots/nodes.png b/screenshots/nodes.png new file mode 100644 index 0000000..bff450d Binary files /dev/null and b/screenshots/nodes.png differ diff --git a/screenshots/statistics.png b/screenshots/statistics.png new file mode 100644 index 0000000..343fa3d Binary files /dev/null and b/screenshots/statistics.png differ