diff --git a/meshview/mqtt_reader.py b/meshview/mqtt_reader.py index dd9412b..df29c73 100644 --- a/meshview/mqtt_reader.py +++ b/meshview/mqtt_reader.py @@ -86,7 +86,8 @@ if SECONDARY_KEYS: else: logger.info("Secondary keys: []") - +# Thank you to "Robert Grizzell" for the decryption code! +# https://github.com/rgrizzell def decrypt(packet, key): if packet.HasField("decoded"): return True diff --git a/meshview/mqtt_store.py b/meshview/mqtt_store.py index 97018d4..1c5015c 100644 --- a/meshview/mqtt_store.py +++ b/meshview/mqtt_store.py @@ -100,6 +100,7 @@ async def process_envelope(topic, env): utc_time = datetime.datetime.fromtimestamp(now_us / 1_000_000, datetime.UTC) dialect = session.get_bind().dialect.name stmt = None + if dialect == "sqlite": stmt = ( sqlite_insert(Packet) diff --git a/meshview/web.py b/meshview/web.py index 223d74f..09486fe 100644 --- a/meshview/web.py +++ b/meshview/web.py @@ -55,6 +55,7 @@ class Packet: from_node: models.Node to_node_id: int to_node: models.Node + channel: str portnum: int data: str raw_mesh_packet: object @@ -102,6 +103,7 @@ class Packet: from_node_id=packet.from_node_id, to_node=packet.to_node, to_node_id=packet.to_node_id, + channel=packet.channel, portnum=packet.portnum, data=text_mesh_packet, payload=text_payload, # now always a string @@ -193,7 +195,6 @@ routes = web.RouteTableDef() @routes.get("/") async def index(request): - """Redirect root URL to configured starting page.""" """ Redirect root URL '/' to the page specified in CONFIG['site']['starting']. Defaults to '/map' if not set. @@ -209,6 +210,7 @@ async def redirect_packet_list(request): packet_id = request.match_info["packet_id"] raise web.HTTPFound(location=f"/node/{packet_id}") + # Generic static HTML route @routes.get("/{page}") async def serve_page(request): diff --git a/meshview/web_api/api.py b/meshview/web_api/api.py index 6af08dc..8b7bdcd 100644 --- a/meshview/web_api/api.py +++ b/meshview/web_api/api.py @@ -129,7 +129,7 @@ async def api_packets(request): "portnum": int(p.portnum) if p.portnum is not None else None, "payload": (p.payload or "").strip(), "import_time_us": p.import_time_us, - "channel": getattr(p.from_node, "channel", ""), + "channel": p.channel, "long_name": getattr(p.from_node, "long_name", ""), } return web.json_response({"packets": [data]}) @@ -214,7 +214,7 @@ async def api_packets(request): packet_dict = { "id": p.id, "import_time_us": p.import_time_us, - "channel": getattr(p.from_node, "channel", ""), + "channel": p.channel, "from_node_id": p.from_node_id, "to_node_id": p.to_node_id, "portnum": int(p.portnum),