system() chassis type parsing improved

This commit is contained in:
Sebastian Hildebrandt 2025-01-02 18:42:43 +01:00
parent ca8c8c1c47
commit 392473e431
4 changed files with 15 additions and 9 deletions

View File

@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.24.7 | 2025-01-03 | `system()` chassis type parsing improved (macOS) |
| 5.24.6 | 2025-01-02 | `cpu()` clean brand string (linux) |
| 5.24.5 | 2025-01-02 | `users()` improved date parsing (macOS) |
| 5.24.4 | 2025-01-02 | `__proto__` added prototypes |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.24.7</th>
<td>2025-01-03</td>
<td><span class="code">system()</span> chassis type detection improved (macOS)</td>
</tr>
<tr>
<th scope="row">5.24.6</th>
<td>2025-01-02</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
3<div class="version">New Version: <span id="version">5.24.6</span></div>
3<div class="version">New Version: <span id="version">5.24.7</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

@ -221,7 +221,7 @@ function system(callback) {
// const version = util.getValue(lines, 'version', '=', true);
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
result.model = model.key;
result.type = macOsChassisType(model.model);
result.type = macOsChassisType(model.version);
result.version = model.version;
result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
@ -607,13 +607,13 @@ exports.baseboard = baseboard;
function macOsChassisType(model) {
model = model.toLowerCase();
if (model.startsWith('macbookair')) { return 'Notebook'; }
if (model.startsWith('macbookpro')) { return 'Laptop'; }
if (model.startsWith('macbook')) { return 'Notebook'; }
if (model.startsWith('macmini')) { return 'Desktop'; }
if (model.startsWith('imac')) { return 'Desktop'; }
if (model.startsWith('macstudio')) { return 'Desktop'; }
if (model.startsWith('macpro')) { return 'Tower'; }
if (model.indexOf('macbookair') >= 0 || model.indexOf('macbook air') >= 0) { return 'Notebook'; }
if (model.indexOf('macbookpro') >= 0 || model.indexOf('macbook pro') >= 0) { return 'Notebook'; }
if (model.indexOf('macbook') >= 0) { return 'Notebook'; }
if (model.indexOf('macmini') >= 0 || model.indexOf('mac mini') >= 0) { return 'Desktop'; }
if (model.indexOf('imac') >= 0) { return 'Desktop'; }
if (model.indexOf('macstudio') >= 0 || model.indexOf('mac studio') >= 0) { return 'Desktop'; }
if (model.indexOf('macpro') >= 0 || model.indexOf('mac pro') >= 0) { return 'Tower'; }
return 'Other';
}