Files
mc-webui/app/routes/views.py
MarekWo 878d489661 feat(contacts): add contact UI with URI paste, QR scan, and manual entry
Stage 2 of manual contact add feature:
- POST /api/contacts/manual-add endpoint (URI or raw params)
- New /contacts/add page with 3 input tabs (URI, QR code, Manual)
- QR scanning via html5-qrcode (camera + image upload fallback)
- Client-side URI parsing with preview before submission
- Nav card in Contact Management above Pending Contacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 20:54:41 +01:00

111 lines
2.4 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/add')
def contact_add():
"""
Add Contact page - URI paste, QR scan, manual fields.
"""
return render_template(
'contacts-add.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('/logs')
def logs():
"""System log viewer - real-time log streaming with filters."""
return render_template('logs.html')
@views_bp.route('/health')
def health():
"""
Health check endpoint for monitoring.
"""
return 'OK', 200