networkStats() fixed issue blocking windows

This commit is contained in:
Sebastian Hildebrandt 2020-07-16 10:43:01 +02:00
parent dc62e51750
commit fd5b435f8d
4 changed files with 29 additions and 21 deletions

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.26.10 | 2020-07-16 | `networkStats()` fixed issue blocking windows |
| 4.26.9 | 2020-06-06 | `networkStats()` fixed comparison issue windows |
| 4.26.8 | 2020-06-06 | `networkInterfaces()` fixed caching issue |
| 4.26.7 | 2020-06-06 | `cpuTemperature()` fixed raspberry pi sensors issue |

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.26.10</th>
<td>2020-07-16</td>
<td><span class="code">networkStats()</span> fixed issue blocking windows</td>
</tr>
<tr>
<th scope="row">4.26.9</th>
<td>2020-06-06</td>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.26.9</span></div>
<div class="version">Current Version: <span id="version">4.26.10</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
@ -207,7 +207,7 @@
<div class="title">Downloads last month</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">283</div>
<div class="numbers">304</div>
<div class="title">Dependends</div>
</div>
</div>

View File

@ -31,7 +31,7 @@ const _sunos = (_platform === 'sunos');
let _network = {};
let _default_iface = '';
let _ifaces = [];
let _ifaces = {};
let _dhcpNics = [];
let _networkInterfaces = [];
let _mac = {};
@ -686,24 +686,7 @@ function networkInterfaces(callback, rescan = true) {
return new Promise((resolve) => {
process.nextTick(() => {
let ifaces = os.networkInterfaces();
if (_windows) {
getWindowsNics().forEach(nic => {
let found = false;
Object.keys(ifaces).forEach(key => {
if (!found) {
ifaces[key].forEach(value => {
if (Object.keys(value).indexOf('mac') >= 0) {
found = value['mac'] === nic.mac;
}
});
}
});
if (!found) {
ifaces[nic.name] = [{ mac: nic.mac }];
}
});
}
let result = [];
let nics = [];
let dnsSuffixes = [];
@ -748,6 +731,7 @@ function networkInterfaces(callback, rescan = true) {
carrierChanges: 0
});
});
_networkInterfaces = result;
if (callback) { callback(result); }
resolve(result);
} else {
@ -758,8 +742,26 @@ function networkInterfaces(callback, rescan = true) {
if (callback) { callback(result); }
resolve(result);
} else {
_ifaces = ifaces;
_ifaces = Object.assign({}, ifaces);
if (_windows) {
getWindowsNics().forEach(nic => {
let found = false;
Object.keys(ifaces).forEach(key => {
if (!found) {
ifaces[key].forEach(value => {
if (Object.keys(value).indexOf('mac') >= 0) {
found = value['mac'] === nic.mac;
}
});
}
});
if (!found) {
ifaces[nic.name] = [{ mac: nic.mac }];
}
});
nics8021xInfo = getWindowsWiredProfilesInformation();
nics = getWindowsNics();
dnsSuffixes = getWindowsDNSsuffixes();