Merge pull request #2 from sebhildebrandt/master

Update from original
This commit is contained in:
Esteban Garcia 2019-12-17 14:29:00 -05:00 committed by GitHub
commit d81d5d4686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 15 deletions

View File

@ -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) |

View File

@ -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 | | | |

View File

@ -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>

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.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>

View File

@ -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>

View File

@ -1336,16 +1336,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);
@ -1355,5 +1372,4 @@ function networkGatewayDefault(callback) {
});
}
exports.networkGatewayDefault = networkGatewayDefault;

View File

@ -1,6 +1,6 @@
{
"name": "systeminformation",
"version": "4.15.3",
"version": "4.16.0",
"description": "Simple system and OS information library",
"license": "MIT",
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",