forked from iarv/mc-webui
c7163aa035
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>
94 lines
2.0 KiB
Python
94 lines
2.0 KiB
Python
"""
|
|
HTML views for mc-webui
|
|
"""
|
|
|
|
import logging
|
|
from flask import Blueprint, render_template, request
|
|
from app.config import config, runtime_config
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
views_bp = Blueprint('views', __name__)
|
|
|
|
|
|
@views_bp.route('/')
|
|
def index():
|
|
"""
|
|
Main chat view - displays message list and send form.
|
|
"""
|
|
return render_template(
|
|
'index.html',
|
|
device_name=runtime_config.get_device_name()
|
|
)
|
|
|
|
|
|
@views_bp.route('/dm')
|
|
def direct_messages():
|
|
"""
|
|
Direct Messages view - full-page DM interface.
|
|
|
|
Query params:
|
|
conversation: Optional conversation ID to open initially
|
|
"""
|
|
initial_conversation = request.args.get('conversation', '')
|
|
|
|
return render_template(
|
|
'dm.html',
|
|
device_name=runtime_config.get_device_name(),
|
|
initial_conversation=initial_conversation
|
|
)
|
|
|
|
|
|
@views_bp.route('/contacts/manage')
|
|
def contact_management():
|
|
"""
|
|
Contact Management Settings - manual approval + cleanup + navigation.
|
|
"""
|
|
return render_template(
|
|
'contacts-manage.html',
|
|
device_name=runtime_config.get_device_name()
|
|
)
|
|
|
|
|
|
@views_bp.route('/contacts/pending')
|
|
def contact_pending_list():
|
|
"""
|
|
Full-screen pending contacts list.
|
|
"""
|
|
return render_template(
|
|
'contacts-pending.html',
|
|
device_name=runtime_config.get_device_name()
|
|
)
|
|
|
|
|
|
@views_bp.route('/contacts/existing')
|
|
def contact_existing_list():
|
|
"""
|
|
Full-screen existing contacts list with search, filter, sort.
|
|
"""
|
|
return render_template(
|
|
'contacts-existing.html',
|
|
device_name=runtime_config.get_device_name()
|
|
)
|
|
|
|
|
|
@views_bp.route('/console')
|
|
def console():
|
|
"""
|
|
Interactive meshcli console - chat-style command interface.
|
|
|
|
WebSocket connection is handled by the main Flask app and proxied to bridge.
|
|
"""
|
|
return render_template(
|
|
'console.html',
|
|
device_name=runtime_config.get_device_name()
|
|
)
|
|
|
|
|
|
@views_bp.route('/health')
|
|
def health():
|
|
"""
|
|
Health check endpoint for monitoring.
|
|
"""
|
|
return 'OK', 200
|