mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Fix how we show the actual channel on the packet list.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user