system() chassis type parsing improved
This commit is contained in:
+8
-8
@@ -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';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user