fix: Replace hardcoded device name with regex pattern for prompt detection

Replaced hardcoded "MarWoj" device name with regex pattern to support
any device name in meshcli prompt detection. The prompt format is
<DeviceName>|* and varies per installation.

Changes:
- Line 430: Use re.match(r'^.+\|\*', line) instead of line.startswith('MarWoj|*')
- Line 667: Update comment to use generic <DeviceName> placeholder

This ensures the code works correctly for all users regardless of their
meshcore device name configuration.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-01-03 16:22:34 +01:00
parent 10957a1fa2
commit 874e11c92a
+3 -3
View File
@@ -426,8 +426,8 @@ def get_all_contacts_detailed() -> Tuple[bool, List[Dict], int, str]:
lines = stdout.strip().split('\n')
for line in lines:
# Skip prompt lines and empty lines
if line.startswith('MarWoj|*') or not line.strip():
# Skip prompt lines and empty lines (prompt format: <DeviceName>|*)
if re.match(r'^.+\|\*', line) or not line.strip():
continue
# Check for final count line: "> 263 contacts in device"
@@ -664,7 +664,7 @@ def get_contacts_json() -> Tuple[bool, Dict[str, Dict], str]:
return False, {}, '.contacts command returned empty output'
# Parse JSON output - use brace-matching to extract complete JSON object
# stdout format: "MarWoj|* .contacts\n{...}\nMarWoj|* "
# stdout format: "<DeviceName>|* .contacts\n{...}\n<DeviceName>|* "
# We need to find matching braces and parse only the JSON object
try:
# Use brace-matching to extract complete JSON object (same as bridge does)