mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Added Map capabilities
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<br><div style="text-align:center"><strong>Bay Area Mesh - http://bayme.sh</strong></div>
|
||||
<div style="text-align:center">Quick Links: <a href="/nodelist">Nodes</a> - <a href="/chat">Conversations</a> - <a href="/firehose">See <strong>everything</strong> </a>
|
||||
- Mesh Graph <a href="/graph/longfast">LF</a> - <a href="/graph/mediumslow">MS </a> - <a href="/stats">Stats </a>
|
||||
- <a href="/net">Weekly Net</a></div><br>
|
||||
- <a href="/net">Weekly Net</a> - <a href="/map">Map</a></div><br>
|
||||
<div id="spinner" class="spinner-border secondary-primary htmx-indicator position-absolute top-50 start-50" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
|
||||
+20
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user