Skip to content

Commit

Permalink
wifiNetworks() refactored parsing (macOS)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Dec 21, 2024
1 parent 51c89c1 commit 473f639
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,15 @@ function parseWifiDarwin(wifiStr) {
} else if (sm.startsWith('pairport_security_mode_wpa3')) {
security.push('WPA3');
}
const channelInfo = new RegExp(/(\d+) \((\d)GHz, (\d+)MHz\)/g).exec(wifiItem.spairport_network_channel);
const channel = parseInt((wifiItem.spairport_network_channel).split(' ')[0]) || 0;
const signalLevel = wifiItem.spairport_signal_noise || null;

result.push({
ssid: wifiItem._name || '',
bssid: wifiItem.spairport_network_bssid || '',
mode: wifiItem.spairport_network_phymode,
channel: parseInt(channelInfo[0].split(' ')[0]),
frequency: wifiFrequencyFromChannel(channelInfo[1]),
channel,
frequency: wifiFrequencyFromChannel(channel),
signalLevel: signalLevel ? parseInt(signalLevel, 10) : null,
quality: wifiQualityFromDB(signalLevel),
security,
Expand Down

0 comments on commit 473f639

Please sign in to comment.