diff --git a/app/routes/api.py b/app/routes/api.py index 821a9f1..611322e 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -1034,31 +1034,25 @@ def cleanup_contacts(): @api_bp.route('/device/info', methods=['GET']) def get_device_info(): """ - Get detailed device information. - - Returns: - JSON with device info + Get detailed device information from DeviceManager. """ try: - success, info = cli.get_device_info() + dm = _get_dm() + if not dm or not dm.is_connected: + return jsonify({'success': False, 'error': 'Device not connected'}), 503 - if success: + info = dm.get_device_info() + if info: return jsonify({ 'success': True, - 'info': info + 'info': info, }), 200 else: - return jsonify({ - 'success': False, - 'error': info - }), 500 + return jsonify({'success': False, 'error': 'No device info available'}), 503 except Exception as e: logger.error(f"Error getting device info: {e}") - return jsonify({ - 'success': False, - 'error': str(e) - }), 500 + return jsonify({'success': False, 'error': str(e)}), 500 @api_bp.route('/device/stats', methods=['GET']) @@ -1067,13 +1061,14 @@ def get_device_stats(): Get device statistics (uptime, radio, packets). """ try: - dm = current_app.config.get('DEVICE_MANAGER') + dm = _get_dm() if not dm or not dm.is_connected: return jsonify({'success': False, 'error': 'Device not connected'}), 503 stats = dm.get_device_stats() bat = dm.get_battery() - db_stats = dm.db.get_stats() if dm.db else {} + db = _get_db() + db_stats = db.get_stats() if db else {} return jsonify({ 'success': True, @@ -1789,8 +1784,7 @@ def search_messages(): limit = min(limit, 200) try: - dm = current_app.config.get('DEVICE_MANAGER') - db = dm.db if dm else None + db = _get_db() if not db: return jsonify({'success': False, 'error': 'Database not available'}), 503 @@ -3819,8 +3813,7 @@ def clear_console_history(): def list_backups(): """List available database backups.""" try: - dm = current_app.config.get('DEVICE_MANAGER') - db = dm.db if dm else None + db = _get_db() if not db: return jsonify({'success': False, 'error': 'Database not available'}), 503 @@ -3854,8 +3847,7 @@ def list_backups(): def create_backup(): """Create an immediate database backup.""" try: - dm = current_app.config.get('DEVICE_MANAGER') - db = dm.db if dm else None + db = _get_db() if not db: return jsonify({'success': False, 'error': 'Database not available'}), 503 diff --git a/app/static/css/style.css b/app/static/css/style.css index 1be6d46..999cb5e 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -1240,6 +1240,12 @@ main { color: white; } +/* Search FAB button (orange gradient) */ +.fab-search { + background: linear-gradient(135deg, #fd7e14 0%, #e8590c 100%); + color: white; +} + /* Filter bar overlay - slides down from top of chat area */ .filter-bar { position: absolute; diff --git a/app/static/js/app.js b/app/static/js/app.js index f490c66..49302cb 100644 --- a/app/static/js/app.js +++ b/app/static/js/app.js @@ -267,12 +267,9 @@ async function showAllContactsOnMap() { const deviceData = await deviceResp.json(); const cachedData = await cachedResp.json(); - // Parse self info for own device marker + // Use self info for own device marker if (deviceInfoData.success && deviceInfoData.info) { - try { - const jsonMatch = deviceInfoData.info.match(/\{[\s\S]*\}/); - _selfInfo = jsonMatch ? JSON.parse(jsonMatch[0]) : null; - } catch (e) { _selfInfo = null; } + _selfInfo = deviceInfoData.info; } if (deviceData.success && deviceData.contacts) { diff --git a/app/static/js/sw.js b/app/static/js/sw.js index 3b91650..0f9c7f6 100644 --- a/app/static/js/sw.js +++ b/app/static/js/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = 'mc-webui-v6'; +const CACHE_NAME = 'mc-webui-v7'; const ASSETS_TO_CACHE = [ '/', '/static/css/style.css', diff --git a/app/templates/base.html b/app/templates/base.html index 224466c..3e08a44 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -38,9 +38,6 @@ {% endif %}
-
diff --git a/app/templates/index.html b/app/templates/index.html index bd07e89..40963c4 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -169,6 +169,9 @@ +