systeminformation 5.24.6 → 5.24.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +1 -0
- package/lib/system.js +8 -8
- package/lib/util.js +14 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
package/lib/system.js
CHANGED
|
@@ -221,7 +221,7 @@ function system(callback) {
|
|
|
221
221
|
// const version = util.getValue(lines, 'version', '=', true);
|
|
222
222
|
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
|
|
223
223
|
result.model = model.key;
|
|
224
|
-
result.type = macOsChassisType(model.
|
|
224
|
+
result.type = macOsChassisType(model.version);
|
|
225
225
|
result.version = model.version;
|
|
226
226
|
result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
|
|
227
227
|
result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
|
|
@@ -607,13 +607,13 @@ exports.baseboard = baseboard;
|
|
|
607
607
|
|
|
608
608
|
function macOsChassisType(model) {
|
|
609
609
|
model = model.toLowerCase();
|
|
610
|
-
if (model.
|
|
611
|
-
if (model.
|
|
612
|
-
if (model.
|
|
613
|
-
if (model.
|
|
614
|
-
if (model.
|
|
615
|
-
if (model.
|
|
616
|
-
if (model.
|
|
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'; }
|
|
617
617
|
return 'Other';
|
|
618
618
|
}
|
|
619
619
|
|
package/lib/util.js
CHANGED
|
@@ -42,6 +42,7 @@ let _psChild;
|
|
|
42
42
|
let _psResult = '';
|
|
43
43
|
let _psCmds = [];
|
|
44
44
|
let _psPersistent = false;
|
|
45
|
+
let _powerShell = '';
|
|
45
46
|
const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
|
|
46
47
|
const _psCmdStart = '--###START###--';
|
|
47
48
|
const _psError = '--ERROR--';
|
|
@@ -332,6 +333,16 @@ function findObjectByKey(array, key, value) {
|
|
|
332
333
|
return -1;
|
|
333
334
|
}
|
|
334
335
|
|
|
336
|
+
function getPowershell() {
|
|
337
|
+
_powerShell = 'powershell.exe';
|
|
338
|
+
if (_windows) {
|
|
339
|
+
const defaultPath = `${WINDIR}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
340
|
+
if (fs.existsSync(defaultPath)) {
|
|
341
|
+
_powerShell = defaultPath;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
335
346
|
function getWmic() {
|
|
336
347
|
if (os.type() === 'Windows_NT' && !wmicPath) {
|
|
337
348
|
wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe';
|
|
@@ -401,7 +412,7 @@ function powerShellProceedResults(data) {
|
|
|
401
412
|
|
|
402
413
|
function powerShellStart() {
|
|
403
414
|
if (!_psChild) {
|
|
404
|
-
_psChild = spawn(
|
|
415
|
+
_psChild = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
|
|
405
416
|
stdio: 'pipe',
|
|
406
417
|
windowsHide: true,
|
|
407
418
|
maxBuffer: 1024 * 20000,
|
|
@@ -479,7 +490,7 @@ function powerShell(cmd) {
|
|
|
479
490
|
return new Promise((resolve) => {
|
|
480
491
|
process.nextTick(() => {
|
|
481
492
|
try {
|
|
482
|
-
const child = spawn(
|
|
493
|
+
const child = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
|
|
483
494
|
stdio: 'pipe',
|
|
484
495
|
windowsHide: true,
|
|
485
496
|
maxBuffer: 1024 * 20000,
|
|
@@ -2595,3 +2606,4 @@ exports.semverCompare = semverCompare;
|
|
|
2595
2606
|
exports.getAppleModel = getAppleModel;
|
|
2596
2607
|
exports.checkWebsite = checkWebsite;
|
|
2597
2608
|
exports.cleanString = cleanString;
|
|
2609
|
+
exports.getPowershell = getPowershell;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.8",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|