systeminformation 5.10.2 → 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.
Files changed (2) hide show
  1. package/lib/system.js +12 -24
  2. package/package.json +1 -1
package/lib/system.js CHANGED
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.10.2",
3
+ "version": "5.10.3",
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)",