| 5.22.1 |
2024-03-12 |
diff --git a/docs/index.html b/docs/index.html
index f31743c..35fe5dc 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.22.1
+ New Version: 5.22.2
diff --git a/lib/system.js b/lib/system.js
index 1e90874..5390c0c 100644
--- a/lib/system.js
+++ b/lib/system.js
@@ -215,12 +215,14 @@ function system(callback) {
exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
if (!error) {
let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
+ const model = splitByNumber(util.getValue(lines, 'model', '=', true));
+ const version = util.getValue(lines, 'version', '=', true);
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
- result.model = util.getValue(lines, 'model', '=', true, true);
- result.version = util.getValue(lines, 'version', '=', true);
+ result.model = version ? util.getValue(lines, 'model', '=', true) : model[0];
+ result.version = version || model[1];
result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
- result.sku = util.getValue(lines, 'board-id', '=', true);
+ result.sku = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-sub-type', '=', true);
}
if (callback) { callback(result); }
resolve(result);
@@ -602,6 +604,33 @@ function baseboard(callback) {
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'; }
+ return 'Other';
+}
+
+function splitByNumber(str) {
+ let numberStarted = false;
+ let num = '';
+ let cpart = '';
+ for (const c of str) {
+ if ((c >= '0' && c <= '9') || numberStarted) {
+ numberStarted = true;
+ num += c;
+ } else {
+ cpart += c;
+ }
+ }
+ return [cpart, num];
+}
+
function chassis(callback) {
const chassisTypes = ['Other',
'Unknown',
@@ -680,11 +709,16 @@ function chassis(callback) {
exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
if (!error) {
let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
+ const model = util.getValue(lines, 'model', '=', true);
+ const modelParts = splitByNumber(model);
+ const version = util.getValue(lines, 'version', '=', true);
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
- result.model = util.getValue(lines, 'model', '=', true);
- result.version = util.getValue(lines, 'version', '=', true);
+ result.model = version ? util.getValue(lines, 'model', '=', true) : modelParts[0];
+ result.type = macOsChassisType(result.model);
+ result.version = version || model;
result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
- result.assetTag = util.getValue(lines, 'board-id', '=', true);
+ result.assetTag = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-type', '=', true);
+ result.sku = util.getValue(lines, 'target-sub-type', '=', true);
}
if (callback) { callback(result); }