feat(contacts): show path/route info in UI and split console commands

- Console `contacts` now shows device-only contacts with path info
  (matching meshcore-cli format: name, type, pubkey, path)
- New `contacts_all` command shows all contacts (device + cached from DB)
- Contact cards in UI now always show routing mode for device contacts
  (Flood, Direct 0 hop, or hex path with hop count)
- Fix path_or_mode computation: prioritize out_path over out_path_len
  to handle firmware edge case where out_path exists but out_path_len=-1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-16 21:01:15 +01:00
parent fa8190923f
commit 5f72f40742
3 changed files with 50 additions and 10 deletions
+13 -3
View File
@@ -2142,12 +2142,22 @@ function createExistingContactCard(contact, index) {
lastAdvertDiv.appendChild(timeText);
}
// Path/mode (optional)
// Path/route info for device contacts
let pathDiv = null;
if (contact.path_or_mode && contact.path_or_mode !== 'Flood') {
if (contact.on_device !== false) {
pathDiv = document.createElement('div');
pathDiv.className = 'text-muted small';
pathDiv.textContent = `Path: ${contact.path_or_mode}`;
const mode = contact.path_or_mode || 'Flood';
const pathLen = contact.out_path_len;
if (mode === 'Flood') {
pathDiv.innerHTML = '<i class="bi bi-broadcast"></i> Flood';
} else if (mode === '0 hop') {
pathDiv.innerHTML = '<i class="bi bi-arrow-right-short"></i> Direct (0 hop)';
} else {
// mode is hex path string, show hops count + path
const hops = pathLen >= 0 ? pathLen : '?';
pathDiv.innerHTML = `<i class="bi bi-signpost-split"></i> Path: ${mode} (${hops} hops)`;
}
}
// Action buttons