networkGatewayDefault() correction win
This commit is contained in:
parent
09a2a901f3
commit
f6780f3c48
@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 4.15.2 | 2019-11-10 | type definitions and docs update |
|
||||
| 4.16.0 | 2019-11-27 | `networkGatewayDefault()` added |
|
||||
| 4.15.3 | 2019-11-10 | type definitions and docs update |
|
||||
| 4.15.2 | 2019-11-10 | `mem()` improved calculation linux |
|
||||
| 4.15.1 | 2019-11-10 | `diskLayout()` added support for older lsblk versions (linux) |
|
||||
| 4.15.0 | 2019-11-10 | `cpu()` added governor (linux) |
|
||||
|
||||
@ -277,7 +277,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
|
||||
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|
||||
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
|
||||
| si.osInfo(cb) | {...} | X | X | X | X | X | OS information |
|
||||
| | platform | X | X | X | X | X | 'Linux', 'Darwin', 'Windows' |
|
||||
| | platform | X | X | X | X | X | 'linux', 'darwin', 'win32', ... |
|
||||
| | distro | X | X | X | X | X | |
|
||||
| | release | X | X | X | X | X | |
|
||||
| | codename | | | X | | | |
|
||||
|
||||
@ -83,6 +83,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">4.16.0</th>
|
||||
<td>2019-11-27</td>
|
||||
<td><span class="code">networkGatewayDefault()</span> added</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">4.15.3</th>
|
||||
<td>2019-11-10</td>
|
||||
|
||||
@ -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.15.3</span></div>
|
||||
<div class="version">Current Version: <span id="version">4.16.0</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">
|
||||
@ -191,7 +191,7 @@
|
||||
</div>
|
||||
<div class="row number-section">
|
||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||
<div class="numbers">9,445</div>
|
||||
<div class="numbers">9,471</div>
|
||||
<div class="title">Lines of code</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||
@ -199,7 +199,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">215</div>
|
||||
<div class="numbers">216</div>
|
||||
<div class="title">Dependends</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td>'Linux', 'Darwin', 'Windows'</td>
|
||||
<td>'linux', 'darwin', 'win32', ...</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
@ -1051,16 +1051,33 @@ function networkGatewayDefault(callback) {
|
||||
}
|
||||
if (_windows) {
|
||||
try {
|
||||
util.powerShell('Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq \'0.0.0.0\' -and $_.Mask -eq \'0.0.0.0\' }).InterfaceIndex')
|
||||
util.powerShell('Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq \'0.0.0.0\' -and $_.Mask -eq \'0.0.0.0\' }')
|
||||
.then(data => {
|
||||
let lines = data.toString().split('\r\n');
|
||||
result = lines && lines[0] ? lines[0] : '';
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
if (lines.length > 1 && !result) {
|
||||
result = util.getValue(lines, 'NextHop');
|
||||
// result = lines && lines[0] ? lines[0] : '';
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
} else {
|
||||
exec('ipconfig', util.execOptsWin, function (error, stdout) {
|
||||
let lines = stdout.toString().split('\r\n');
|
||||
lines.forEach(function (line) {
|
||||
line = line.trim().replace(/\. /g, '');
|
||||
line = line.trim().replace(/ +/g, '');
|
||||
const parts = line.split(':');
|
||||
if (parts[0].toLowerCase().startsWith('standardgate') && parts[1]) {
|
||||
result = parts[1];
|
||||
}
|
||||
});
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
@ -1070,5 +1087,4 @@ function networkGatewayDefault(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
exports.networkGatewayDefault = networkGatewayDefault;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user