This commit is contained in:
Sebastian Hildebrandt 2020-03-08 15:43:18 +01:00
commit 297371fb06
11 changed files with 126 additions and 11 deletions

View File

@ -30,6 +30,12 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 4.22.5 | 2020-03-04 | `graphics()` fixed vram macOS |
| 4.22.4 | 2020-03-01 | `versions()` added dotnet, typings fix |
| 4.22.3 | 2020-02-20 | `memLayout()` code cleanup |
| 4.22.2 | 2020-02-19 | `memLayout()` raspberry PI mem voltage fix |
| 4.22.1 | 2020-02-17 | `memLayout()` raspberry PI support |
| 4.22.0 | 2020-02-17 | `services()` added pids (windows) |
| 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) | | 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) |
| 4.21.2 | 2020-02-11 | `networkConnections()` fixed linux (debian) issue | | 4.21.2 | 2020-02-11 | `networkConnections()` fixed linux (debian) issue |
| 4.21.1 | 2020-01-31 | `networkGatewayDefault()` fixed windows 7 issue | | 4.21.1 | 2020-01-31 | `networkGatewayDefault()` fixed windows 7 issue |

View File

@ -30,7 +30,7 @@
[![Sponsoring][sponsor-badge]][sponsor-url] [![Sponsoring][sponsor-badge]][sponsor-url]
[![MIT license][license-img]][license-url] [![MIT license][license-img]][license-url]
This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 250 versions published, up to 1 mio downloads per month, > 5 mio downloads overall. Thank you to all who contributed to this project! This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 300 versions published, up to 1 mio downloads per month, > 6 mio downloads overall. Thank you to all who contributed to this project!
## New Version 4.0 ## New Version 4.0
@ -85,13 +85,13 @@ si.cpu()
(last 7 major and minor version releases) (last 7 major and minor version releases)
- Version 4.22.0: `services()` added pids (windows)
- Version 4.21.0: added npx copmpatibility - Version 4.21.0: added npx copmpatibility
- Version 4.20.0: `battery()` added designcapacity, voltage, unit - Version 4.20.0: `battery()` added designcapacity, voltage, unit
- Version 4.19.0: `osInfo()` added uefi (OS uses UEFI during startup) - Version 4.19.0: `osInfo()` added uefi (OS uses UEFI during startup)
- Version 4.18.0: `networkInterfaces()` added dhcp for mac os, added dhcp linux fallback - Version 4.18.0: `networkInterfaces()` added dhcp for mac os, added dhcp linux fallback
- Version 4.17.0: `networkInterfaces()` added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState - Version 4.17.0: `networkInterfaces()` added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState
- Version 4.16.0: `networkGatewayDefault()` added - Version 4.16.0: `networkGatewayDefault()` added
- Version 4.15.0: `cpu()` added governor (linux)
- ... - ...
You can find all changes here: [detailed changelog][changelog-url] You can find all changes here: [detailed changelog][changelog-url]
@ -355,7 +355,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
| | [0].name | X | X | X | X | | name of service | | | [0].name | X | X | X | X | | name of service |
| | [0].running | X | X | X | X | | true / false | | | [0].running | X | X | X | X | | true / false |
| | [0].startmode | | | | X | | manual, automatic, ... | | | [0].startmode | | | | X | | manual, automatic, ... |
| | [0].pids | X | X | X | | | pids | | | [0].pids | X | X | X | X | | pids |
| | [0].pcpu | X | X | X | | | process % CPU | | | [0].pcpu | X | X | X | | | process % CPU |
| | [0].pmem | X | X | X | | | process % MEM | | | [0].pmem | X | X | X | | | process % MEM |

View File

@ -83,6 +83,36 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">4.22.5</th>
<td>2020-03-04</td>
<td><span class="code">graphics()</span> fixed vram (macOS)</td>
</tr>
<tr>
<th scope="row">4.22.4</th>
<td>2020-03-01</td>
<td><span class="code">versions()</span> added dotnet, fix typings</td>
</tr>
<tr>
<th scope="row">4.22.3</th>
<td>2020-02-20</td>
<td><span class="code">memLayout()</span> code cleanup</td>
</tr>
<tr>
<th scope="row">4.22.2</th>
<td>2020-02-19</td>
<td><span class="code">memLayout()</span> raspberry PI mem voltage fix</td>
</tr>
<tr>
<th scope="row">4.22.1</th>
<td>2020-02-17</td>
<td><span class="code">memLayout()</span> raspberry PI support</td>
</tr>
<tr>
<th scope="row">4.22.0</th>
<td>2020-02-17</td>
<td><span class="code">services()</span> added pids (windows)</td>
</tr>
<tr> <tr>
<th scope="row">4.21.3</th> <th scope="row">4.21.3</th>
<td>2020-02-16</td> <td>2020-02-16</td>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png"> <img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div> <div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.21.3</span></div> <div class="version">Current Version: <span id="version">4.22.5</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button> <button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div> </div>
<div class="down"> <div class="down">
@ -207,7 +207,7 @@
<div class="title">Downloads last month</div> <div class="title">Downloads last month</div>
</div> </div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12"> <div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">248</div> <div class="numbers">250</div>
<div class="title">Dependends</div> <div class="title">Dependends</div>
</div> </div>
</div> </div>

View File

