mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-07 09:12:57 +02:00
fix(v2): Handle bytes expected_ack from meshcore + DM prefix matching
- Convert bytes to hex string for expected_ack and pkt_payload via _to_str() - Support pubkey prefix matching in get_dm_messages() (LIKE for short keys) - Fixes "Object of type bytes is not JSON serializable" error on DM view Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -291,13 +291,20 @@ class Database:
|
||||
offset: int = 0) -> List[Dict]:
|
||||
contact_pubkey = contact_pubkey.lower()
|
||||
with self._connect() as conn:
|
||||
# Support both full key and prefix matching
|
||||
if len(contact_pubkey) < 64:
|
||||
condition = "contact_pubkey LIKE ?"
|
||||
param = contact_pubkey + '%'
|
||||
else:
|
||||
condition = "contact_pubkey = ?"
|
||||
param = contact_pubkey
|
||||
rows = conn.execute(
|
||||
"""SELECT * FROM (
|
||||
f"""SELECT * FROM (
|
||||
SELECT * FROM direct_messages
|
||||
WHERE contact_pubkey = ?
|
||||
WHERE {condition}
|
||||
ORDER BY timestamp DESC LIMIT ? OFFSET ?
|
||||
) ORDER BY timestamp ASC""",
|
||||
(contact_pubkey, limit, offset)
|
||||
(param, limit, offset)
|
||||
).fetchall()
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user