add decrypted channel msg to packet details

also caught a bug where we never set the packet as
being decrypted even when it had been
This commit is contained in:
Enot (ded) Skelly committed 2026-06-05 11:06:02 -07:00
1 parent 7aecf2b6b9
commit fdbcad28d8
5 files changed
+73 -2

No files matched your search

+20 -1
View File
@@ -592,9 +592,13 @@ func (q *Queries) GetObserverTelemetry(ctx context.Context, arg GetObserverTelem
}
const getPacketByHash = `-- name: GetPacketByHash :one
SELECT p.packet_hash, p.payload_type, p.payload_version, p.route_type, p.transport_codes_present, p.region_code, p.sub_region_code, p.scope_id, p.origin_pubkey, p.raw_payload, p.raw_header, p.parsed_payload, p.decrypted, p.channel_hash, p.first_heard_at, p.last_heard_at, ts.name AS scope_name
SELECT p.packet_hash, p.payload_type, p.payload_version, p.route_type, p.transport_codes_present, p.region_code, p.sub_region_code, p.scope_id, p.origin_pubkey, p.raw_payload, p.raw_header, p.parsed_payload, p.decrypted, p.channel_hash, p.first_heard_at, p.last_heard_at, ts.name AS scope_name,
cm.sender_name AS cm_sender_name,
cm.content AS cm_content,
cm.sent_at AS cm_sent_at
FROM packets p
LEFT JOIN transport_scopes ts ON ts.id = p.scope_id
LEFT JOIN channel_messages cm ON cm.packet_hash = p.packet_hash
WHERE p.packet_hash = $1
`
@@ -616,6 +620,9 @@ type GetPacketByHashRow struct {
FirstHeardAt pgtype.Timestamptz `json:"first_heard_at"`
LastHeardAt pgtype.Timestamptz `json:"last_heard_at"`
ScopeName *string `json:"scope_name"`
CmSenderName *string `json:"cm_sender_name"`
CmContent *string `json:"cm_content"`
CmSentAt pgtype.Timestamptz `json:"cm_sent_at"`
}
func (q *Queries) GetPacketByHash(ctx context.Context, packetHash []byte) (GetPacketByHashRow, error) {
@@ -639,6 +646,9 @@ func (q *Queries) GetPacketByHash(ctx context.Context, packetHash []byte) (GetPa
&i.FirstHeardAt,
&i.LastHeardAt,
&i.ScopeName,
&i.CmSenderName,
&i.CmContent,
&i.CmSentAt,
)
return i, err
}
@@ -2337,6 +2347,15 @@ func (q *Queries) SetNodeMultibyteTraces(ctx context.Context, id uuid.UUID) erro
return err
}
const setPacketDecrypted = `-- name: SetPacketDecrypted :exec
UPDATE packets SET decrypted = true WHERE packet_hash = $1
`
func (q *Queries) SetPacketDecrypted(ctx context.Context, packetHash []byte) error {
_, err := q.db.Exec(ctx, setPacketDecrypted, packetHash)
return err
}
const updateObserverStatus = `-- name: UpdateObserverStatus :one
UPDATE observers SET
display_name = COALESCE(NULLIF($2, ''), display_name),