Skip to content

Commit 392473e

Browse files
system() chassis type parsing improved
1 parent ca8c8c1 commit 392473e

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
9090

9191
| Version | Date | Comment |
9292
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
93+
| 5.24.7 | 2025-01-03 | `system()` chassis type parsing improved (macOS) |
9394
| 5.24.6 | 2025-01-02 | `cpu()` clean brand string (linux) |
9495
| 5.24.5 | 2025-01-02 | `users()` improved date parsing (macOS) |
9596
| 5.24.4 | 2025-01-02 | `__proto__` added prototypes |

docs/history.html

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ <h3>Full version history</h3>
5757
</tr>
5858
</thead>
5959
<tbody>
60+
<tr>
61+
<th scope="row">5.24.7</th>
62+
<td>2025-01-03</td>
63+
<td><span class="code">system()</span> chassis type detection improved (macOS)</td>
64+
</tr>
6065
<tr>
6166
<th scope="row">5.24.6</th>
6267
<td>2025-01-02</td>

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<img class="logo" src="assets/logo.png" alt="logo">
171171
<div class="title">systeminformation</div>
172172
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
173-
3<div class="version">New Version: <span id="version">5.24.6</span></div>
173+
3<div class="version">New Version: <span id="version">5.24.7</span></div>
174174
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
175175
</div>
176176
<div class="down">

lib/system.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function system(callback) {
221221
// const version = util.getValue(lines, 'version', '=', true);
222222
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
223223
result.model = model.key;
224-
result.type = macOsChassisType(model.model);
224+
result.type = macOsChassisType(model.version);
225225
result.version = model.version;
226226
result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
227227
result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
@@ -607,13 +607,13 @@ exports.baseboard = baseboard;
607607

608608
function macOsChassisType(model) {
609609
model = model.toLowerCase();
610-
if (model.startsWith('macbookair')) { return 'Notebook'; }
611-
if (model.startsWith('macbookpro')) { return 'Laptop'; }
612-
if (model.startsWith('macbook')) { return 'Notebook'; }
613-
if (model.startsWith('macmini')) { return 'Desktop'; }
614-
if (model.startsWith('imac')) { return 'Desktop'; }
615-
if (model.startsWith('macstudio')) { return 'Desktop'; }
616-
if (model.startsWith('macpro')) { return 'Tower'; }
610+
if (model.indexOf('macbookair') >= 0 || model.indexOf('macbook air') >= 0) { return 'Notebook'; }
611+
if (model.indexOf('macbookpro') >= 0 || model.indexOf('macbook pro') >= 0) { return 'Notebook'; }
612+
if (model.indexOf('macbook') >= 0) { return 'Notebook'; }
613+
if (model.indexOf('macmini') >= 0 || model.indexOf('mac mini') >= 0) { return 'Desktop'; }
614+
if (model.indexOf('imac') >= 0) { return 'Desktop'; }
615+
if (model.indexOf('macstudio') >= 0 || model.indexOf('mac studio') >= 0) { return 'Desktop'; }
616+
if (model.indexOf('macpro') >= 0 || model.indexOf('mac pro') >= 0) { return 'Tower'; }
617617
return 'Other';
618618
}
619619

0 commit comments

Comments
 (0)