mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-07 01:03:15 +02:00
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:
+3
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user