mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
use ruff format
This commit is contained in:
+17
-17
@@ -431,8 +431,6 @@ async def packet_details_firehose(request):
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@routes.get("/packet/{packet_id}")
|
||||
async def packet(request):
|
||||
try:
|
||||
@@ -1126,11 +1124,7 @@ async def net(request):
|
||||
@routes.get("/map")
|
||||
async def map(request):
|
||||
template = env.get_template("map.html")
|
||||
return web.Response(
|
||||
text=template.render(),
|
||||
content_type="text/html"
|
||||
)
|
||||
|
||||
return web.Response(text=template.render(), content_type="text/html")
|
||||
|
||||
|
||||
@routes.get("/stats")
|
||||
@@ -1332,6 +1326,7 @@ async def nodegraph(request):
|
||||
content_type="text/html",
|
||||
)
|
||||
|
||||
|
||||
# API Section
|
||||
#######################################################################
|
||||
# How this works
|
||||
@@ -1487,7 +1482,6 @@ async def api_nodes(request):
|
||||
return web.json_response({"error": "Failed to fetch nodes"}, status=500)
|
||||
|
||||
|
||||
|
||||
@routes.get("/api/packets")
|
||||
async def api_packets(request):
|
||||
try:
|
||||
@@ -1511,14 +1505,16 @@ async def api_packets(request):
|
||||
for p in packets:
|
||||
payload = (p.payload or "").strip()
|
||||
|
||||
packets_json.append({
|
||||
"id": p.id,
|
||||
"from_node_id": p.from_node_id,
|
||||
"to_node_id": p.to_node_id,
|
||||
"portnum": int(p.portnum) if p.portnum is not None else None,
|
||||
"import_time": p.import_time.isoformat(),
|
||||
"payload": payload,
|
||||
})
|
||||
packets_json.append(
|
||||
{
|
||||
"id": p.id,
|
||||
"from_node_id": p.from_node_id,
|
||||
"to_node_id": p.to_node_id,
|
||||
"portnum": int(p.portnum) if p.portnum is not None else None,
|
||||
"import_time": p.import_time.isoformat(),
|
||||
"payload": payload,
|
||||
}
|
||||
)
|
||||
|
||||
return web.json_response({"packets": packets_json})
|
||||
|
||||
@@ -1622,6 +1618,7 @@ async def api_edges(request):
|
||||
|
||||
return web.json_response({"edges": edges_list})
|
||||
|
||||
|
||||
@routes.get("/api/config")
|
||||
async def api_config(request):
|
||||
try:
|
||||
@@ -1678,7 +1675,9 @@ async def api_config(request):
|
||||
"map_bottom_right_lon": get_float(site, "map_bottom_right_lon", -121.0),
|
||||
"map_interval": get_int(site, "map_interval", 3),
|
||||
"firehose_interval": get_int(site, "firehose_interval", 3),
|
||||
"weekly_net_message": get_str(site, "weekly_net_message", "Weekly Mesh check-in message."),
|
||||
"weekly_net_message": get_str(
|
||||
site, "weekly_net_message", "Weekly Mesh check-in message."
|
||||
),
|
||||
"net_tag": get_str(site, "net_tag", "#BayMeshNet"),
|
||||
"version": str(SOFTWARE_RELEASE),
|
||||
}
|
||||
@@ -1687,6 +1686,7 @@ async def api_config(request):
|
||||
mqtt = CONFIG.get("mqtt", {})
|
||||
topics_raw = get(mqtt, "topics", [])
|
||||
import json
|
||||
|
||||
if isinstance(topics_raw, str):
|
||||
try:
|
||||
topics = json.loads(topics_raw)
|
||||
|
||||
Reference in New Issue
Block a user