systeminformation 5.9.18 → 5.10.3

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/system.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2021
8
+ // Copyright: (c) 2014 - 2022
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT
@@ -22,7 +22,7 @@ const execPromise = util.promisify(require('child_process').exec);
22
22
 
23
23
  let _platform = process.platform;
24
24
 
25
- const _linux = (_platform === 'linux');
25
+ const _linux = (_platform === 'linux' || _platform === 'android');
26
26
  const _darwin = (_platform === 'darwin');
27
27
  const _windows = (_platform === 'win32');
28
28
  const _freebsd = (_platform === 'freebsd');
@@ -353,33 +353,21 @@ function system(callback) {
353
353
  result.serial = util.getValue(lines, 'identifyingnumber', ':');
354
354
  result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase();
355
355
  // detect virtual (1)
356
- if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) {
356
+ const model = result.model.toLowerCase();
357
+ if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu')) {
357
358
  result.virtual = true;
358
- switch (result.model.toLowerCase()) {
359
- case 'virtualbox':
360
- result.virtualHost = 'VirtualBox';
361
- break;
362
- case 'vmware':
363
- result.virtualHost = 'VMware';
364
- break;
365
- case 'kvm':
366
- result.virtualHost = 'KVM';
367
- break;
368
- case 'bochs':
369
- result.virtualHost = 'bochs';
370
- break;
371
- }
359
+ if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; }
360
+ if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; }
361
+ if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; }
362
+ if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; }
363
+ if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; }
372
364
  }
373
- if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') {
365
+ const manufacturer = result.manufacturer.toLowerCase();
366
+ if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen') {
374
367
  result.virtual = true;
375
- switch (result.manufacturer.toLowerCase()) {
376
- case 'vmware':
377
- result.virtualHost = 'VMware';
378
- break;
379
- case 'xen':
380
- result.virtualHost = 'Xen';
381
- break;
382
- }
368
+ if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; }
369
+ if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; }
370
+ if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; }
383
371
  }
384
372
  util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | fl *').then((stdout, error) => {
385
373
  if (!error) {