cpu() fix manufacturer

This commit is contained in:
Sebastian Hildebrandt 2022-01-17 00:28:15 +01:00
parent acf1a89bf2
commit 7eb8e074eb
4 changed files with 28 additions and 4 deletions

View File

@ -80,6 +80,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.10.1 | 2022-01-17 | `cpu()` fix manufacturer |
| 5.10.0 | 2022-01-09 | basic `Android` support |
| 5.9.18 | 2022-01-08 | `wifiConections()` fix empty issue (mac OS) |
| 5.9.17 | 2021-12-07 | `wifiNetworks()` fix empty issue (mac OS) |
| 5.9.16 | 2021-12-05 | `wifiNetworks()` adaption for Apple silicon (mac OS) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.10.1</th>
<td>2022-01-17</td>
<td><span class="code">cpu()</span> fix manufacturer</td>
</tr>
<tr>
<th scope="row">5.10.0</th>
<td>2022-01-09</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.10.0</span></div>
<div class="version">New Version: <span id="version">5.10.1</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -515,12 +515,29 @@ const socketTypes = {
63: 'LGA4677',
};
function cpuManufacturer(str) {
let result = str;
str = str.toLowerCase();
if (str.indexOf('intel') >= 0) { result = 'Intel'; }
if (str.indexOf('amd') >= 0) { result = 'AMD'; }
if (str.indexOf('qemu') >= 0) { result = 'QEMU'; }
if (str.indexOf('hygon') >= 0) { result = 'Hygon'; }
if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; }
if (str.indexOf('vmware') >= 0) { result = 'VMware'; }
if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
if (str.indexOf('apple') >= 0) { result = 'Apple'; }
return result;
}
function cpuBrandManufacturer(res) {
res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim();
res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim();
res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim();
res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
res.manufacturer = res.brand.split(' ')[0];
res.manufacturer = cpuManufacturer(res.brand);
let parts = res.brand.split(' ');
parts.shift();
@ -655,7 +672,7 @@ function getCpu() {
result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100;
result = cpuBrandManufacturer(result);
result.vendor = util.getValue(lines, 'vendor id');
result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
// if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
result.family = util.getValue(lines, 'cpu family');
@ -733,7 +750,7 @@ function getCpu() {
result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100;
result = cpuBrandManufacturer(result);
result.vendor = util.getValue(lines, 'manufacturer');
result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
let sig = util.getValue(lines, 'signature');
sig = sig.split(',');
for (var i = 0; i < sig.length; i++) {