feat: Auto-detect device name from meshcli prompt

Bridge now detects device name from meshcli prompt ("DeviceName|*")
and exposes it via /health endpoint. mc-webui fetches this at startup
and uses RuntimeConfig for dynamic device name throughout the app.

Fallback chain: prompt detection → .infos command → MC_DEVICE_NAME env var

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-01-15 07:48:10 +01:00
parent 6000750e6c
commit c7163aa035
8 changed files with 178 additions and 24 deletions
+3 -2
View File
@@ -11,7 +11,7 @@ from datetime import datetime
from io import BytesIO
from flask import Blueprint, jsonify, request, send_file
from app.meshcore import cli, parser
from app.config import config
from app.config import config, runtime_config
from app.archiver import manager as archive_manager
logger = logging.getLogger(__name__)
@@ -209,7 +209,8 @@ def get_status():
return jsonify({
'success': True,
'connected': connected,
'device_name': config.MC_DEVICE_NAME,
'device_name': runtime_config.get_device_name(),
'device_name_source': runtime_config.get_device_name_source(),
'serial_port': config.MC_SERIAL_PORT,
'message_count': message_count,
'latest_message_timestamp': latest_timestamp
+7 -7
View File
@@ -4,7 +4,7 @@ HTML views for mc-webui
import logging
from flask import Blueprint, render_template, request
from app.config import config
from app.config import config, runtime_config
logger = logging.getLogger(__name__)
@@ -18,7 +18,7 @@ def index():
"""
return render_template(
'index.html',
device_name=config.MC_DEVICE_NAME
device_name=runtime_config.get_device_name()
)
@@ -34,7 +34,7 @@ def direct_messages():
return render_template(
'dm.html',
device_name=config.MC_DEVICE_NAME,
device_name=runtime_config.get_device_name(),
initial_conversation=initial_conversation
)
@@ -46,7 +46,7 @@ def contact_management():
"""
return render_template(
'contacts-manage.html',
device_name=config.MC_DEVICE_NAME
device_name=runtime_config.get_device_name()
)
@@ -57,7 +57,7 @@ def contact_pending_list():
"""
return render_template(
'contacts-pending.html',
device_name=config.MC_DEVICE_NAME
device_name=runtime_config.get_device_name()
)
@@ -68,7 +68,7 @@ def contact_existing_list():
"""
return render_template(
'contacts-existing.html',
device_name=config.MC_DEVICE_NAME
device_name=runtime_config.get_device_name()
)
@@ -81,7 +81,7 @@ def console():
"""
return render_template(
'console.html',
device_name=config.MC_DEVICE_NAME
device_name=runtime_config.get_device_name()
)