Files
mc-webui/meshcore-bridge
MarekWo 2c8677b6e8 fix(bridge): Improve pending_contacts parser to filter JSON lines
Issue: Parser incorrectly matched JSON lines (adverts, GRP_TXT messages)
as pending contacts because they contained colons. This caused false
positives like {"raw_hex": "..."} being parsed as contact name.

Root cause: meshcli outputs JSON for received messages (due to
json_log_rx=on setting) during pending_contacts command execution.
Original parser only checked for ':' presence, matching any JSON.

Solution: Added robust filtering before parsing:
1. Skip empty lines
2. Skip JSON lines (starting with { or [)
3. Skip meshcli prompt lines (ending with |*)
4. Validate public_key contains only hex characters (0-9, a-f, A-F)

This ensures only valid "ContactName: <hex_pubkey>" format is parsed.

Example of filtered content:
- SKIP: {"raw_hex": "25bc...", "payload_typename": "GRP_TXT"}
- SKIP: MarWoj|*
- PARSE: Skyllancer: f9ef123abc456...

Testing: No false positives with JSON lines in output.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 08:29:59 +01:00
..