get() fixed issue boolean parameters

This commit is contained in:
Sebastian Hildebrandt 2021-03-03 19:49:53 +01:00
parent 9ca44bb211
commit 80e20a8268
6 changed files with 28 additions and 7 deletions

View File

@ -77,6 +77,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.6.1 | 2021-03-03 | `get()` fixed issue boolean parameters |
| 5.6.0 | 2021-03-03 | `cpuTemperature()` added socket and chipset temp (linux) |
| 5.5.0 | 2021-02-25 | `dockerVolumes()` added |
| 5.4.0 | 2021-02-24 | `dockerImages()` added |

View File

@ -56,6 +56,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.6.1</th>
<td>2021-03-03</td>
<td><span class="code">get()</span> fixed issue boolean parameters</td>
</tr>
<tr>
<th scope="row">5.6.0</th>
<td>2021-03-03</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.6.0</span></div>
<div class="version">New Version: <span id="version">5.6.1</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">

View File

@ -98,6 +98,9 @@ function dockerImages(all, callback) {
callback = all;
all = false;
}
if (typeof all === 'string' && all === 'true') {
all = true;
}
if (typeof all !== 'boolean' && all !== undefined) {
all = false;
}
@ -218,6 +221,9 @@ function dockerContainers(all, callback) {
callback = all;
all = false;
}
if (typeof all === 'string' && all === 'true') {
all = true;
}
if (typeof all !== 'boolean' && all !== undefined) {
all = false;
}

View File

@ -362,12 +362,17 @@ function get(valueObject, callback) {
// result is in an array, go through all elements of array and pick only the right ones
const partialArray = [];
data[i].forEach(element => {
const partialRes = {};
keys.forEach(k => {
if ({}.hasOwnProperty.call(element, k)) {
partialRes[k] = element[k];
}
});
let partialRes = {};
if (keys.length === 1 && (keys[0] === '*' || keys[0] === 'all')) {
partialRes = element;
} else {
keys.forEach(k => {
if ({}.hasOwnProperty.call(element, k)) {
partialRes[k] = element[k];
}
});
}
// if there is a filter, then just take those elements
if (filter && filterParts.length === 2) {
if ({}.hasOwnProperty.call(partialRes, filterParts[0].trim())) {
const val = partialRes[filterParts[0].trim()];

View File

@ -164,6 +164,10 @@ function services(srv, callback) {
}
}
}
if ((_darwin) && srvString === '*') { // service enumeration mnot yet suported on mac OS
if (callback) { callback(result); }
resolve(result);
}
let comm = (_darwin) ? 'ps -caxo pcpu,pmem,pid,command' : 'ps -axo pcpu,pmem,pid,command';
if (srvString !== '' && srvs.length > 0) {
exec(comm + ' | grep -v grep | grep -iE "' + srvString + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { // lgtm [js/shell-command-constructed-from-input]