systeminformation 6.0.0-beta.5 → 6.0.0-beta.7
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/README.md +11 -0
- package/dist/bsd/network-stats.js +1 -1
- package/dist/common/files.d.ts +1 -0
- package/dist/common/files.js +10 -1
- package/dist/common/nvidia.js +2 -5
- package/dist/common/types.d.ts +7 -0
- package/dist/darwin/disk-layout.js +10 -6
- package/dist/darwin/fans.d.ts +2 -0
- package/dist/darwin/fans.js +28 -0
- package/dist/darwin/index.d.ts +1 -0
- package/dist/darwin/index.js +4 -2
- package/dist/darwin/network-stats.js +4 -4
- package/dist/fans.d.ts +1 -0
- package/dist/fans.js +17 -0
- package/dist/get-data.d.ts +2 -0
- package/dist/get-data.js +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/linux/audio.js +8 -4
- package/dist/linux/fans.d.ts +2 -0
- package/dist/linux/fans.js +91 -0
- package/dist/linux/gpu.js +3 -10
- package/dist/linux/index.d.ts +1 -0
- package/dist/linux/index.js +4 -2
- package/dist/linux/network-interfaces.js +1 -1
- package/dist/linux/network-stats.js +7 -35
- package/dist/versions.js +32 -77
- package/dist/windows/disk-layout.js +3 -0
- package/dist/windows/fans.d.ts +2 -0
- package/dist/windows/fans.js +71 -0
- package/dist/windows/index.d.ts +1 -0
- package/dist/windows/index.js +4 -2
- package/dist/windows/network-interfaces.js +5 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -289,6 +289,12 @@ Full function reference with examples can be found at [https://systeminformation
|
|
|
289
289
|
| | max | X | X | X | X | | max temperature |
|
|
290
290
|
| | socket | X | | | | | array socket temperatures |
|
|
291
291
|
| | chipset | X | | | | | chipset temperature |
|
|
292
|
+
| si.fans() | [{...}] | X | | X* | X* | | detected fans |
|
|
293
|
+
| | [0].id | X | | X* | X* | | identifier, e.g. hwmon2/fan1 |
|
|
294
|
+
| | [0].label | X | | X* | X* | | label if the driver provides one |
|
|
295
|
+
| | [0].rpm | X | | X* | X* | | speed in rpm (or null) |
|
|
296
|
+
| | [0].pwm | X | | X* | X* | | duty cycle in % (or null) |
|
|
297
|
+
| | [0].source | X | | X* | X* | | chip / provider the value came from |
|
|
292
298
|
| si.npu() | [{...}] | X | | X | X | | detected NPUs / AI accelerators |
|
|
293
299
|
| | [0].vendor | X | | X | X | | vendor (Intel, AMD, Apple, ...) |
|
|
294
300
|
| | [0].name | X | | X | X | | name |
|
|
@@ -1005,6 +1011,11 @@ $ npm install macos-temperature-sensor --save
|
|
|
1005
1011
|
|
|
1006
1012
|
`systeminformation` will then detect this additional library and return the temperature when calling systeminformations standard function `cpuTemperature()`.
|
|
1007
1013
|
On Apple Silicon machines `macos-temperature-sensor` also enables the GPU temperature (`temperatureGpu`) in `gpu()`
|
|
1014
|
+
and - as soon as the package exposes them - the fan speeds in `fans()`.
|
|
1015
|
+
|
|
1016
|
+
#### Windows - Fan Speed
|
|
1017
|
+
|
|
1018
|
+
Windows itself does not expose actual fan speeds: `Win32_Fan` only reports that a fan exists, its `DesiredSpeed` is the *requested* speed and is left empty by virtually every mainboard. Real values are read from a running [LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor) or OpenHardwareMonitor, which publish their sensors in an own WMI namespace. Without one of these tools running, `fans()` returns an empty array or entries without `rpm`.
|
|
1008
1019
|
|
|
1009
1020
|
#### Windows Temperature, Battery, ...
|
|
1010
1021
|
|
|
@@ -18,7 +18,7 @@ const networkStatsSingle = async (iface) => {
|
|
|
18
18
|
let rx_errors = 0;
|
|
19
19
|
let tx_dropped = 0;
|
|
20
20
|
let tx_errors = 0;
|
|
21
|
-
const
|
|
21
|
+
const stdout = await (0, exec_1.execSecure)('netstat', ['-ibndI', iface]);
|
|
22
22
|
if (stdout) {
|
|
23
23
|
const lines = stdout.split('\n');
|
|
24
24
|
for (let i = 1; i < lines.length; i++) {
|
package/dist/common/files.d.ts
CHANGED
package/dist/common/files.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fileExists = exports.getFilesInPath = void 0;
|
|
3
|
+
exports.readSysfs = exports.fileExists = exports.getFilesInPath = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -37,3 +37,12 @@ const fileExists = async (file) => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
exports.fileExists = fileExists;
|
|
40
|
+
const readSysfs = async (file) => {
|
|
41
|
+
try {
|
|
42
|
+
return (await (0, promises_1.readFile)(file, 'utf8')).trim();
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.readSysfs = readSysfs;
|
package/dist/common/nvidia.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.mergeControllerNvidia = exports.nvidiaDevices = exports.nvidiaSmi = expo
|
|
|
4
4
|
const promises_1 = require("fs/promises");
|
|
5
5
|
const const_1 = require("./const");
|
|
6
6
|
const exec_1 = require("./exec");
|
|
7
|
-
const security_1 = require("./security");
|
|
8
7
|
let _nvidiaSmiPath = null;
|
|
9
8
|
const getNvidiaSmi = async () => {
|
|
10
9
|
if (_nvidiaSmiPath !== null) {
|
|
@@ -49,11 +48,9 @@ const nvidiaSmi = async () => {
|
|
|
49
48
|
const nvidiaSmiExe = await (0, exports.getNvidiaSmi)();
|
|
50
49
|
if (nvidiaSmiExe) {
|
|
51
50
|
const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits';
|
|
52
|
-
const cmd = `${nvidiaSmiExe} ${nvidiaSmiOpts}`;
|
|
53
51
|
try {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
return stdout;
|
|
52
|
+
const { stdout } = await (0, exec_1.execFile)(nvidiaSmiExe, nvidiaSmiOpts.split(' '), const_1.execOptsWin);
|
|
53
|
+
return String(stdout);
|
|
57
54
|
}
|
|
58
55
|
catch { }
|
|
59
56
|
}
|
package/dist/common/types.d.ts
CHANGED
|
@@ -321,6 +321,13 @@ export type CpuTemperatureObject = {
|
|
|
321
321
|
socket: number[];
|
|
322
322
|
chipset: number | null;
|
|
323
323
|
};
|
|
324
|
+
export type FanData = {
|
|
325
|
+
id: string;
|
|
326
|
+
label: string | null;
|
|
327
|
+
rpm: number | null;
|
|
328
|
+
pwm: number | null;
|
|
329
|
+
source: string;
|
|
330
|
+
};
|
|
324
331
|
export type CurrentLoadData = {
|
|
325
332
|
avgLoad: number;
|
|
326
333
|
currentLoad: number;
|
|
@@ -12,6 +12,13 @@ const diskLayout = async () => {
|
|
|
12
12
|
let stdout = '';
|
|
13
13
|
let cmd = '';
|
|
14
14
|
let cmdFullSmart = '';
|
|
15
|
+
const addSmartCmds = (bsdName) => {
|
|
16
|
+
if (typeof bsdName !== 'string' || !/^disk\d+(s\d+)*$/.test(bsdName)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
cmd += `printf "\n${bsdName}|"; diskutil info /dev/${bsdName} | grep SMART;`;
|
|
20
|
+
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${bsdName};`;
|
|
21
|
+
};
|
|
15
22
|
try {
|
|
16
23
|
({ stdout } = await (0, exec_1.exec)(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPStorageDataType -xml`, { maxBuffer: const_1.MAX_BUFFER_SIZE }));
|
|
17
24
|
const data = (0, darwin_1.plistParser)(stdout, false);
|
|
@@ -44,8 +51,7 @@ const diskLayout = async () => {
|
|
|
44
51
|
temperature: null,
|
|
45
52
|
bsdName: disk.bsd_name
|
|
46
53
|
});
|
|
47
|
-
|
|
48
|
-
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${disk.bsd_name};`;
|
|
54
|
+
addSmartCmds(disk.bsd_name);
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
});
|
|
@@ -74,8 +80,7 @@ const diskLayout = async () => {
|
|
|
74
80
|
temperature: null,
|
|
75
81
|
bsdName: disk.bsd_name
|
|
76
82
|
});
|
|
77
|
-
|
|
78
|
-
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${disk.bsd_name};`;
|
|
83
|
+
addSmartCmds(disk.bsd_name);
|
|
79
84
|
});
|
|
80
85
|
}
|
|
81
86
|
});
|
|
@@ -106,8 +111,7 @@ const diskLayout = async () => {
|
|
|
106
111
|
temperature: null,
|
|
107
112
|
bsdName: media.bsd_name
|
|
108
113
|
});
|
|
109
|
-
|
|
110
|
-
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${disk.bsd_name};`;
|
|
114
|
+
addSmartCmds(media.bsd_name);
|
|
111
115
|
}
|
|
112
116
|
else if (disk?._items.length) {
|
|
113
117
|
disk._items.forEach((subdisk) => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const fans = async () => {
|
|
6
|
+
await (0, common_1.nextTick)();
|
|
7
|
+
const result = [];
|
|
8
|
+
try {
|
|
9
|
+
const macosTemp = require('macos-temperature-sensor');
|
|
10
|
+
if (typeof macosTemp.fans === 'function') {
|
|
11
|
+
const res = macosTemp.fans();
|
|
12
|
+
if (Array.isArray(res)) {
|
|
13
|
+
res.forEach((fan, index) => {
|
|
14
|
+
result.push({
|
|
15
|
+
id: `fan${index}`,
|
|
16
|
+
label: fan?.label || null,
|
|
17
|
+
rpm: typeof fan?.rpm === 'number' ? Math.round(fan.rpm) : null,
|
|
18
|
+
pwm: typeof fan?.pwm === 'number' ? Math.round(fan.pwm) : null,
|
|
19
|
+
source: 'SMC'
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
exports.fans = fans;
|
package/dist/darwin/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
|
|
|
11
11
|
export { cpuCurrentSpeed } from '../cpu-current-speed';
|
|
12
12
|
export { cpuFlags } from './cpu-flags';
|
|
13
13
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
+
export { fans } from './fans';
|
|
14
15
|
export { currentLoad } from '../cpu-current-load';
|
|
15
16
|
export { diskLayout } from './disk-layout';
|
|
16
17
|
export { disksIO } from './disks-io';
|
package/dist/darwin/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = void 0;
|
|
3
|
+
exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
28
28
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
29
29
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
30
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
+
var fans_1 = require("./fans");
|
|
32
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
31
33
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
32
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
33
35
|
var disk_layout_1 = require("./disk-layout");
|
|
@@ -19,11 +19,11 @@ const networkStatsSingle = async (iface) => {
|
|
|
19
19
|
let rx_errors = 0;
|
|
20
20
|
let tx_dropped = 0;
|
|
21
21
|
let tx_errors = 0;
|
|
22
|
-
let stdout = '';
|
|
23
|
-
|
|
24
|
-
operstate = (
|
|
22
|
+
let stdout = await (0, exec_1.execSecure)('ifconfig', [iface]);
|
|
23
|
+
const statusLine = stdout.split('\n').find((l) => l.includes('status')) || '';
|
|
24
|
+
operstate = (statusLine.split(':')[1] || '').trim().toLowerCase();
|
|
25
25
|
operstate = operstate === 'active' ? 'up' : operstate === 'inactive' ? 'down' : 'unknown';
|
|
26
|
-
|
|
26
|
+
stdout = await (0, exec_1.execSecure)('netstat', ['-bdnI', iface]);
|
|
27
27
|
if (stdout) {
|
|
28
28
|
const lines = stdout.toString().split('\n');
|
|
29
29
|
if (lines.length > 1 && lines[1].trim() !== '') {
|
package/dist/fans.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fans: () => Promise<import("./common/types").FanData[] | null>;
|
package/dist/fans.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const const_1 = require("./common/const");
|
|
5
|
+
const fans = async () => {
|
|
6
|
+
switch (true) {
|
|
7
|
+
case const_1.LINUX || const_1.ANDROID:
|
|
8
|
+
return (await import('./linux/fans.js')).fans();
|
|
9
|
+
case const_1.DARWIN:
|
|
10
|
+
return (await import('./darwin/fans.js')).fans();
|
|
11
|
+
case const_1.WINDOWS:
|
|
12
|
+
return (await import('./windows/fans.js')).fans();
|
|
13
|
+
default:
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.fans = fans;
|
package/dist/get-data.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const getDynamicData: (srv?: string, iface?: string) => Promise<{
|
|
|
40
40
|
processes: import("./common/types").ProcessesData | null;
|
|
41
41
|
currentLoad: import("./common/types").CurrentLoadData;
|
|
42
42
|
temp: any;
|
|
43
|
+
fans: import("./common/types").FanData[] | null;
|
|
43
44
|
networkStats: import("./common/types").NetworkStatsData[] | null;
|
|
44
45
|
networkConnections: import("./common/types").NetworkConnectionsData[] | null;
|
|
45
46
|
mem: any;
|
|
@@ -68,6 +69,7 @@ export declare const getAllData: (srv?: string, iface?: string) => Promise<{
|
|
|
68
69
|
processes: import("./common/types").ProcessesData | null;
|
|
69
70
|
currentLoad: import("./common/types").CurrentLoadData;
|
|
70
71
|
temp: any;
|
|
72
|
+
fans: import("./common/types").FanData[] | null;
|
|
71
73
|
networkStats: import("./common/types").NetworkStatsData[] | null;
|
|
72
74
|
networkConnections: import("./common/types").NetworkConnectionsData[] | null;
|
|
73
75
|
mem: any;
|
package/dist/get-data.js
CHANGED
|
@@ -99,13 +99,14 @@ const getStaticData = async () => {
|
|
|
99
99
|
exports.getStaticData = getStaticData;
|
|
100
100
|
const getDynamicData = async (srv = '', iface = '') => {
|
|
101
101
|
await (0, common_1.nextTick)();
|
|
102
|
-
const [time, cpuCurrentSpeed, users, processes, currentLoad, temp, networkStats, networkConnections, mem, battery, services, fsSize, fsStats, disksIO, wifiNetworks, wifiConnections, fsOpenFiles, blockDevices, inetLatency] = await Promise.all([
|
|
102
|
+
const [time, cpuCurrentSpeed, users, processes, currentLoad, temp, fans, networkStats, networkConnections, mem, battery, services, fsSize, fsStats, disksIO, wifiNetworks, wifiConnections, fsOpenFiles, blockDevices, inetLatency] = await Promise.all([
|
|
103
103
|
si.time(),
|
|
104
104
|
si.cpuCurrentSpeed(),
|
|
105
105
|
si.users(),
|
|
106
106
|
si.processes(),
|
|
107
107
|
si.currentLoad(),
|
|
108
108
|
si.cpuTemperature(),
|
|
109
|
+
si.fans(),
|
|
109
110
|
(async () => si.networkStats(iface || (await si.networkInterfaceDefault()) || '*'))(),
|
|
110
111
|
si.networkConnections(),
|
|
111
112
|
si.mem(),
|
|
@@ -129,6 +130,7 @@ const getDynamicData = async (srv = '', iface = '') => {
|
|
|
129
130
|
processes,
|
|
130
131
|
currentLoad,
|
|
131
132
|
temp,
|
|
133
|
+
fans,
|
|
132
134
|
networkStats,
|
|
133
135
|
networkConnections,
|
|
134
136
|
mem,
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
|
|
|
11
11
|
export { cpuCurrentSpeed } from './cpu-current-speed';
|
|
12
12
|
export { cpuFlags } from './cpu-flags';
|
|
13
13
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
+
export { fans } from './fans';
|
|
14
15
|
export { currentLoad } from './cpu-current-load';
|
|
15
16
|
export { diskLayout } from './disk-layout';
|
|
16
17
|
export { disksIO } from './disks-io';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = void 0;
|
|
3
|
+
exports.osInfo = exports.observe = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetPublicIp = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.getAllData = exports.getDynamicData = exports.getStaticData = exports.get = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
28
28
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
29
29
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
30
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
+
var fans_1 = require("./fans");
|
|
32
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
31
33
|
var cpu_current_load_1 = require("./cpu-current-load");
|
|
32
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
33
35
|
var disk_layout_1 = require("./disk-layout");
|
package/dist/linux/audio.js
CHANGED
|
@@ -51,11 +51,15 @@ const parseAudioAlsa = (stdout) => {
|
|
|
51
51
|
const [cards, pcms] = `${stdout}`.split('--pcm--');
|
|
52
52
|
const lines = (cards || '').split('\n');
|
|
53
53
|
lines.forEach((line, i) => {
|
|
54
|
-
const card = line.match(/^\s*(\d+)\s+\[(.+?)\s*\]:\s*(
|
|
55
|
-
if (card) {
|
|
54
|
+
const card = line.match(/^\s*(\d+)\s+\[(.+?)\s*\]:\s*(.*)$/);
|
|
55
|
+
if (card && card[3].trim()) {
|
|
56
56
|
const index = card[1];
|
|
57
|
-
const
|
|
58
|
-
const name = card[
|
|
57
|
+
const sep = card[3].lastIndexOf(' - ');
|
|
58
|
+
const name = (sep >= 0 ? card[3].substring(sep + 3) : card[3]).trim();
|
|
59
|
+
let driver = (sep >= 0 ? card[3].substring(0, sep) : '').trim();
|
|
60
|
+
if (name && driver.endsWith(name)) {
|
|
61
|
+
driver = driver.substring(0, driver.length - name.length).trim();
|
|
62
|
+
}
|
|
59
63
|
const longName = (lines[i + 1] || '').trim();
|
|
60
64
|
const manufacturer = longName.indexOf(name) > 0 ? longName.substring(0, longName.indexOf(name)).trim() : '';
|
|
61
65
|
const devices = (pcms || '').split('\n').filter((pcm) => pcm.indexOf(`/card${index}/pcm`) >= 0);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const files_1 = require("../common/files");
|
|
7
|
+
const toNumber = (value) => {
|
|
8
|
+
const result = Number.parseFloat(value);
|
|
9
|
+
return Number.isNaN(result) ? null : result;
|
|
10
|
+
};
|
|
11
|
+
const pwmToPercent = (value) => {
|
|
12
|
+
const raw = toNumber(value);
|
|
13
|
+
return raw === null ? null : Math.round((raw / 255) * 100);
|
|
14
|
+
};
|
|
15
|
+
const hwmonFans = async (hwmonPath) => {
|
|
16
|
+
const fans = [];
|
|
17
|
+
let nodes = [];
|
|
18
|
+
try {
|
|
19
|
+
nodes = await (0, promises_1.readdir)(hwmonPath);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return fans;
|
|
23
|
+
}
|
|
24
|
+
for (const node of nodes) {
|
|
25
|
+
const entries = [];
|
|
26
|
+
try {
|
|
27
|
+
entries.push(...(await (0, promises_1.readdir)(`${hwmonPath}/${node}`)));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const source = (await (0, files_1.readSysfs)(`${hwmonPath}/${node}/name`)) || node;
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const match = /^fan(\d+)_input$/.exec(entry);
|
|
35
|
+
if (!match) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const index = match[1];
|
|
39
|
+
const rpm = toNumber(await (0, files_1.readSysfs)(`${hwmonPath}/${node}/fan${index}_input`));
|
|
40
|
+
if (rpm === null) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
fans.push({
|
|
44
|
+
id: `${node}/fan${index}`,
|
|
45
|
+
label: (await (0, files_1.readSysfs)(`${hwmonPath}/${node}/fan${index}_label`)) || null,
|
|
46
|
+
rpm,
|
|
47
|
+
pwm: pwmToPercent(await (0, files_1.readSysfs)(`${hwmonPath}/${node}/pwm${index}`)),
|
|
48
|
+
source
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return fans;
|
|
53
|
+
};
|
|
54
|
+
const coolingDeviceFans = async (thermalPath) => {
|
|
55
|
+
const fans = [];
|
|
56
|
+
let nodes = [];
|
|
57
|
+
try {
|
|
58
|
+
nodes = (await (0, promises_1.readdir)(thermalPath)).filter((entry) => entry.startsWith('cooling_device'));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return fans;
|
|
62
|
+
}
|
|
63
|
+
for (const node of nodes) {
|
|
64
|
+
const type = await (0, files_1.readSysfs)(`${thermalPath}/${node}/type`);
|
|
65
|
+
if (!type.toLowerCase().includes('fan')) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const current = toNumber(await (0, files_1.readSysfs)(`${thermalPath}/${node}/cur_state`));
|
|
69
|
+
const max = toNumber(await (0, files_1.readSysfs)(`${thermalPath}/${node}/max_state`));
|
|
70
|
+
if (current === null || !max) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
fans.push({
|
|
74
|
+
id: node,
|
|
75
|
+
label: null,
|
|
76
|
+
rpm: null,
|
|
77
|
+
pwm: Math.round((current / max) * 100),
|
|
78
|
+
source: type
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return fans;
|
|
82
|
+
};
|
|
83
|
+
const fans = async (hwmonPath = '/sys/class/hwmon', thermalPath = '/sys/class/thermal') => {
|
|
84
|
+
await (0, common_1.nextTick)();
|
|
85
|
+
const result = await hwmonFans(hwmonPath);
|
|
86
|
+
if (!result.length) {
|
|
87
|
+
return coolingDeviceFans(thermalPath);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
};
|
|
91
|
+
exports.fans = fans;
|
package/dist/linux/gpu.js
CHANGED
|
@@ -5,20 +5,13 @@ const promises_1 = require("fs/promises");
|
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
const const_1 = require("../common/const");
|
|
7
7
|
const exec_1 = require("../common/exec");
|
|
8
|
+
const files_1 = require("../common/files");
|
|
8
9
|
const nvidia_1 = require("../common/nvidia");
|
|
9
10
|
const raspberry_1 = require("../common/raspberry");
|
|
10
|
-
const readSysfs = async (file) => {
|
|
11
|
-
try {
|
|
12
|
-
return (await (0, promises_1.readFile)(file, 'utf8')).trim();
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return '';
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
11
|
const readSysfsNumber = async (files, divisor = 1, preferNonZero = false) => {
|
|
19
12
|
let fallback = null;
|
|
20
13
|
for (const file of files) {
|
|
21
|
-
const value = Number.parseFloat(await readSysfs(file));
|
|
14
|
+
const value = Number.parseFloat(await (0, files_1.readSysfs)(file));
|
|
22
15
|
if (Number.isNaN(value)) {
|
|
23
16
|
continue;
|
|
24
17
|
}
|
|
@@ -77,7 +70,7 @@ const drmDevices = async (drmPath = '/sys/class/drm') => {
|
|
|
77
70
|
temperatureGpu: await readSysfsNumber(hwmon.map((node) => `${node}/temp1_input`), 1000),
|
|
78
71
|
powerDraw: await readSysfsNumber(hwmon.map((node) => `${node}/power1_input`), 1000000),
|
|
79
72
|
powerLimit: await readSysfsNumber(hwmon.map((node) => `${node}/power1_max`), 1000000),
|
|
80
|
-
clockCore: clockCore !== null ? clockCore : parseAmdClock(await readSysfs(`${devicePath}/pp_dpm_sclk`))
|
|
73
|
+
clockCore: clockCore !== null ? clockCore : parseAmdClock(await (0, files_1.readSysfs)(`${devicePath}/pp_dpm_sclk`))
|
|
81
74
|
});
|
|
82
75
|
}
|
|
83
76
|
return devices;
|
package/dist/linux/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
|
|
|
11
11
|
export { cpuCurrentSpeed } from '../cpu-current-speed';
|
|
12
12
|
export { cpuFlags } from './cpu-flags';
|
|
13
13
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
+
export { fans } from './fans';
|
|
14
15
|
export { currentLoad } from '../cpu-current-load';
|
|
15
16
|
export { diskLayout } from './disk-layout';
|
|
16
17
|
export { disksIO } from './disks-io';
|
package/dist/linux/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = void 0;
|
|
3
|
+
exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
28
28
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
29
29
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
30
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
+
var fans_1 = require("./fans");
|
|
32
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
31
33
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
32
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
33
35
|
var disk_layout_1 = require("./disk-layout");
|
|
@@ -267,7 +267,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
267
267
|
ip6subnet = ip6linksubnet;
|
|
268
268
|
}
|
|
269
269
|
const ifaceDevName = dev.split(':')[0].trim();
|
|
270
|
-
const ifaceSanitized = (0, security_1.sanitizeString)(ifaceDevName);
|
|
270
|
+
const ifaceSanitized = (0, security_1.sanitizeString)(ifaceDevName, true);
|
|
271
271
|
const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${ifaceSanitized}/addr_assign_type 2>/dev/null; echo;
|
|
272
272
|
echo -n "address: "; cat /sys/class/net/${ifaceSanitized}/address 2>/dev/null; echo;
|
|
273
273
|
echo -n "addr_len: "; cat /sys/class/net/${ifaceSanitized}/addr_len 2>/dev/null; echo;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.networkStats = void 0;
|
|
4
4
|
const files_1 = require("../common/files");
|
|
5
|
-
const exec_1 = require("../common/exec");
|
|
6
5
|
const common_1 = require("../common");
|
|
7
6
|
const security_1 = require("../common/security");
|
|
8
7
|
const defaults_1 = require("../common/defaults");
|
|
@@ -13,40 +12,13 @@ const networkStatsSingle = async (iface) => {
|
|
|
13
12
|
await (0, common_1.nextTick)();
|
|
14
13
|
const defaults = { ...defaults_1.initNetworkSpeed, iface };
|
|
15
14
|
if (!_network[iface] || (_network[iface] && !_network[iface].ms) || (_network[iface] && _network[iface].ms && Date.now() - _network[iface].ms >= 500)) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'/operstate
|
|
20
|
-
'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'cat /sys/class/net/' +
|
|
24
|
-
iface +
|
|
25
|
-
'/statistics/tx_bytes; ' +
|
|
26
|
-
'cat /sys/class/net/' +
|
|
27
|
-
iface +
|
|
28
|
-
'/statistics/rx_dropped; ' +
|
|
29
|
-
'cat /sys/class/net/' +
|
|
30
|
-
iface +
|
|
31
|
-
'/statistics/rx_errors; ' +
|
|
32
|
-
'cat /sys/class/net/' +
|
|
33
|
-
iface +
|
|
34
|
-
'/statistics/tx_dropped; ' +
|
|
35
|
-
'cat /sys/class/net/' +
|
|
36
|
-
iface +
|
|
37
|
-
'/statistics/tx_errors; ';
|
|
38
|
-
const { stdout } = await (0, exec_1.execSave)(cmd);
|
|
39
|
-
if (stdout) {
|
|
40
|
-
const lines = stdout.split('\n');
|
|
41
|
-
const operstate = lines[0].trim();
|
|
42
|
-
const rx_bytes = (0, common_1.toInt)(lines[1]);
|
|
43
|
-
const tx_bytes = (0, common_1.toInt)(lines[2]);
|
|
44
|
-
const rx_dropped = (0, common_1.toInt)(lines[3]);
|
|
45
|
-
const rx_errors = (0, common_1.toInt)(lines[4]);
|
|
46
|
-
const tx_dropped = (0, common_1.toInt)(lines[5]);
|
|
47
|
-
const tx_errors = (0, common_1.toInt)(lines[6]);
|
|
48
|
-
return (0, network_1.calcNetworkSpeed)(iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network);
|
|
49
|
-
}
|
|
15
|
+
const dir = '/sys/class/net/' + iface;
|
|
16
|
+
if (/^[\w.:@-]+$/.test(iface) && (await (0, files_1.fileExists)(dir))) {
|
|
17
|
+
const [operstate, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors] = await Promise.all([
|
|
18
|
+
(0, files_1.readSysfs)(dir + '/operstate'),
|
|
19
|
+
...['rx_bytes', 'tx_bytes', 'rx_dropped', 'rx_errors', 'tx_dropped', 'tx_errors'].map(async (f) => (0, common_1.toInt)(await (0, files_1.readSysfs)(dir + '/statistics/' + f)))
|
|
20
|
+
]);
|
|
21
|
+
return (0, network_1.calcNetworkSpeed)(iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network);
|
|
50
22
|
}
|
|
51
23
|
return defaults;
|
|
52
24
|
}
|
package/dist/versions.js
CHANGED
|
@@ -414,90 +414,45 @@ const versions = async (apps) => {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
if (Object.keys(appsObj.versions).includes('postgresql')) {
|
|
417
|
-
if (const_1.
|
|
418
|
-
|
|
419
|
-
.then((
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
417
|
+
if (const_1.WINDOWS) {
|
|
418
|
+
windows_1.ps.exec('Get-CimInstance Win32_Service | select caption | fl')
|
|
419
|
+
.then((stdout) => {
|
|
420
|
+
const serviceSections = (stdout ? stdout.toString() : '').split(/\n\s*\n/);
|
|
421
|
+
serviceSections.forEach((item) => {
|
|
422
|
+
const lines = item.trim().split('\r\n');
|
|
423
|
+
const srvCaption = (0, common_1.getValue)(lines, 'caption', ':', true).toLowerCase();
|
|
424
|
+
if (srvCaption.indexOf('postgresql') > -1) {
|
|
425
|
+
const parts = srvCaption.split(' server ');
|
|
426
|
+
if (parts.length > 1) {
|
|
427
|
+
appsObj.versions.postgresql = parts[1];
|
|
427
428
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
functionProcessed();
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
functionProcessed();
|
|
436
|
-
}
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
functionProcessed();
|
|
437
432
|
})
|
|
438
433
|
.catch(() => {
|
|
439
|
-
(
|
|
440
|
-
.then((res) => {
|
|
441
|
-
const postgresql = res.stdout.split('\n')[0].split(' ') || [];
|
|
442
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
443
|
-
appsObj.versions.postgresql = appsObj.versions.postgresql.split('-')[0];
|
|
444
|
-
functionProcessed();
|
|
445
|
-
})
|
|
446
|
-
.catch(() => {
|
|
447
|
-
functionProcessed();
|
|
448
|
-
});
|
|
434
|
+
functionProcessed();
|
|
449
435
|
});
|
|
450
436
|
}
|
|
451
437
|
else {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
functionProcessed();
|
|
467
|
-
})
|
|
468
|
-
.catch(() => {
|
|
469
|
-
functionProcessed();
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
else {
|
|
473
|
-
(0, exec_1.exec)('postgres -V')
|
|
474
|
-
.then((res) => {
|
|
475
|
-
if (res.stdout) {
|
|
476
|
-
const postgresql = res.stdout.split('\n')[0].split(' ') || [];
|
|
477
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
478
|
-
if (appsObj.versions.postgresql.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
|
|
479
|
-
appsObj.versions.postgresql = postgresql[postgresql.length - 2];
|
|
480
|
-
}
|
|
438
|
+
const parsePostgres = (stdout) => {
|
|
439
|
+
const postgresql = stdout.split('\n')[0].split(' ') || [];
|
|
440
|
+
let version = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
441
|
+
if (version.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
|
|
442
|
+
version = postgresql[postgresql.length - 2];
|
|
443
|
+
}
|
|
444
|
+
return version.split('-')[0];
|
|
445
|
+
};
|
|
446
|
+
(async () => {
|
|
447
|
+
for (const cmd of ['postgres -V', 'pg_config --version', 'psql -V']) {
|
|
448
|
+
const { stdout } = await (0, exec_1.execSave)(cmd);
|
|
449
|
+
if (stdout) {
|
|
450
|
+
appsObj.versions.postgresql = parsePostgres(stdout);
|
|
451
|
+
break;
|
|
481
452
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
(0, exec_1.exec)('pg_config --version 2> /dev/null')
|
|
486
|
-
.then((res) => {
|
|
487
|
-
if (res.stdout) {
|
|
488
|
-
const postgresql = res.stdout.toString().split('\n')[0].split(' ') || [];
|
|
489
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
490
|
-
if (appsObj.versions.postgresql.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
|
|
491
|
-
appsObj.versions.postgresql = postgresql[postgresql.length - 2];
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
})
|
|
495
|
-
.catch(() => { })
|
|
496
|
-
.finally(() => {
|
|
497
|
-
functionProcessed();
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
}
|
|
453
|
+
}
|
|
454
|
+
functionProcessed();
|
|
455
|
+
})();
|
|
501
456
|
}
|
|
502
457
|
}
|
|
503
458
|
if (Object.keys(appsObj.versions).includes('perl')) {
|
|
@@ -99,6 +99,9 @@ const diskLayout = async () => {
|
|
|
99
99
|
const smartDev = JSON.parse(stdout.trim());
|
|
100
100
|
if (smartDev?.devices && smartDev.devices.length > 0) {
|
|
101
101
|
for (const dev of smartDev.devices) {
|
|
102
|
+
if (!/^[\w/.,:\\-]+$/.test(String(dev.name || ''))) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
102
105
|
try {
|
|
103
106
|
const { stdout: smartOut } = await (0, exec_1.execSave)(`smartctl -j -a ${dev.name}`, const_1.execOptsWin);
|
|
104
107
|
const smartData = JSON.parse(smartOut);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const windows_1 = require("../common/windows");
|
|
6
|
+
const HARDWARE_MONITORS = [
|
|
7
|
+
{ namespace: 'root\\LibreHardwareMonitor', source: 'LibreHardwareMonitor' },
|
|
8
|
+
{ namespace: 'root\\OpenHardwareMonitor', source: 'OpenHardwareMonitor' }
|
|
9
|
+
];
|
|
10
|
+
const toNumber = (value) => {
|
|
11
|
+
const result = Number.parseFloat(value);
|
|
12
|
+
return Number.isNaN(result) ? null : result;
|
|
13
|
+
};
|
|
14
|
+
const win32Fans = async () => {
|
|
15
|
+
const fans = [];
|
|
16
|
+
try {
|
|
17
|
+
const entries = (0, windows_1.psArray)(await windows_1.ps.exec('Get-CimInstance Win32_Fan | Select-Object DeviceID,Name,DesiredSpeed | ConvertTo-Json -compress'));
|
|
18
|
+
entries.forEach((entry, index) => {
|
|
19
|
+
const rpm = toNumber(entry?.DesiredSpeed);
|
|
20
|
+
fans.push({
|
|
21
|
+
id: entry?.DeviceID || `fan${index}`,
|
|
22
|
+
label: entry?.Name || null,
|
|
23
|
+
rpm: rpm && rpm > 0 ? rpm : null,
|
|
24
|
+
pwm: null,
|
|
25
|
+
source: 'Win32_Fan'
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
return fans;
|
|
31
|
+
};
|
|
32
|
+
const monitorFans = async (namespace, source) => {
|
|
33
|
+
const fans = [];
|
|
34
|
+
try {
|
|
35
|
+
const entries = (0, windows_1.psArray)(await windows_1.ps.exec(`Get-CimInstance -Namespace "${namespace}" -ClassName Sensor | Where-Object { $_.SensorType -eq 'Fan' -or $_.SensorType -eq 'Control' } | Select-Object Identifier,Name,SensorType,Value | ConvertTo-Json -compress`));
|
|
36
|
+
const controls = {};
|
|
37
|
+
entries.forEach((entry) => {
|
|
38
|
+
const value = toNumber(entry?.Value);
|
|
39
|
+
if (entry?.SensorType === 'Control' && entry?.Identifier && value !== null) {
|
|
40
|
+
controls[String(entry.Identifier).replace('/control/', '/fan/')] = Math.round(value);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
entries.forEach((entry, index) => {
|
|
44
|
+
if (entry?.SensorType !== 'Fan') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const identifier = entry?.Identifier ? String(entry.Identifier) : `fan${index}`;
|
|
48
|
+
const pwm = controls[identifier];
|
|
49
|
+
fans.push({
|
|
50
|
+
id: identifier,
|
|
51
|
+
label: entry?.Name || null,
|
|
52
|
+
rpm: toNumber(entry?.Value),
|
|
53
|
+
pwm: pwm === undefined ? null : pwm,
|
|
54
|
+
source
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch { }
|
|
59
|
+
return fans;
|
|
60
|
+
};
|
|
61
|
+
const fans = async () => {
|
|
62
|
+
await (0, common_1.nextTick)();
|
|
63
|
+
for (const monitor of HARDWARE_MONITORS) {
|
|
64
|
+
const result = await monitorFans(monitor.namespace, monitor.source);
|
|
65
|
+
if (result.length) {
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return win32Fans();
|
|
70
|
+
};
|
|
71
|
+
exports.fans = fans;
|
package/dist/windows/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { cpu } from './cpu';
|
|
|
19
19
|
export { cpuCache } from './cpu-cache';
|
|
20
20
|
export { cpuFlags } from './cpu-flags';
|
|
21
21
|
export { cpuTemperature } from './cpu-temperature';
|
|
22
|
+
export { fans } from './fans';
|
|
22
23
|
export { diskLayout } from './disk-layout';
|
|
23
24
|
export { disksIO } from './disks-io';
|
|
24
25
|
export { displays } from './displays';
|
package/dist/windows/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.uuid = exports.users = exports.usb = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processes = void 0;
|
|
3
|
+
exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.gpu = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.displays = exports.disksIO = exports.diskLayout = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.uuid = exports.users = exports.usb = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processes = exports.processLoad = void 0;
|
|
5
5
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
6
6
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
7
7
|
var cpu_current_speed_1 = require("../cpu-current-speed");
|
|
@@ -50,6 +50,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
50
50
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
51
51
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
52
52
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
53
|
+
var fans_1 = require("./fans");
|
|
54
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
53
55
|
var disk_layout_1 = require("./disk-layout");
|
|
54
56
|
Object.defineProperty(exports, "diskLayout", { enumerable: true, get: function () { return disk_layout_1.diskLayout; } });
|
|
55
57
|
var disks_io_1 = require("./disks-io");
|
|
@@ -149,8 +149,8 @@ const getWindowsWiredProfilesInformation = async () => {
|
|
|
149
149
|
};
|
|
150
150
|
const getWindowsWirelessIfaceSSID = async (interfaceName) => {
|
|
151
151
|
try {
|
|
152
|
-
const { stdout } = await (0, exec_1.
|
|
153
|
-
const SSID = stdout.split('\r\n')
|
|
152
|
+
const { stdout } = await (0, exec_1.execFile)('netsh', ['wlan', 'show', 'interface', `name=${(0, security_1.sanitizeString)(interfaceName)}`], const_1.execOptsWin);
|
|
153
|
+
const SSID = String(stdout).split('\r\n').find((l) => l.includes('SSID')) || '';
|
|
154
154
|
const parseSSID = (SSID.split(':').pop() || '').trim();
|
|
155
155
|
return parseSSID;
|
|
156
156
|
}
|
|
@@ -197,11 +197,10 @@ const getWindowsIEEE8021x = async (connectionType, iface, interfaces) => {
|
|
|
197
197
|
let i8021xState = '';
|
|
198
198
|
let i8021xProtocol = '';
|
|
199
199
|
try {
|
|
200
|
-
const SSID = await getWindowsWirelessIfaceSSID(
|
|
200
|
+
const SSID = await getWindowsWirelessIfaceSSID(iface);
|
|
201
201
|
if (SSID !== 'Unknown') {
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
const profiles = stdout.split('\r\n');
|
|
202
|
+
const { stdout } = await (0, exec_1.execFile)('netsh', ['wlan', 'show', 'profiles', (0, security_1.sanitizeString)(SSID)], const_1.execOptsWin);
|
|
203
|
+
const profiles = String(stdout).split('\r\n');
|
|
205
204
|
i8021xState = (profiles.find((l) => l.indexOf('802.1X') >= 0) || '').trim();
|
|
206
205
|
i8021xProtocol = (profiles.find((l) => l.indexOf('EAP') >= 0) || '').trim();
|
|
207
206
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.7",
|
|
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)",
|