Start traffic capture
()
| 16949 | |
| 16950 | # ============================================================================== |
| 16951 | # Ethernet/LAN API Endpoints |
| 16952 | # ============================================================================== |
| 16953 | |
| 16954 | @app.route('/api/ethernet/status', methods=['GET']) |
| 16955 | def get_ethernet_status(): |
| 16956 | """Get current Ethernet interface status.""" |
| 16957 | try: |
| 16958 | state = _get_multi_interface_state() |
| 16959 | # Refresh Ethernet interfaces |
| 16960 | state.refresh_ethernet_interfaces() |
| 16961 | status = state.get_ethernet_status() |
| 16962 | # Add ethernet preference setting |
| 16963 | status['prefer_ethernet'] = shared_data.config.get('ethernet_prefer_over_wifi', True) |
| 16964 | return jsonify({'success': True, **status}) |
| 16965 | except Exception as exc: |
| 16966 | logger.error(f"Failed to get Ethernet status: {exc}") |
| 16967 | return jsonify({'success': False, 'error': str(exc)}), 500 |
| 16968 | |
| 16969 | |
| 16970 | @app.route('/api/ethernet/interfaces', methods=['GET']) |
| 16971 | def get_ethernet_interfaces(): |
| 16972 | """Get all Ethernet interfaces.""" |
| 16973 | try: |
| 16974 | default_eth = shared_data.config.get('ethernet_default_interface', 'eth0') |
| 16975 | interfaces = gather_ethernet_interfaces(default_eth) |
| 16976 | return jsonify({ |
| 16977 | 'success': True, |
| 16978 | 'interfaces': interfaces, |
| 16979 | 'default_interface': default_eth, |
| 16980 | }) |
| 16981 | except Exception as exc: |
| 16982 | logger.error(f"Failed to get Ethernet interfaces: {exc}") |
nothing calls this directly
no test coverage detected