mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-21 09:03:02 +02:00
feat(console): rename to mc-webui, fix change_path, persist transcript
- Rename "meshcli Console" to "mc-webui Console" (modal title + docs). - Drop redundant "Connected to..." messages; replace intro with a one-line "Type 'help' for available commands." hint. - Use a teal device-name style so the header label is readable on the dark background. - Display contact paths with commas (D1,90,05,54) instead of arrows in `contacts` and `path`, matching the standard MeshCore client. - Fix `change_path`: previously read only args[2] after shlex split, silently writing a 1-byte path. Now joins remaining args, accepts comma/space/continuous-hex, validates hex, auto-deduces hash_size from comma-chunk length (1/2/3-byte hops), and routes through _change_path_async so path_hash_mode is set and the contacts cache is invalidated. - Update `help` line and add a usage hint for the no-args form. - Add capped persistent output transcript: GET/POST/DELETE /api/console/output (cap 500 entries). Console restores prior entries (faded) above a divider on open and exposes a trash button to clear it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2784,15 +2784,15 @@ class DeviceManager:
|
||||
logger.error(f"discover_path failed: {e}")
|
||||
return {'success': False, 'error': str(e)}
|
||||
|
||||
def change_path(self, name_or_key: str, path: str) -> Dict:
|
||||
"""Change the path to a contact."""
|
||||
def change_path(self, name_or_key: str, path: str, hash_size: int = 1) -> Dict:
|
||||
"""Change the path to a contact. hash_size: 1/2/3 bytes per hop."""
|
||||
if not self.is_connected:
|
||||
return {'success': False, 'error': 'Device not connected'}
|
||||
contact = self.resolve_contact(name_or_key)
|
||||
if not contact:
|
||||
return {'success': False, 'error': f"Contact not found: {name_or_key}"}
|
||||
try:
|
||||
self.execute(self.mc.commands.change_contact_path(contact, path), timeout=10)
|
||||
self.execute(self._change_path_async(contact, path, hash_size=hash_size), timeout=10)
|
||||
return {'success': True, 'message': f'Path changed for {contact.get("adv_name", name_or_key)}'}
|
||||
except Exception as e:
|
||||
logger.error(f"change_path failed: {e}")
|
||||
|
||||
Reference in New Issue
Block a user