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