systeminformation 6.0.0-beta.1 → 6.0.0-beta.10
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 +37 -7
- package/dist/bsd/network-stats.js +2 -2
- package/dist/common/defaults.d.ts +2 -1
- package/dist/common/defaults.js +17 -5
- package/dist/common/exec.js +1 -1
- package/dist/common/files.d.ts +9 -0
- package/dist/common/files.js +67 -3
- package/dist/common/filesys.d.ts +10 -0
- package/dist/common/filesys.js +41 -10
- package/dist/common/network.js +4 -4
- package/dist/common/nvidia.d.ts +1 -1
- package/dist/common/nvidia.js +4 -5
- package/dist/common/parse.d.ts +4 -6
- package/dist/common/parse.js +24 -69
- package/dist/common/security.d.ts +1 -0
- package/dist/common/security.js +3 -1
- package/dist/common/types.d.ts +29 -5
- package/dist/cpu-current-load.js +28 -6
- package/dist/cpu-current-speed.js +5 -3
- package/dist/darwin/disk-layout.js +10 -6
- package/dist/darwin/disks-io.js +3 -3
- package/dist/darwin/displays.js +3 -1
- package/dist/darwin/fans.d.ts +2 -0
- package/dist/darwin/fans.js +28 -0
- package/dist/darwin/index.d.ts +2 -0
- package/dist/darwin/index.js +6 -2
- package/dist/darwin/network-interfaces.js +5 -10
- package/dist/darwin/network-stats.js +5 -5
- package/dist/darwin/serial-ports.d.ts +2 -0
- package/dist/darwin/serial-ports.js +94 -0
- package/dist/fans.d.ts +1 -0
- package/dist/fans.js +17 -0
- package/dist/get-data.d.ts +4 -0
- package/dist/get-data.js +6 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/dist/linux/audio.js +59 -0
- package/dist/linux/baseboard.js +9 -20
- package/dist/linux/bios.js +6 -15
- package/dist/linux/camera.js +2 -1
- package/dist/linux/chassis.js +4 -10
- package/dist/linux/cpu-temperature.js +34 -19
- package/dist/linux/cpu.js +3 -1
- package/dist/linux/disk-layout.js +7 -10
- package/dist/linux/disks-io.js +9 -9
- package/dist/linux/displays.js +6 -1
- package/dist/linux/fans.d.ts +2 -0
- package/dist/linux/fans.js +92 -0
- package/dist/linux/fs-size.js +160 -34
- package/dist/linux/fs-stats.js +6 -9
- package/dist/linux/gpu.js +15 -15
- package/dist/linux/index.d.ts +2 -0
- package/dist/linux/index.js +6 -2
- package/dist/linux/mem-layout.js +2 -2
- package/dist/linux/network-interfaces.js +36 -39
- package/dist/linux/network-stats.js +8 -36
- package/dist/linux/npu.js +2 -1
- package/dist/linux/os-info.js +19 -4
- package/dist/linux/printer.js +4 -4
- package/dist/linux/process-load.js +9 -12
- package/dist/linux/processes.js +89 -80
- package/dist/linux/serial-ports.d.ts +2 -0
- package/dist/linux/serial-ports.js +102 -0
- package/dist/linux/services.js +179 -47
- package/dist/linux/system.js +1 -7
- package/dist/linux/uuid.js +4 -10
- package/dist/serial-ports.d.ts +1 -0
- package/dist/serial-ports.js +17 -0
- package/dist/versions.js +32 -77
- package/dist/windows/disk-layout.js +3 -0
- package/dist/windows/disks-io.js +3 -3
- package/dist/windows/displays.js +29 -12
- package/dist/windows/fans.d.ts +2 -0
- package/dist/windows/fans.js +71 -0
- package/dist/windows/index.d.ts +2 -0
- package/dist/windows/index.js +6 -2
- package/dist/windows/network-interfaces.js +20 -29
- package/dist/windows/network-stats.js +4 -2
- package/dist/windows/process-load.js +7 -5
- package/dist/windows/processes.js +17 -11
- package/dist/windows/serial-ports.d.ts +3 -0
- package/dist/windows/serial-ports.js +73 -0
- package/dist/windows/services.js +3 -0
- package/package.json +1 -1
package/dist/get-data.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const getStaticData: () => Promise<{
|
|
|
16
16
|
audio: import("./common/types").AudioData[] | null;
|
|
17
17
|
bluetooth: import("./common/types").BluetoothObject[] | null;
|
|
18
18
|
usb: import("./common/types").UsbData[] | null;
|
|
19
|
+
serialPorts: import("./common/types").SerialPortData[] | null;
|
|
19
20
|
printer: import("./common/types").PrinterData[] | null;
|
|
20
21
|
camera: import("./common/types").Camera[] | null;
|
|
21
22
|
keyboard: import("./common/types").Keyboard[] | null;
|
|
@@ -40,6 +41,7 @@ export declare const getDynamicData: (srv?: string, iface?: string) => Promise<{
|
|
|
40
41
|
processes: import("./common/types").ProcessesData | null;
|
|
41
42
|
currentLoad: import("./common/types").CurrentLoadData;
|
|
42
43
|
temp: any;
|
|
44
|
+
fans: import("./common/types").FanData[] | null;
|
|
43
45
|
networkStats: import("./common/types").NetworkStatsData[] | null;
|
|
44
46
|
networkConnections: import("./common/types").NetworkConnectionsData[] | null;
|
|
45
47
|
mem: any;
|
|
@@ -68,6 +70,7 @@ export declare const getAllData: (srv?: string, iface?: string) => Promise<{
|
|
|
68
70
|
processes: import("./common/types").ProcessesData | null;
|
|
69
71
|
currentLoad: import("./common/types").CurrentLoadData;
|
|
70
72
|
temp: any;
|
|
73
|
+
fans: import("./common/types").FanData[] | null;
|
|
71
74
|
networkStats: import("./common/types").NetworkStatsData[] | null;
|
|
72
75
|
networkConnections: import("./common/types").NetworkConnectionsData[] | null;
|
|
73
76
|
mem: any;
|
|
@@ -98,6 +101,7 @@ export declare const getAllData: (srv?: string, iface?: string) => Promise<{
|
|
|
98
101
|
audio: import("./common/types").AudioData[] | null;
|
|
99
102
|
bluetooth: import("./common/types").BluetoothObject[] | null;
|
|
100
103
|
usb: import("./common/types").UsbData[] | null;
|
|
104
|
+
serialPorts: import("./common/types").SerialPortData[] | null;
|
|
101
105
|
printer: import("./common/types").PrinterData[] | null;
|
|
102
106
|
camera: import("./common/types").Camera[] | null;
|
|
103
107
|
keyboard: import("./common/types").Keyboard[] | null;
|
package/dist/get-data.js
CHANGED
|
@@ -38,7 +38,7 @@ const common_1 = require("./common");
|
|
|
38
38
|
const si = __importStar(require("./index"));
|
|
39
39
|
const getStaticData = async () => {
|
|
40
40
|
await (0, common_1.nextTick)();
|
|
41
|
-
const [version, system, bios, baseboard, chassis, os, uuid, versions, cpu, cpuFlags, gpu, displays, net, memLayout, diskLayout, audio, bluetooth, usb, printer, camera, keyboard, mouse, pci, thunderbolt, npu, wifiInterfaces, software] = await Promise.all([
|
|
41
|
+
const [version, system, bios, baseboard, chassis, os, uuid, versions, cpu, cpuFlags, gpu, displays, net, memLayout, diskLayout, audio, bluetooth, usb, serialPorts, printer, camera, keyboard, mouse, pci, thunderbolt, npu, wifiInterfaces, software] = await Promise.all([
|
|
42
42
|
si.version(),
|
|
43
43
|
si.system(),
|
|
44
44
|
si.bios(),
|
|
@@ -57,6 +57,7 @@ const getStaticData = async () => {
|
|
|
57
57
|
si.audio(),
|
|
58
58
|
si.bluetoothDevices(),
|
|
59
59
|
si.usb(),
|
|
60
|
+
si.serialPorts(),
|
|
60
61
|
si.printer(),
|
|
61
62
|
si.camera(),
|
|
62
63
|
si.keyboard(),
|
|
@@ -85,6 +86,7 @@ const getStaticData = async () => {
|
|
|
85
86
|
audio,
|
|
86
87
|
bluetooth,
|
|
87
88
|
usb,
|
|
89
|
+
serialPorts,
|
|
88
90
|
printer,
|
|
89
91
|
camera,
|
|
90
92
|
keyboard,
|
|
@@ -99,13 +101,14 @@ const getStaticData = async () => {
|
|
|
99
101
|
exports.getStaticData = getStaticData;
|
|
100
102
|
const getDynamicData = async (srv = '', iface = '') => {
|
|
101
103
|
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([
|
|
104
|
+
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
105
|
si.time(),
|
|
104
106
|
si.cpuCurrentSpeed(),
|
|
105
107
|
si.users(),
|
|
106
108
|
si.processes(),
|
|
107
109
|
si.currentLoad(),
|
|
108
110
|
si.cpuTemperature(),
|
|
111
|
+
si.fans(),
|
|
109
112
|
(async () => si.networkStats(iface || (await si.networkInterfaceDefault()) || '*'))(),
|
|
110
113
|
si.networkConnections(),
|
|
111
114
|
si.mem(),
|
|
@@ -129,6 +132,7 @@ const getDynamicData = async (srv = '', iface = '') => {
|
|
|
129
132
|
processes,
|
|
130
133
|
currentLoad,
|
|
131
134
|
temp,
|
|
135
|
+
fans,
|
|
132
136
|
networkStats,
|
|
133
137
|
networkConnections,
|
|
134
138
|
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';
|
|
@@ -43,6 +44,7 @@ export { pci } from './pci';
|
|
|
43
44
|
export { printer } from './printer';
|
|
44
45
|
export { processes } from './processes';
|
|
45
46
|
export { processLoad } from './process-load';
|
|
47
|
+
export { serialPorts } from './serial-ports';
|
|
46
48
|
export { services } from './services';
|
|
47
49
|
export { shell } from './shell';
|
|
48
50
|
export { software } from './software';
|
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.serialPorts = 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");
|
|
@@ -100,6 +102,8 @@ var processes_1 = require("./processes");
|
|
|
100
102
|
Object.defineProperty(exports, "processes", { enumerable: true, get: function () { return processes_1.processes; } });
|
|
101
103
|
var process_load_1 = require("./process-load");
|
|
102
104
|
Object.defineProperty(exports, "processLoad", { enumerable: true, get: function () { return process_load_1.processLoad; } });
|
|
105
|
+
var serial_ports_1 = require("./serial-ports");
|
|
106
|
+
Object.defineProperty(exports, "serialPorts", { enumerable: true, get: function () { return serial_ports_1.serialPorts; } });
|
|
103
107
|
var services_1 = require("./services");
|
|
104
108
|
Object.defineProperty(exports, "services", { enumerable: true, get: function () { return services_1.services; } });
|
|
105
109
|
var shell_1 = require("./shell");
|
package/dist/linux/audio.js
CHANGED
|
@@ -4,8 +4,11 @@ exports.audio = void 0;
|
|
|
4
4
|
const node_os_1 = require("node:os");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
const const_1 = require("../common/const");
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
7
8
|
const exec_1 = require("../common/exec");
|
|
9
|
+
const files_1 = require("../common/files");
|
|
8
10
|
const mappings_1 = require("../common/mappings");
|
|
11
|
+
const security_1 = require("../common/security");
|
|
9
12
|
const getAudioPci = async () => {
|
|
10
13
|
const result = [];
|
|
11
14
|
try {
|
|
@@ -46,6 +49,59 @@ const parseAudioPci = (lines, audioPCI) => {
|
|
|
46
49
|
status: 'online'
|
|
47
50
|
};
|
|
48
51
|
};
|
|
52
|
+
const parseAudioAlsa = (stdout) => {
|
|
53
|
+
const result = [];
|
|
54
|
+
const [cards, pcms] = `${stdout}`.split('--pcm--');
|
|
55
|
+
const lines = (cards || '').split('\n');
|
|
56
|
+
lines.forEach((line, i) => {
|
|
57
|
+
const card = line.match(/^\s*(\d+)\s+\[(.+?)\s*\]:\s*(.*)$/);
|
|
58
|
+
if (card && card[3].trim()) {
|
|
59
|
+
const index = card[1];
|
|
60
|
+
const sep = card[3].lastIndexOf(' - ');
|
|
61
|
+
const name = (sep >= 0 ? card[3].substring(sep + 3) : card[3]).trim();
|
|
62
|
+
let driver = (sep >= 0 ? card[3].substring(0, sep) : '').trim();
|
|
63
|
+
if (name && driver.endsWith(name)) {
|
|
64
|
+
driver = driver.substring(0, driver.length - name.length).trim();
|
|
65
|
+
}
|
|
66
|
+
const longName = (lines[i + 1] || '').trim();
|
|
67
|
+
const manufacturer = longName.indexOf(name) > 0 ? longName.substring(0, longName.indexOf(name)).trim() : '';
|
|
68
|
+
const devices = (pcms || '').split('\n').filter((pcm) => pcm.indexOf(`/card${index}/pcm`) >= 0);
|
|
69
|
+
const out = devices.some((pcm) => pcm.trim().endsWith('p'));
|
|
70
|
+
const isIn = devices.some((pcm) => pcm.trim().endsWith('c'));
|
|
71
|
+
const usb = `${driver} ${longName}`.toLowerCase().indexOf('usb') >= 0;
|
|
72
|
+
const hdmi = `${card[2]} ${name}`.toLowerCase().indexOf('hdmi') >= 0;
|
|
73
|
+
result.push({
|
|
74
|
+
id: `hw:${index}`,
|
|
75
|
+
name,
|
|
76
|
+
manufacturer,
|
|
77
|
+
revision: null,
|
|
78
|
+
driver,
|
|
79
|
+
default: null,
|
|
80
|
+
channel: usb ? 'USB' : hdmi ? 'HDMI' : 'Onboard',
|
|
81
|
+
type: (0, mappings_1.audioTypeLabel)(name, isIn, out),
|
|
82
|
+
in: devices.length ? isIn : null,
|
|
83
|
+
out: devices.length ? out : null,
|
|
84
|
+
status: 'online'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return result;
|
|
89
|
+
};
|
|
90
|
+
const getAudioAlsa = async () => {
|
|
91
|
+
try {
|
|
92
|
+
const cards = await (0, files_1.readSysfs)('/proc/asound/cards');
|
|
93
|
+
const pcms = [];
|
|
94
|
+
for (const card of (await (0, promises_1.readdir)('/proc/asound')).filter((entry) => /^card\d+$/.test(entry)).sort()) {
|
|
95
|
+
for (const pcm of (await (0, promises_1.readdir)(`/proc/asound/${card}`)).filter((entry) => entry.startsWith('pcm') && (0, security_1.isSafePathSegment)(entry)).sort()) {
|
|
96
|
+
pcms.push(`/proc/asound/${card}/${pcm}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return parseAudioAlsa(`${cards}\n--pcm--\n${pcms.join('\n')}\n`);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
};
|
|
49
105
|
const audio = async () => {
|
|
50
106
|
await (0, common_1.nextTick)();
|
|
51
107
|
const result = [];
|
|
@@ -62,6 +118,9 @@ const audio = async () => {
|
|
|
62
118
|
});
|
|
63
119
|
}
|
|
64
120
|
catch { }
|
|
121
|
+
if (!result.length) {
|
|
122
|
+
return await getAudioAlsa();
|
|
123
|
+
}
|
|
65
124
|
return result;
|
|
66
125
|
};
|
|
67
126
|
exports.audio = audio;
|
package/dist/linux/baseboard.js
CHANGED
|
@@ -7,36 +7,25 @@ const common_1 = require("../common");
|
|
|
7
7
|
const const_1 = require("../common/const");
|
|
8
8
|
const defaults_1 = require("../common/defaults");
|
|
9
9
|
const exec_1 = require("../common/exec");
|
|
10
|
+
const files_1 = require("../common/files");
|
|
10
11
|
const parse_1 = require("../common/parse");
|
|
11
12
|
const raspberry_1 = require("../common/raspberry");
|
|
12
13
|
const baseboard = async () => {
|
|
13
14
|
await (0, common_1.nextTick)();
|
|
14
15
|
const defaults = (0, common_1.cloneObj)(defaults_1.initBaseboard);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
const workload = [];
|
|
23
|
-
workload.push((0, exec_1.exec)(cmd, const_1.execOptsLinux));
|
|
24
|
-
workload.push((0, exec_1.exec)('export LC_ALL=C; dmidecode -t memory 2>/dev/null', const_1.execOptsLinux));
|
|
25
|
-
const data = await Promise.allSettled(workload).then((results) => results.map((result) => (result.status === 'fulfilled' ? result.value : null)));
|
|
26
|
-
let lines = data[0] ? data[0].stdout.split('\n') : [''];
|
|
16
|
+
const boardTask = process.arch === 'arm'
|
|
17
|
+
? (0, files_1.readFileLines)('/proc/cpuinfo').then((cpuinfo) => cpuinfo.filter((line) => line.indexOf('Serial') >= 0))
|
|
18
|
+
: (0, exec_1.execSave)('export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL', const_1.execOptsLinux).then((res) => res.stdout.split('\n'));
|
|
19
|
+
const memTask = (0, exec_1.execSave)('export LC_ALL=C; dmidecode -t memory 2>/dev/null', const_1.execOptsLinux).then((res) => res.stdout.split('\n'));
|
|
20
|
+
const [boardLines, memLines] = await Promise.all([boardTask, memTask]);
|
|
21
|
+
let lines = boardLines;
|
|
27
22
|
let manufacturer = (0, common_1.getValue)(lines, 'Manufacturer');
|
|
28
23
|
let model = (0, common_1.getValue)(lines, 'Product Name');
|
|
29
24
|
let version = (0, common_1.getValue)(lines, 'Version');
|
|
30
25
|
let serial = (0, common_1.getValue)(lines, 'Serial Number');
|
|
31
26
|
let assetTag = (0, common_1.getValue)(lines, 'Asset Tag');
|
|
32
|
-
cmd = `echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo;
|
|
33
|
-
echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo;
|
|
34
|
-
echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo;
|
|
35
|
-
echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo;
|
|
36
|
-
echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`;
|
|
37
27
|
try {
|
|
38
|
-
|
|
39
|
-
lines = stdout.split('\n');
|
|
28
|
+
lines = await (0, files_1.readSysfsMany)(files_1.DMI_PATH, ['board_asset_tag', 'board_name', 'board_serial', 'board_vendor', 'board_version']);
|
|
40
29
|
manufacturer = !manufacturer ? (0, common_1.getValue)(lines, 'board_vendor') : manufacturer;
|
|
41
30
|
model = !model ? (0, common_1.getValue)(lines, 'board_name') : model;
|
|
42
31
|
version = !version ? (0, common_1.getValue)(lines, 'board_version') : version;
|
|
@@ -49,7 +38,7 @@ const baseboard = async () => {
|
|
|
49
38
|
model = (0, parse_1.cleanDefaults)(model);
|
|
50
39
|
version = (0, parse_1.cleanDefaults)(version);
|
|
51
40
|
manufacturer = (0, parse_1.cleanDefaults)(manufacturer);
|
|
52
|
-
lines =
|
|
41
|
+
lines = memLines;
|
|
53
42
|
let memMax = (0, common_1.toInt)((0, common_1.getValue)(lines, 'Maximum Capacity')) * 1024 * 1024 * 1024 || null;
|
|
54
43
|
let memSlots = (0, common_1.toInt)((0, common_1.getValue)(lines, 'Number Of Devices')) || null;
|
|
55
44
|
let linesRpi = [];
|
package/dist/linux/bios.js
CHANGED
|
@@ -5,19 +5,14 @@ const common_1 = require("../common");
|
|
|
5
5
|
const defaults_1 = require("../common/defaults");
|
|
6
6
|
const datetime_1 = require("../common/datetime");
|
|
7
7
|
const exec_1 = require("../common/exec");
|
|
8
|
+
const files_1 = require("../common/files");
|
|
8
9
|
const const_1 = require("../common/const");
|
|
9
10
|
const bios = async () => {
|
|
10
11
|
await (0, common_1.nextTick)();
|
|
11
12
|
const result = (0, common_1.cloneObj)(defaults_1.initBios);
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
cmd = 'export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL';
|
|
18
|
-
}
|
|
19
|
-
const { stdout } = await (0, exec_1.exec)(cmd, const_1.execOptsLinux);
|
|
20
|
-
let lines = stdout.toString().split('\n');
|
|
13
|
+
let lines = process.arch === 'arm'
|
|
14
|
+
? (await (0, files_1.readFileLines)('/proc/cpuinfo')).filter((line) => line.indexOf('Serial') >= 0)
|
|
15
|
+
: (await (0, exec_1.execSave)('export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL', const_1.execOptsLinux)).stdout.split('\n');
|
|
21
16
|
result.vendor = (0, common_1.getValue)(lines, 'Vendor');
|
|
22
17
|
result.version = (0, common_1.getValue)(lines, 'Version');
|
|
23
18
|
let datetime = (0, common_1.getValue)(lines, 'Release Date');
|
|
@@ -28,7 +23,7 @@ const bios = async () => {
|
|
|
28
23
|
if (language) {
|
|
29
24
|
result.language = language;
|
|
30
25
|
}
|
|
31
|
-
if (lines.
|
|
26
|
+
if (lines.some((line) => line.indexOf('Characteristics:') >= 0)) {
|
|
32
27
|
const features = [];
|
|
33
28
|
lines.forEach((line) => {
|
|
34
29
|
if (line.indexOf(' is supported') >= 0) {
|
|
@@ -38,12 +33,8 @@ const bios = async () => {
|
|
|
38
33
|
});
|
|
39
34
|
result.features = features;
|
|
40
35
|
}
|
|
41
|
-
cmd = `echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo;
|
|
42
|
-
echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo;
|
|
43
|
-
echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`;
|
|
44
36
|
try {
|
|
45
|
-
|
|
46
|
-
lines = stdout.split('\n');
|
|
37
|
+
lines = await (0, files_1.readSysfsMany)(files_1.DMI_PATH, ['bios_date', 'bios_vendor', 'bios_version']);
|
|
47
38
|
result.vendor = !result.vendor ? (0, common_1.getValue)(lines, 'bios_vendor') : result.vendor;
|
|
48
39
|
result.version = !result.version ? (0, common_1.getValue)(lines, 'bios_version') : result.version;
|
|
49
40
|
datetime = (0, common_1.getValue)(lines, 'bios_date');
|
package/dist/linux/camera.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.camera = void 0;
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
|
+
const security_1 = require("../common/security");
|
|
6
7
|
const V4L_PATH = '/sys/class/video4linux';
|
|
7
8
|
const readAttr = async (path) => {
|
|
8
9
|
try {
|
|
@@ -17,7 +18,7 @@ const camera = async () => {
|
|
|
17
18
|
const result = [];
|
|
18
19
|
const seen = new Set();
|
|
19
20
|
try {
|
|
20
|
-
const nodes = (await (0, promises_1.readdir)(V4L_PATH)).filter((node) => node.startsWith('video')).sort();
|
|
21
|
+
const nodes = (await (0, promises_1.readdir)(V4L_PATH)).filter((node) => node.startsWith('video') && (0, security_1.isSafePathSegment)(node)).sort();
|
|
21
22
|
for (const node of nodes) {
|
|
22
23
|
const base = `${V4L_PATH}/${node}`;
|
|
23
24
|
const name = await readAttr(`${base}/name`);
|
package/dist/linux/chassis.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.chassis = void 0;
|
|
4
4
|
const common_1 = require("../common");
|
|
5
|
-
const
|
|
5
|
+
const files_1 = require("../common/files");
|
|
6
6
|
const defaults_1 = require("../common/defaults");
|
|
7
7
|
const mappings_1 = require("../common/mappings");
|
|
8
8
|
const parse_1 = require("../common/parse");
|
|
9
|
-
const parseChassis = (
|
|
10
|
-
const lines = stdout.toString().split('\n');
|
|
9
|
+
const parseChassis = (lines, defaults) => {
|
|
11
10
|
const manufacturer = (0, parse_1.cleanDefaults)((0, common_1.getValue)(lines, 'chassis_vendor'));
|
|
12
11
|
const ctype = parseInt((0, common_1.getValue)(lines, 'chassis_type').replace(/\D/g, ''));
|
|
13
12
|
const chassisType = ctype && !isNaN(ctype) && ctype <= mappings_1.chassisTypes.length ? mappings_1.chassisTypes[ctype - 1] : '';
|
|
@@ -26,14 +25,9 @@ const parseChassis = (stdout, defaults) => {
|
|
|
26
25
|
const chassis = async () => {
|
|
27
26
|
await (0, common_1.nextTick)();
|
|
28
27
|
const defaults = (0, common_1.cloneObj)(defaults_1.initChassis);
|
|
29
|
-
const cmd = `echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;
|
|
30
|
-
echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;
|
|
31
|
-
echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;
|
|
32
|
-
echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo;
|
|
33
|
-
echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;`;
|
|
34
28
|
try {
|
|
35
|
-
const
|
|
36
|
-
return parseChassis(
|
|
29
|
+
const lines = await (0, files_1.readSysfsMany)(files_1.DMI_PATH, ['chassis_asset_tag', 'chassis_serial', 'chassis_type', 'chassis_vendor', 'chassis_version']);
|
|
30
|
+
return parseChassis(lines, defaults);
|
|
37
31
|
}
|
|
38
32
|
catch { }
|
|
39
33
|
return defaults;
|
|
@@ -7,35 +7,50 @@ const common_1 = require("../common");
|
|
|
7
7
|
const defaults_1 = require("../common/defaults");
|
|
8
8
|
const exec_1 = require("../common/exec");
|
|
9
9
|
const files_1 = require("../common/files");
|
|
10
|
+
const security_1 = require("../common/security");
|
|
11
|
+
const readHwmonTemps = async () => {
|
|
12
|
+
const entries = [];
|
|
13
|
+
let mons = [];
|
|
14
|
+
try {
|
|
15
|
+
mons = (await (0, promises_1.readdir)('/sys/class/hwmon')).filter(security_1.isSafePathSegment).sort();
|
|
16
|
+
}
|
|
17
|
+
catch { }
|
|
18
|
+
for (const mon of mons) {
|
|
19
|
+
const dir = `/sys/class/hwmon/${mon}`;
|
|
20
|
+
let labels = [];
|
|
21
|
+
try {
|
|
22
|
+
labels = (await (0, promises_1.readdir)(dir)).filter((file) => /^temp\d+_label$/.test(file)).sort();
|
|
23
|
+
}
|
|
24
|
+
catch { }
|
|
25
|
+
for (const label of labels) {
|
|
26
|
+
const [name, value] = await Promise.all([(0, files_1.readSysfs)(`${dir}/${label}`), (0, files_1.readSysfs)(`${dir}/${label.replace(/_label$/, '_input')}`)]);
|
|
27
|
+
entries.push(`${name}___${value}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return entries;
|
|
31
|
+
};
|
|
10
32
|
const cpuTemperature = async () => {
|
|
11
33
|
await (0, common_1.nextTick)();
|
|
12
34
|
const result = (0, common_1.cloneObj)(defaults_1.initCpuTemperature);
|
|
13
35
|
let cpuThermal = null;
|
|
14
36
|
try {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (line.startsWith('pch') && lines2[i]) {
|
|
27
|
-
result.chipset = Math.round(Number.parseInt(lines2[i], 10) / 100) / 10;
|
|
28
|
-
}
|
|
29
|
-
if (cpuThermal === null && line.indexOf('cpu') !== -1 && lines2[i]) {
|
|
30
|
-
cpuThermal = Math.round(parseInt(lines2[i], 10) / 100) / 10;
|
|
31
|
-
}
|
|
37
|
+
const zones = (await (0, promises_1.readdir)('/sys/class/thermal')).filter((zone) => zone.startsWith('thermal_zone') && (0, security_1.isSafePathSegment)(zone)).sort();
|
|
38
|
+
for (const zone of zones) {
|
|
39
|
+
const [line, temp] = await Promise.all([(0, files_1.readSysfs)(`/sys/class/thermal/${zone}/type`), (0, files_1.readSysfs)(`/sys/class/thermal/${zone}/temp`)]);
|
|
40
|
+
if (line.startsWith('acpi') && temp) {
|
|
41
|
+
result.socket.push(Math.round(Number.parseInt(temp, 10) / 100) / 10);
|
|
42
|
+
}
|
|
43
|
+
if (line.startsWith('pch') && temp) {
|
|
44
|
+
result.chipset = Math.round(Number.parseInt(temp, 10) / 100) / 10;
|
|
45
|
+
}
|
|
46
|
+
if (cpuThermal === null && line.indexOf('cpu') !== -1 && temp) {
|
|
47
|
+
cpuThermal = Math.round(parseInt(temp, 10) / 100) / 10;
|
|
32
48
|
}
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
51
|
catch { }
|
|
36
|
-
const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
|
|
37
52
|
try {
|
|
38
|
-
let
|
|
53
|
+
let stdout = (await readHwmonTemps()).join('\n');
|
|
39
54
|
const tdiePos = stdout.toLowerCase().indexOf('tdie');
|
|
40
55
|
if (tdiePos !== -1) {
|
|
41
56
|
stdout = stdout.substring(tdiePos);
|
package/dist/linux/cpu.js
CHANGED
|
@@ -8,6 +8,7 @@ const const_1 = require("../common/const");
|
|
|
8
8
|
const cpu_1 = require("../common/cpu");
|
|
9
9
|
const defaults_1 = require("../common/defaults");
|
|
10
10
|
const exec_1 = require("../common/exec");
|
|
11
|
+
const files_1 = require("../common/files");
|
|
11
12
|
const mappings_1 = require("../common/mappings");
|
|
12
13
|
const parse_1 = require("../common/parse");
|
|
13
14
|
const raspberry_1 = require("./../common/raspberry");
|
|
@@ -25,8 +26,9 @@ const cpu = async () => {
|
|
|
25
26
|
if ((0, node_os_1.cpus)()[0] && (0, node_os_1.cpus)()[0].model) {
|
|
26
27
|
modelline = (0, node_os_1.cpus)()[0].model;
|
|
27
28
|
}
|
|
28
|
-
let { stdout } = await (0, exec_1.exec)('export LC_ALL=C; lscpu;
|
|
29
|
+
let { stdout } = await (0, exec_1.exec)('export LC_ALL=C; lscpu; unset LC_ALL', const_1.execOptsLinux);
|
|
29
30
|
let lines = stdout.toString().split('\n');
|
|
31
|
+
lines.push(`Governor: ${await (0, files_1.readSysfs)('/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor')}`);
|
|
30
32
|
modelline = (0, common_1.getValue)(lines, 'model name') || modelline;
|
|
31
33
|
modelline = (0, common_1.getValue)(lines, 'bios model name') || modelline;
|
|
32
34
|
modelline = (0, common_1.cleanString)(modelline);
|
|
@@ -4,9 +4,11 @@ exports.diskLayout = void 0;
|
|
|
4
4
|
const common_1 = require("../common");
|
|
5
5
|
const const_1 = require("../common/const");
|
|
6
6
|
const exec_1 = require("../common/exec");
|
|
7
|
+
const files_1 = require("../common/files");
|
|
7
8
|
const filesys_1 = require("../common/filesys");
|
|
8
9
|
const mappings_1 = require("../common/mappings");
|
|
9
10
|
const security_1 = require("../common/security");
|
|
11
|
+
const virtualBlockDevice = /^(ram|zram|loop|dm-|nbd|fd)\d*$/;
|
|
10
12
|
const diskLayout = async () => {
|
|
11
13
|
await (0, common_1.nextTick)();
|
|
12
14
|
const result = [];
|
|
@@ -29,10 +31,7 @@ const diskLayout = async () => {
|
|
|
29
31
|
item.fstype === null &&
|
|
30
32
|
item.parttype === null &&
|
|
31
33
|
item.path &&
|
|
32
|
-
item.path.
|
|
33
|
-
item.path.indexOf('/loop') !== 0 &&
|
|
34
|
-
item['disc-max'] &&
|
|
35
|
-
item['disc-max'] !== 0)));
|
|
34
|
+
!virtualBlockDevice.test(item.name || item.path.replace('/dev/', '')))));
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
}
|
|
@@ -42,7 +41,9 @@ const diskLayout = async () => {
|
|
|
42
41
|
const lines = (0, filesys_1.blkStdoutToObject)(stdout).split('\n');
|
|
43
42
|
const data = (0, filesys_1.parseLinuxBlk)(lines);
|
|
44
43
|
devices = data.filter((item) => {
|
|
45
|
-
return item.type === 'disk' &&
|
|
44
|
+
return (item.type === 'disk' &&
|
|
45
|
+
item.size > 0 &&
|
|
46
|
+
((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '' && !virtualBlockDevice.test(item.name || ''))));
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
catch { }
|
|
@@ -51,11 +52,7 @@ const diskLayout = async () => {
|
|
|
51
52
|
let mediumType = '';
|
|
52
53
|
const logical = (0, security_1.sanitizeShellString)(device.name || '', true);
|
|
53
54
|
const bsdName = '/dev/' + logical;
|
|
54
|
-
|
|
55
|
-
({ stdout } = await (0, exec_1.exec)('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null', const_1.execOptsLinux));
|
|
56
|
-
mediumType = stdout.split('\n')[0];
|
|
57
|
-
}
|
|
58
|
-
catch { }
|
|
55
|
+
mediumType = (0, security_1.isSafePathSegment)(logical) ? await (0, files_1.readSysfs)(`/sys/block/${logical}/queue/rotational`) : '';
|
|
59
56
|
let interfaceType = device.tran ? device.tran.toUpperCase().trim() : '';
|
|
60
57
|
if (interfaceType === 'NVME') {
|
|
61
58
|
mediumType = '2';
|
package/dist/linux/disks-io.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.disksIO = void 0;
|
|
4
4
|
const defaults_1 = require("../common/defaults");
|
|
5
5
|
const index_1 = require("../common/index");
|
|
6
|
-
const exec_1 = require("../common/exec");
|
|
7
6
|
const common_1 = require("../common");
|
|
8
7
|
const filesys_1 = require("../common/filesys");
|
|
9
|
-
const
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const files_1 = require("../common/files");
|
|
10
|
+
const security_1 = require("../common/security");
|
|
10
11
|
const disksIO = async () => {
|
|
11
12
|
await (0, common_1.nextTick)();
|
|
12
13
|
if ((filesys_1._disk_io && !filesys_1._disk_io.ms) || (filesys_1._disk_io && filesys_1._disk_io.ms && Date.now() - filesys_1._disk_io.ms >= 500)) {
|
|
@@ -17,14 +18,13 @@ const disksIO = async () => {
|
|
|
17
18
|
let wWaitTime = 0;
|
|
18
19
|
let tWaitTime = 0;
|
|
19
20
|
try {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const lines = stdout.split('\n');
|
|
21
|
+
const disks = (await (0, promises_1.readdir)('/sys/block')).filter((dev) => !/^(loop|ram|dm-|md|sr|fd|nbd)/.test(dev) && (0, security_1.isSafePathSegment)(dev));
|
|
22
|
+
const lines = await Promise.all(disks.map((dev) => (0, files_1.readSysfs)(`/sys/block/${dev}/stat`)));
|
|
23
23
|
lines.forEach(function (line) {
|
|
24
24
|
if (!line) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const stats = line.split(
|
|
27
|
+
const stats = line.trim().split(/\s+/);
|
|
28
28
|
rIO += (0, common_1.toInt)(stats[0]);
|
|
29
29
|
wIO += (0, common_1.toInt)(stats[4]);
|
|
30
30
|
rWaitTime += (0, common_1.toInt)(stats[3]);
|
|
@@ -46,9 +46,9 @@ const disksIO = async () => {
|
|
|
46
46
|
rIO_sec: filesys_1._disk_io.rIO_sec,
|
|
47
47
|
wIO_sec: filesys_1._disk_io.wIO_sec,
|
|
48
48
|
tIO_sec: filesys_1._disk_io.tIO_sec,
|
|
49
|
-
rWaitTime: filesys_1._disk_io.
|
|
50
|
-
wWaitTime: filesys_1._disk_io.
|
|
51
|
-
tWaitTime: filesys_1._disk_io.
|
|
49
|
+
rWaitTime: filesys_1._disk_io.rWaitTimeDelta,
|
|
50
|
+
wWaitTime: filesys_1._disk_io.wWaitTimeDelta,
|
|
51
|
+
tWaitTime: filesys_1._disk_io.tWaitTimeDelta,
|
|
52
52
|
rWaitPercent: filesys_1._disk_io.rWaitPercent,
|
|
53
53
|
wWaitPercent: filesys_1._disk_io.wWaitPercent,
|
|
54
54
|
tWaitPercent: filesys_1._disk_io.tWaitPercent
|
package/dist/linux/displays.js
CHANGED
|
@@ -135,6 +135,9 @@ const parseLinesLinuxDisplays = (lines, depth) => {
|
|
|
135
135
|
currentDisplay.resolutionX !== null) {
|
|
136
136
|
displays.push(currentDisplay);
|
|
137
137
|
}
|
|
138
|
+
displays.forEach((display, i) => {
|
|
139
|
+
display.mirror = displays.some((other, j) => j !== i && other.positionX === display.positionX && other.positionY === display.positionY && other.currentResX === display.currentResX && other.currentResY === display.currentResY);
|
|
140
|
+
});
|
|
138
141
|
return displays;
|
|
139
142
|
};
|
|
140
143
|
const displays = async () => {
|
|
@@ -156,6 +159,7 @@ const displays = async () => {
|
|
|
156
159
|
deviceName: '',
|
|
157
160
|
displayId: null,
|
|
158
161
|
main: true,
|
|
162
|
+
mirror: false,
|
|
159
163
|
builtin: false,
|
|
160
164
|
connection: 'HDMI',
|
|
161
165
|
sizeX: null,
|
|
@@ -167,7 +171,8 @@ const displays = async () => {
|
|
|
167
171
|
currentResY: null,
|
|
168
172
|
positionX: 0,
|
|
169
173
|
positionY: 0,
|
|
170
|
-
currentRefreshRate: null
|
|
174
|
+
currentRefreshRate: null,
|
|
175
|
+
scale: null
|
|
171
176
|
});
|
|
172
177
|
}
|
|
173
178
|
}
|