code cleanup, updated docs

This commit is contained in:
Sebastian Hildebrandt 2022-09-26 20:39:08 +02:00
parent 013959ce95
commit 601bc680d0
7 changed files with 5 additions and 24 deletions

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 > 15,000 lines of code, > 500 versions published, > 4 mio downloads per month, > 90 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project! This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 5 mio downloads per month, > 100 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
## New Version 5.0 ## New Version 5.0

View File

@ -26,7 +26,7 @@
<body> <body>
<nav class="nav"> <nav class="nav">
<div class="container"> <div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png"> <a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div> <div class="title float-left">systeminformation</div>
</a> </a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div> <div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -167,7 +167,7 @@
<header class="bg-image-full"> <header class="bg-image-full">
<div class="top-container"> <div class="top-container">
<a href="security.html" class="recommendation">Security advisory:<br>Update to v5.6.13</a> <a href="security.html" class="recommendation">Security advisory:<br>Update to v5.6.13</a>
<img class="logo" src="assets/logo.png"> <img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.12.6</span></div> <div class="version">New Version: <span id="version">5.12.6</span></div>
@ -214,7 +214,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">558</div> <div class="numbers">583</div>
<div class="title">Dependents</div> <div class="title">Dependents</div>
</div> </div>
</div> </div>

View File

@ -108,7 +108,6 @@ function getDefaultNetworkInterface() {
if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; } if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; }
if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; } if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; }
if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; } if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; }
// console.log('SYNC - default darwin 3');
let result = execSync(cmd); let result = execSync(cmd);
ifacename = result.toString().split('\n')[0]; ifacename = result.toString().split('\n')[0];
if (ifacename.indexOf(':') > -1) { if (ifacename.indexOf(':') > -1) {
@ -173,7 +172,6 @@ function getMacAddresses() {
if (_darwin) { if (_darwin) {
try { try {
const cmd = '/sbin/ifconfig'; const cmd = '/sbin/ifconfig';
// console.log('SYNC - macAde darwin 6');
let res = execSync(cmd); let res = execSync(cmd);
const lines = res.toString().split('\n'); const lines = res.toString().split('\n');
for (let i = 0; i < lines.length; i++) { for (let i = 0; i < lines.length; i++) {
@ -247,8 +245,6 @@ function parseLinesWindowsNics(sections, nconfigsections) {
} }
function getWindowsNics() { function getWindowsNics() {
// const cmd = util.getWmic() + ' nic get /value';
// const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
return new Promise((resolve) => { return new Promise((resolve) => {
process.nextTick(() => { process.nextTick(() => {
let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';'; let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
@ -394,7 +390,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
i8021x.state = 'Enabled'; i8021x.state = 'Enabled';
} }
} catch (error) { } catch (error) {
// console.log('Error getting wired information:', error);
return i8021x; return i8021x;
} }
} else if (connectionType == 'wireless') { } else if (connectionType == 'wireless') {
@ -416,7 +411,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
i8021x.protocol = i8021xProtocol.split(':').pop(); i8021x.protocol = i8021xProtocol.split(':').pop();
} }
} catch (error) { } catch (error) {
// console.log('Error getting wireless information:', error);
if (error.status === 1 && error.stdout.includes('AutoConfig')) { if (error.status === 1 && error.stdout.includes('AutoConfig')) {
i8021x.state = 'Disabled'; i8021x.state = 'Disabled';
i8021x.protocol = 'Not defined'; i8021x.protocol = 'Not defined';
@ -1409,7 +1403,6 @@ function networkConnections(callback) {
peerip = peeraddress.join(':'); peerip = peeraddress.join(':');
} }
let connstate = line[5]; let connstate = line[5];
// if (connstate === 'VERBUNDEN') connstate = 'ESTABLISHED';
let proc = line[6].split('/'); let proc = line[6].split('/');
if (connstate) { if (connstate) {

View File

@ -18,7 +18,6 @@ const fs = require('fs');
const util = require('./util'); const util = require('./util');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const execSync = require('child_process').execSync; const execSync = require('child_process').execSync;
// const execPromise = util.promisify(require('child_process').exec);
let _platform = process.platform; let _platform = process.platform;
@ -1090,7 +1089,6 @@ function uuid(callback) {
const jsonObj = JSON.parse(stdout.toString()); const jsonObj = JSON.parse(stdout.toString());
if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) { if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
const spHardware = jsonObj.SPHardwareDataType[0]; const spHardware = jsonObj.SPHardwareDataType[0];
// result.os = parts.length > 1 ? parts[1].trim().toLowerCase() : '';
result.os = spHardware.platform_UUID.toLowerCase(); result.os = spHardware.platform_UUID.toLowerCase();
result.hardware = spHardware.serial_number; result.hardware = spHardware.serial_number;
} }

View File

@ -14,9 +14,7 @@
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
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');
// const fs = require('fs');
let _platform = process.platform; let _platform = process.platform;

View File

@ -150,7 +150,6 @@ function services(srv, callback) {
let srvs = srvString.split('|'); let srvs = srvString.split('|');
let result = []; let result = [];
let dataSrv = []; let dataSrv = [];
// let allSrv = [];
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') { if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') {
@ -1166,18 +1165,13 @@ function processLoad(proc, callback) {
listPos = j; listPos = j;
} }
} }
// console.log(listPos);
processes.forEach(function (proc) { processes.forEach(function (proc) {
// console.log(proc)
// console.log(item)
// inList = inList || item.name.toLowerCase() === proc.toLowerCase();
if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) { if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
inList = true; inList = true;
name = proc; name = proc;
} }
}); });
// console.log(item);
// console.log(listPos);
if ((processesString === '*') || inList) { if ((processesString === '*') || inList) {
if (listPos < 0) { if (listPos < 0) {
result.push({ result.push({
@ -1265,10 +1259,8 @@ function processLoad(proc, callback) {
}); });
_process_cpu.all = all; _process_cpu.all = all;
// _process_cpu.list = list_new;
_process_cpu.list = Object.assign({}, list_new); _process_cpu.list = Object.assign({}, list_new);
_process_cpu.ms = Date.now() - _process_cpu.ms; _process_cpu.ms = Date.now() - _process_cpu.ms;
// _process_cpu.result = result;
_process_cpu.result = Object.assign({}, result); _process_cpu.result = Object.assign({}, result);
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);