mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-07 01:03:15 +02:00
fix(dm): don't require contact in mc.contacts to send DM
When the contact is not found in the in-memory mc.contacts dict, fall back to passing the pubkey hex string directly to send_msg() which handles it natively. Fixes "Contact not found" error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -827,13 +827,14 @@ class DeviceManager:
|
||||
return {'success': False, 'error': 'Device not connected'}
|
||||
|
||||
try:
|
||||
# Find contact by pubkey
|
||||
# Find contact dict from mc.contacts (used for retry/path info)
|
||||
# send_msg() also accepts a hex pubkey string directly
|
||||
contact = self.mc.contacts.get(recipient_pubkey)
|
||||
if not contact:
|
||||
# Try prefix match
|
||||
contact = self.mc.get_contact_by_key_prefix(recipient_pubkey)
|
||||
if not contact:
|
||||
return {'success': False, 'error': f'Contact not found: {recipient_pubkey}'}
|
||||
# Use pubkey string directly — meshcore lib handles it
|
||||
contact = recipient_pubkey
|
||||
|
||||
# Generate timestamp once — same for all retries (enables receiver dedup)
|
||||
timestamp = int(time.time())
|
||||
|
||||
Reference in New Issue
Block a user