systeminformation 5.21.7 → 5.21.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/battery.js CHANGED
@@ -127,6 +127,7 @@ module.exports = function (callback) {
127
127
  const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10);
128
128
  const power = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_POWER_NOW', '='), 10);
129
129
  const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10);
130
+ const charge = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10);
130
131
 
131
132
  result.percent = parseInt('0' + percent, 10);
132
133
  if (result.maxCapacity && result.currentCapacity) {
@@ -140,6 +141,8 @@ module.exports = function (callback) {
140
141
  }
141
142
  if (energy && power) {
142
143
  result.timeRemaining = Math.floor(energy / power * 60);
144
+ } else if (current && charge) {
145
+ result.timeRemaining = Math.floor(charge / current * 60);
143
146
  } else if (current && result.currentCapacity) {
144
147
  result.timeRemaining = Math.floor(result.currentCapacity / current * 60);
145
148
  }
package/lib/docker.js CHANGED
@@ -462,7 +462,8 @@ function dockerContainerStats(containerIDs, callback) {
462
462
  if (containerIDsSanitized !== '*') {
463
463
  containerIDsSanitized = '';
464
464
  const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim();
465
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
465
+ const l = util.mathMin(s.length, 2000);
466
+ for (let i = 0; i <= l; i++) {
466
467
  if (s[i] !== undefined) {
467
468
  s[i].__proto__.toLowerCase = util.stringToLower;
468
469
  const sl = s[i].toLowerCase();
package/lib/internet.js CHANGED
@@ -45,7 +45,8 @@ function inetChecksite(url, callback) {
45
45
  }
46
46
  let urlSanitized = '';
47
47
  const s = util.sanitizeShellString(url, true);
48
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
48
+ const l = util.mathMin(s.length, 2000);
49
+ for (let i = 0; i <= l; i++) {
49
50
  if (s[i] !== undefined) {
50
51
  s[i].__proto__.toLowerCase = util.stringToLower;
51
52
  const sl = s[i].toLowerCase();
@@ -143,7 +144,8 @@ function inetLatency(host, callback) {
143
144
  }
144
145
  let hostSanitized = '';
145
146
  const s = (util.isPrototypePolluted() ? '8.8.8.8' : util.sanitizeShellString(host, true)).trim();
146
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
147
+ const l = util.mathMin(s.length, 2000);
148
+ for (let i = 0; i <= l; i++) {
147
149
  if (!(s[i] === undefined)) {
148
150
  s[i].__proto__.toLowerCase = util.stringToLower;
149
151
  const sl = s[i].toLowerCase();
package/lib/network.js CHANGED
@@ -745,7 +745,8 @@ function networkInterfaces(callback, rescan, defaultString) {
745
745
 
746
746
  let ifaceSanitized = '';
747
747
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(nic.iface);
748
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
748
+ const l = util.mathMin(s.length, 2000);
749
+ for (let i = 0; i <= l; i++) {
749
750
  if (s[i] !== undefined) {
750
751
  ifaceSanitized = ifaceSanitized + s[i];
751
752
  }
@@ -840,7 +841,8 @@ function networkInterfaces(callback, rescan, defaultString) {
840
841
  let iface = dev.split(':')[0].trim().toLowerCase();
841
842
  let ifaceSanitized = '';
842
843
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface);
843
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
844
+ const l = util.mathMin(s.length, 2000);
845
+ for (let i = 0; i <= l; i++) {
844
846
  if (s[i] !== undefined) {
845
847
  ifaceSanitized = ifaceSanitized + s[i];
846
848
  }
@@ -973,7 +975,8 @@ function networkInterfaces(callback, rescan, defaultString) {
973
975
 
974
976
  let ifaceSanitized = '';
975
977
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(dev);
976
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
978
+ const l = util.mathMin(s.length, 2000);
979
+ for (let i = 0; i <= l; i++) {
977
980
  if (s[i] !== undefined) {
978
981
  ifaceSanitized = ifaceSanitized + s[i];
979
982
  }
@@ -1221,7 +1224,8 @@ function networkStatsSingle(iface) {
1221
1224
  process.nextTick(() => {
1222
1225
  let ifaceSanitized = '';
1223
1226
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface);
1224
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
1227
+ const l = util.mathMin(s.length, 2000);
1228
+ for (let i = 0; i <= l; i++) {
1225
1229
  if (s[i] !== undefined) {
1226
1230
  ifaceSanitized = ifaceSanitized + s[i];
1227
1231
  }
package/lib/processes.js CHANGED
@@ -131,7 +131,8 @@ function services(srv, callback) {
131
131
  srvString.__proto__.trim = util.stringTrim;
132
132
 
133
133
  const s = util.sanitizeShellString(srv);
134
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
134
+ const l = util.mathMin(s.length, 2000);
135
+ for (let i = 0; i <= l; i++) {
135
136
  if (s[i] !== undefined) {
136
137
  srvString = srvString + s[i];
137
138
  }
@@ -986,7 +987,9 @@ function processLoad(proc, callback) {
986
987
  processesString.__proto__.trim = util.stringTrim;
987
988
 
988
989
  const s = util.sanitizeShellString(proc);
989
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
990
+ const l = util.mathMin(s.length, 2000);
991
+
992
+ for (let i = 0; i <= l; i++) {
990
993
  if (s[i] !== undefined) {
991
994
  processesString = processesString + s[i];
992
995
  }
package/lib/util.js CHANGED
@@ -682,7 +682,8 @@ function sanitizeShellString(str, strict) {
682
682
  if (typeof strict === 'undefined') { strict = false; }
683
683
  const s = str || '';
684
684
  let result = '';
685
- for (let i = 0; i <= mathMin(s.length, 2000); i++) {
685
+ const l = mathMin(s.length, 2000);
686
+ for (let i = 0; i <= l; i++) {
686
687
  if (!(s[i] === undefined ||
687
688
  s[i] === '>' ||
688
689
  s[i] === '<' ||
package/lib/wifi.js CHANGED
@@ -403,7 +403,9 @@ function wifiNetworks(callback) {
403
403
  if (iface) {
404
404
  let ifaceSanitized = '';
405
405
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface, true);
406
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
406
+ const l = util.mathMin(s.length, 2000);
407
+
408
+ for (let i = 0; i <= l; i++) {
407
409
  if (s[i] !== undefined) {
408
410
  ifaceSanitized = ifaceSanitized + s[i];
409
411
  }
@@ -539,7 +541,9 @@ function wifiConnections(callback) {
539
541
  ifaces.forEach(ifaceDetail => {
540
542
  let ifaceSanitized = '';
541
543
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ifaceDetail.iface, true);
542
- for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
544
+ const ll = util.mathMin(s.length, 2000);
545
+
546
+ for (let i = 0; i <= ll; i++) {
543
547
  if (s[i] !== undefined) {
544
548
  ifaceSanitized = ifaceSanitized + s[i];
545
549
  }
@@ -551,7 +555,8 @@ function wifiConnections(callback) {
551
555
  const network = networkList.filter(nw => nw.ssid === ssid);
552
556
  let ssidSanitized = '';
553
557
  const t = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ssid, true);
554
- for (let i = 0; i <= util.mathMin(t.length, 2000); i++) {
558
+ const l = util.mathMin(t.length, 2000);
559
+ for (let i = 0; i <= l; i++) {
555
560
  if (t[i] !== undefined) {
556
561
  ssidSanitized = ssidSanitized + t[i];
557
562
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.21.7",
3
+ "version": "5.21.9",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",