Improve WiFi quick scan error handling and Linux tool fallback

- Add fallback mechanism to try multiple tools (nmcli -> iw -> iwlist)
- Improve error messages for iw/iwlist with root privilege detection
- Enhance nmcli scanner to try without interface if specific scan fails
- Better error reporting in frontend showing actual backend errors
- Add logging throughout scan process for debugging

This fixes quick scan immediately failing on Linux systems by trying
multiple tools and providing meaningful error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-21 22:57:51 +00:00
parent dfd4b0e89e
commit f665203543
2 changed files with 137 additions and 47 deletions
+22 -8
View File
@@ -302,18 +302,32 @@ const WiFiMode = (function() {
const result = await response.json();
console.log('[WiFiMode] Quick scan complete:', result);
// Check if we got results
if (!result.access_points || result.access_points.length === 0) {
if (result.error) {
throw new Error(result.error);
}
// No error but no results - might need different tool
console.warn('[WiFiMode] Quick scan returned no networks. Try Deep Scan instead.');
showError('Quick scan found no networks. System tools may not be available. Try Deep Scan with monitor mode.');
// Check for error first
if (result.error) {
console.error('[WiFiMode] Quick scan error from server:', result.error);
showError(result.error);
setScanning(false);
return;
}
// Check if we got results
if (!result.access_points || result.access_points.length === 0) {
// No error but no results
let msg = 'Quick scan found no networks in range.';
if (result.warnings && result.warnings.length > 0) {
msg += ' Warnings: ' + result.warnings.join('; ');
}
console.warn('[WiFiMode] ' + msg);
showError(msg + ' Try Deep Scan with monitor mode.');
setScanning(false);
return;
}
// Show any warnings even on success
if (result.warnings && result.warnings.length > 0) {
console.warn('[WiFiMode] Quick scan warnings:', result.warnings);
}
// Process results
processQuickScanResult(result);