systeminformation 5.24.5 → 5.24.7

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/README.md CHANGED
@@ -1186,7 +1186,7 @@ All other trademarks are the property of their respective owners.
1186
1186
  [daviddm-url]: https://david-dm.org/sebhildebrandt/systeminformation
1187
1187
  [issues-img]: https://img.shields.io/github/issues/sebhildebrandt/systeminformation.svg?style=flat-square
1188
1188
  [issues-url]: https://github.com/sebhildebrandt/systeminformation/issues
1189
- [closed-issues-img]: https://img.shields.io/github/issues-closed-raw/sebhildebrandt/systeminformation.svg?style=flat-square&color=brightgreen
1189
+ [closed-issues-img]: https://img.shields.io/github/issues-search?query=repo%3Asebhildebrandt/systeminformation+is%3Aclosed&style=flat-square&color=brightgreen&label=Issues+closed
1190
1190
  [closed-issues-url]: https://github.com/sebhildebrandt/systeminformation/issues?q=is%3Aissue+is%3Aclosed
1191
1191
  [new-issue]: https://github.com/sebhildebrandt/systeminformation/issues/new/choose
1192
1192
  [mmon-npm-url]: https://npmjs.org/package/mmon
package/lib/cpu.js CHANGED
@@ -737,6 +737,7 @@ function getCpu() {
737
737
  }
738
738
  modelline = util.getValue(lines, 'model name') || modelline;
739
739
  modelline = util.getValue(lines, 'bios model name') || modelline;
740
+ modelline = util.cleanString(modelline);
740
741
  const modellineParts = modelline.split('@');
741
742
  result.brand = modellineParts[0].trim();
742
743
  result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()) : 0;
package/lib/index.js CHANGED
@@ -55,6 +55,7 @@ const _sunos = (_platform === 'sunos');
55
55
 
56
56
  if (_windows) {
57
57
  util.getCodepage();
58
+ util.getPowershell();
58
59
  }
59
60
 
60
61
  // ----------------------------------------------------------------------------------
package/lib/system.js CHANGED
@@ -221,7 +221,7 @@ function system(callback) {
221
221
  // const version = util.getValue(lines, 'version', '=', true);
222
222
  result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
223
223
  result.model = model.key;
224
- result.type = macOsChassisType(model.model);
224
+ result.type = macOsChassisType(model.version);
225
225
  result.version = model.version;
226
226
  result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
227
227
  result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
@@ -607,13 +607,13 @@ exports.baseboard = baseboard;
607
607
 
608
608
  function macOsChassisType(model) {
609
609
  model = model.toLowerCase();
610
- if (model.startsWith('macbookair')) { return 'Notebook'; }
611
- if (model.startsWith('macbookpro')) { return 'Laptop'; }
612
- if (model.startsWith('macbook')) { return 'Notebook'; }
613
- if (model.startsWith('macmini')) { return 'Desktop'; }
614
- if (model.startsWith('imac')) { return 'Desktop'; }
615
- if (model.startsWith('macstudio')) { return 'Desktop'; }
616
- if (model.startsWith('macpro')) { return 'Tower'; }
610
+ if (model.indexOf('macbookair') >= 0 || model.indexOf('macbook air') >= 0) { return 'Notebook'; }
611
+ if (model.indexOf('macbookpro') >= 0 || model.indexOf('macbook pro') >= 0) { return 'Notebook'; }
612
+ if (model.indexOf('macbook') >= 0) { return 'Notebook'; }
613
+ if (model.indexOf('macmini') >= 0 || model.indexOf('mac mini') >= 0) { return 'Desktop'; }
614
+ if (model.indexOf('imac') >= 0) { return 'Desktop'; }
615
+ if (model.indexOf('macstudio') >= 0 || model.indexOf('mac studio') >= 0) { return 'Desktop'; }
616
+ if (model.indexOf('macpro') >= 0 || model.indexOf('mac pro') >= 0) { return 'Tower'; }
617
617
  return 'Other';
618
618
  }
619
619
 
package/lib/util.js CHANGED
@@ -42,6 +42,7 @@ let _psChild;
42
42
  let _psResult = '';
43
43
  let _psCmds = [];
44
44
  let _psPersistent = false;
45
+ let _powerShell = '';
45
46
  const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
46
47
  const _psCmdStart = '--###START###--';
47
48
  const _psError = '--ERROR--';
@@ -332,6 +333,16 @@ function findObjectByKey(array, key, value) {
332
333
  return -1;
333
334
  }
334
335
 
336
+ function getPowershell() {
337
+ _powerShell = 'powershell.exe';
338
+ if (_windows) {
339
+ const defaultPath = `${WINDIR}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;
340
+ if (fs.existsSync(defaultPath)) {
341
+ _powerShell = defaultPath;
342
+ }
343
+ }
344
+ }
345
+
335
346
  function getWmic() {
336
347
  if (os.type() === 'Windows_NT' && !wmicPath) {
337
348
  wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe';
@@ -401,7 +412,7 @@ function powerShellProceedResults(data) {
401
412
 
402
413
  function powerShellStart() {
403
414
  if (!_psChild) {
404
- _psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
415
+ _psChild = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
405
416
  stdio: 'pipe',
406
417
  windowsHide: true,
407
418
  maxBuffer: 1024 * 20000,
@@ -479,7 +490,7 @@ function powerShell(cmd) {
479
490
  return new Promise((resolve) => {
480
491
  process.nextTick(() => {
481
492
  try {
482
- const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
493
+ const child = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
483
494
  stdio: 'pipe',
484
495
  windowsHide: true,
485
496
  maxBuffer: 1024 * 20000,
@@ -2535,6 +2546,9 @@ function checkWebsite(url, timeout = 5000) {
2535
2546
  });
2536
2547
  };
2537
2548
 
2549
+ function cleanString(str) {
2550
+ return str.replace(/To Be Filled By O.E.M./g, '');
2551
+ }
2538
2552
  function noop() { }
2539
2553
 
2540
2554
  exports.toInt = toInt;
@@ -2591,3 +2605,5 @@ exports.getFilesInPath = getFilesInPath;
2591
2605
  exports.semverCompare = semverCompare;
2592
2606
  exports.getAppleModel = getAppleModel;
2593
2607
  exports.checkWebsite = checkWebsite;
2608
+ exports.cleanString = cleanString;
2609
+ exports.getPowershell = getPowershell;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.24.5",
3
+ "version": "5.24.7",
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)",