From d9ee87d4b462f4398fbb2187cb6d2709377d223b Mon Sep 17 00:00:00 2001 From: Smittix Date: Thu, 8 Jan 2026 13:01:47 +0000 Subject: [PATCH] Improve WiFi device selection visibility and error handling - Added "Select Device" label to WiFi adapter dropdown - Better error handling with user notifications when interfaces fail to load - Shows loading state while detecting interfaces - Clearer notification messages for found/missing interfaces Co-Authored-By: Claude Opus 4.5 --- templates/index.html | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/templates/index.html b/templates/index.html index a42851f..1dc4a20 100644 --- a/templates/index.html +++ b/templates/index.html @@ -491,14 +491,15 @@
-

WiFi Interface

+

WiFi Adapter

-
airmon-ng:Checking... @@ -4386,12 +4387,18 @@ // Refresh WiFi interfaces function refreshWifiInterfaces() { + const select = document.getElementById('wifiInterfaceSelect'); + select.innerHTML = ''; + fetch('/wifi/interfaces') - .then(r => r.json()) + .then(r => { + if (!r.ok) throw new Error('Failed to fetch interfaces'); + return r.json(); + }) .then(data => { - const select = document.getElementById('wifiInterfaceSelect'); - if (data.interfaces.length === 0) { + if (!data.interfaces || data.interfaces.length === 0) { select.innerHTML = ''; + showNotification('WiFi', 'No WiFi interfaces detected. Make sure you have a WiFi adapter connected.'); } else { select.innerHTML = data.interfaces.map(i => { // Build descriptive label with available info @@ -4405,20 +4412,28 @@ if (i.monitor_capable) label += ' [Monitor OK]'; return ``; }).join(''); + showNotification('WiFi', `Found ${data.interfaces.length} interface(s)`); } // Update tool status const statusDiv = document.getElementById('wifiToolStatus'); - statusDiv.innerHTML = ` - airmon-ng:${data.tools.airmon ? 'OK' : 'Missing'} - airodump-ng:${data.tools.airodump ? 'OK' : 'Missing'} - `; + if (statusDiv) { + statusDiv.innerHTML = ` + airmon-ng:${data.tools?.airmon ? 'OK' : 'Missing'} + airodump-ng:${data.tools?.airodump ? 'OK' : 'Missing'} + `; + } // Update monitor status if (data.monitor_interface) { monitorInterface = data.monitor_interface; updateMonitorStatus(true); } + }) + .catch(err => { + console.error('Error fetching WiFi interfaces:', err); + select.innerHTML = ''; + showNotification('WiFi Error', 'Could not detect WiFi interfaces: ' + err.message); }); }