systeminformation 5.10.0 → 5.10.1

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/cpu.js +20 -3
  2. package/package.json +1 -1
package/lib/cpu.js CHANGED
@@ -515,12 +515,29 @@ const socketTypes = {
515
515
  63: 'LGA4677',
516
516
  };
517
517
 
518
+ function cpuManufacturer(str) {
519
+ let result = str;
520
+ str = str.toLowerCase();
521
+
522
+ if (str.indexOf('intel') >= 0) { result = 'Intel'; }
523
+ if (str.indexOf('amd') >= 0) { result = 'AMD'; }
524
+ if (str.indexOf('qemu') >= 0) { result = 'QEMU'; }
525
+ if (str.indexOf('hygon') >= 0) { result = 'Hygon'; }
526
+ if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; }
527
+ if (str.indexOf('vmware') >= 0) { result = 'VMware'; }
528
+ if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
529
+ if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
530
+ if (str.indexOf('apple') >= 0) { result = 'Apple'; }
531
+
532
+ return result;
533
+ }
534
+
518
535
  function cpuBrandManufacturer(res) {
519
536
  res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim();
520
537
  res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim();
521
538
  res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim();
522
539
  res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
523
- res.manufacturer = res.brand.split(' ')[0];
540
+ res.manufacturer = cpuManufacturer(res.brand);
524
541
 
525
542
  let parts = res.brand.split(' ');
526
543
  parts.shift();
@@ -655,7 +672,7 @@ function getCpu() {
655
672
  result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100;
656
673
 
657
674
  result = cpuBrandManufacturer(result);
658
- result.vendor = util.getValue(lines, 'vendor id');
675
+ result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
659
676
  // if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
660
677
 
661
678
  result.family = util.getValue(lines, 'cpu family');
@@ -733,7 +750,7 @@ function getCpu() {
733
750
  result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100;
734
751
 
735
752
  result = cpuBrandManufacturer(result);
736
- result.vendor = util.getValue(lines, 'manufacturer');
753
+ result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
737
754
  let sig = util.getValue(lines, 'signature');
738
755
  sig = sig.split(',');
739
756
  for (var i = 0; i < sig.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
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)",