@ -133,10 +133,16 @@ function graphics(callback) {
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vendor') !== -1) currentController.vendor = parts[1].split('(')[0].trim(); if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vendor') !== -1) currentController.vendor = parts[1].split('(')[0].trim();
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(total)') !== -1) { if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(total)') !== -1) {
currentController.vram = parseInt(parts[1]); // in MB currentController.vram = parseInt(parts[1]); // in MB
if (parts[1].toLowerCase().indexOf('gb') !== -1) {
currentController.vram = currentController.vram * 1024;
}
currentController.vramDynamic = false; currentController.vramDynamic = false;
} }
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(dynamic,max)') !== -1) { if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(dynamic,max)') !== -1) {
currentController.vram = parseInt(parts[1]); // in MB currentController.vram = parseInt(parts[1]); // in MB
if (parts[1].toLowerCase().indexOf('gb') !== -1) {
currentController.vram = currentController.vram * 1024;
}
currentController.vramDynamic = true; currentController.vramDynamic = true;
} }
} }

7
lib/index.d.ts vendored
View File

@ -83,9 +83,9 @@ export namespace Systeminformation {
} }
interface CpuCurrentSpeedData { interface CpuCurrentSpeedData {
min: string; min: number;
max: string; max: number;
avg: string; avg: number;
cores: number[]; cores: number[];
} }
@ -243,6 +243,7 @@ export namespace Systeminformation {
java: string; java: string;
gcc: string; gcc: string;
virtualbox: string; virtualbox: string;
dotnet: string;
} }
interface UserData { interface UserData {

View File

@ -15,6 +15,7 @@
const os = require('os'); const os = require('os');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const execSync = require('child_process').execSync;
const util = require('./util'); const util = require('./util');
let _platform = process.platform; let _platform = process.platform;
@ -314,6 +315,62 @@ function memLayout(callback) {
} }
}); });
} }
if (!result.length) {
result.push({
size: os.totalmem(),
bank: '',
type: '',
clockSpeed: 0,
formFactor: '',
partNum: '',
serialNum: '',
voltageConfigured: -1,
voltageMin: -1,
voltageMax: -1,
});
// Try Raspberry PI
try {
let stdout = execSync('cat /proc/cpuinfo 2>/dev/null');
let lines = stdout.toString().split('\n');
let model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') {
const clockSpeed = {
'0': 400,
'1': 450,
'2': 450,
'3': 3200
};
result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
result[0].clockSpeed = version && version[4] && version[4] === 'd' ? '500' : result[0].clockSpeed;
result[0].type = 'LPDDR2';
result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
result[0].formFactor = 'SoC';
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
lines = stdout.toString().split('\n');
let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
if (freq) {
result.clockSpeed = freq;
}
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
lines = stdout.toString().split('\n');
let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
if (voltage) {
result[0].voltageConfigured = voltage;
result[0].voltageMin = voltage;
result[0].voltageMax = voltage;
}
}
} catch (e) {
util.noop();
}
}
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);
}); });

View File

@ -384,11 +384,12 @@ function versions(callback) {
pip3: '', pip3: '',
java: '', java: '',
gcc: '', gcc: '',
virtualbox: '' virtualbox: '',
dotnet: ''
}; };
let functionProcessed = (function () { let functionProcessed = (function () {
let totalFunctions = 25; let totalFunctions = 26;
return function () { return function () {
if (--totalFunctions === 0) { if (--totalFunctions === 0) {
if (callback) { if (callback) {
@ -694,6 +695,13 @@ function versions(callback) {
} }
functionProcessed(); functionProcessed();
}); });
exec('dotnet --version 2>&1', function (error, stdout) {
if (!error) {
const dotnet = stdout.toString().split('\n')[0] || '';
result.dotnet = dotnet.trim();
}
functionProcessed();
});
} catch (e) { } catch (e) {
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);

View File

@ -260,11 +260,13 @@ function services(srv, callback) {
let srvName = util.getValue(lines, 'Name', '=', true).toLowerCase(); let srvName = util.getValue(lines, 'Name', '=', true).toLowerCase();
let started = util.getValue(lines, 'Started', '=', true); let started = util.getValue(lines, 'Started', '=', true);
let startMode = util.getValue(lines, 'StartMode', '=', true); let startMode = util.getValue(lines, 'StartMode', '=', true);
let pid = util.getValue(lines, 'ProcessId', '=', true);
if (srv === '*' || srvs.indexOf(srvName) >= 0) { if (srv === '*' || srvs.indexOf(srvName) >= 0) {
result.push({ result.push({
name: srvName, name: srvName,
running: (started === 'TRUE'), running: (started === 'TRUE'),
startmode: startMode, startmode: startMode,
pids: [ pid],
pcpu: 0, pcpu: 0,
pmem: 0 pmem: 0
}); });
@ -281,6 +283,7 @@ function services(srv, callback) {
name: srvName, name: srvName,
running: false, running: false,
startmode: '', startmode: '',
pids: [],
pcpu: 0, pcpu: 0,
pmem: 0 pmem: 0
}); });

View File

@ -100,6 +100,10 @@ function system(callback) {
if (result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2835' || result.model === 'BCM2837') { if (result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2835' || result.model === 'BCM2837') {
// Pi 4 // Pi 4
if (['c03112'].indexOf(result.version) >= 0) {
result.model = result.model + ' - Pi 4 Model B';
result.version = result.version + ' - Rev. 1.2';
}
if (['a03111', 'b03111', 'c03111'].indexOf(result.version) >= 0) { if (['a03111', 'b03111', 'c03111'].indexOf(result.version) >= 0) {
result.model = result.model + ' - Pi 4 Model B'; result.model = result.model + ' - Pi 4 Model B';
result.version = result.version + ' - Rev. 1.1'; result.version = result.version + ' - Rev. 1.1';

View File

@ -1,6 +1,6 @@
{ {
"name": "systeminformation", "name": "systeminformation",
"version": "4.21.3", "version": "4.22.5",
"description": "Simple system and OS information library", "description": "Simple system and OS information library",
"license": "MIT", "license": "MIT",
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)", "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",