code cleanup
This commit is contained in:
parent
b7bf83f3ae
commit
c183037128
@ -99,6 +99,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.33.5 | 2017-11-09 | code cleanup |
|
||||||
| 3.33.4 | 2017-11-09 | bugfix graphics controller win (bytes) |
|
| 3.33.4 | 2017-11-09 | bugfix graphics controller win (bytes) |
|
||||||
| 3.33.3 | 2017-11-08 | bugfix cpu speed arm - type |
|
| 3.33.3 | 2017-11-08 | bugfix cpu speed arm - type |
|
||||||
| 3.33.2 | 2017-11-08 | bugfix cpu speed arm |
|
| 3.33.2 | 2017-11-08 | bugfix cpu speed arm |
|
||||||
|
|||||||
@ -327,7 +327,7 @@ function graphics(callback) {
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
let csections = stdout.split(/\n\s*\n/);
|
let csections = stdout.split(/\n\s*\n/);
|
||||||
result.controllers = parseLinesWindowsControllers(csections);
|
result.controllers = parseLinesWindowsControllers(csections);
|
||||||
exec('wmic path win32_desktopmonitor get MonitorManufacturer, ScreenWidth, ScreenHeight /value', function (error, stdout) {
|
exec('wmic path win32_desktopmonitor get Caption, MonitorManufacturer, MonitorType, ScreenWidth, ScreenHeight /value', function (error, stdout) {
|
||||||
let dsections = stdout.split(/\n\s*\n/);
|
let dsections = stdout.split(/\n\s*\n/);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
result.displays = parseLinesWindowsDisplays(dsections);
|
result.displays = parseLinesWindowsDisplays(dsections);
|
||||||
@ -385,8 +385,13 @@ function graphics(callback) {
|
|||||||
let lines = sections[i].trim().split('\r\n');
|
let lines = sections[i].trim().split('\r\n');
|
||||||
displays.push({
|
displays.push({
|
||||||
model: util.getValue(lines, 'MonitorManufacturer', '='),
|
model: util.getValue(lines, 'MonitorManufacturer', '='),
|
||||||
|
main: false,
|
||||||
|
builtin: false,
|
||||||
|
connection: '',
|
||||||
resolutionx: toInt(util.getValue(lines, 'ScreenWidth', '=')),
|
resolutionx: toInt(util.getValue(lines, 'ScreenWidth', '=')),
|
||||||
resolutiony: toInt(util.getValue(lines, 'ScreenHeight', '=')),
|
resolutiony: toInt(util.getValue(lines, 'ScreenHeight', '=')),
|
||||||
|
sizex: -1,
|
||||||
|
sizey: -1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,8 +40,8 @@ function inetChecksite(url, callback) {
|
|||||||
url = url.toLowerCase();
|
url = url.toLowerCase();
|
||||||
let t = Date.now();
|
let t = Date.now();
|
||||||
if (_linux || _darwin) {
|
if (_linux || _darwin) {
|
||||||
let args = " -I --connect-timeout 5 -m 5 " + url + " 2>/dev/null | head -n 1 | cut -d ' ' -f2";
|
let args = ' -I --connect-timeout 5 -m 5 ' + url + ' 2>/dev/null | head -n 1 | cut -d " " -f2';
|
||||||
let cmd = "curl";
|
let cmd = 'curl';
|
||||||
exec(cmd + args, function (error, stdout) {
|
exec(cmd + args, function (error, stdout) {
|
||||||
let statusCode = parseInt(stdout.toString());
|
let statusCode = parseInt(stdout.toString());
|
||||||
result.status = statusCode || 404;
|
result.status = statusCode || 404;
|
||||||
@ -66,12 +66,12 @@ function inetChecksite(url, callback) {
|
|||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
resolve(result);
|
resolve(result);
|
||||||
} else {
|
} else {
|
||||||
res.on('data', (chunk) => { });
|
// res.on('data', (chunk) => { });
|
||||||
res.on('end', () => {
|
res.on('end', () => {
|
||||||
result.ms = (result.ok ? Date.now() - t : -1);
|
result.ms = (result.ok ? Date.now() - t : -1);
|
||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
resolve(result);
|
resolve(result);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}).on('error', err => {
|
}).on('error', err => {
|
||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
@ -110,16 +110,22 @@ function inetLatency(host, callback) {
|
|||||||
let cmd;
|
let cmd;
|
||||||
if (_linux || _darwin) {
|
if (_linux || _darwin) {
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
cmd = "ping -c 2 -w 3 " + host + " | grep rtt | cut -d'/' -f4 | awk '{ print $3 }'";
|
cmd = 'ping -c 2 -w 3 ' + host + ' | grep rtt';
|
||||||
}
|
}
|
||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
cmd = "ping -c 2 -t 3 " + host + " | grep avg | cut -d'/' -f4 | awk '{ print $3 }'";
|
cmd = 'ping -c 2 -t 3 ' + host + ' | grep avg';
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(cmd, function (error, stdout) {
|
exec(cmd, function (error, stdout) {
|
||||||
let result = -1;
|
let result = -1;
|
||||||
if (!error) {
|
if (!error) {
|
||||||
result = parseFloat(stdout.toString());
|
const line = stdout.toString().split('=');
|
||||||
|
if (line.length > 1) {
|
||||||
|
const parts = line[1].split('/');
|
||||||
|
if (parts.length > 1) {
|
||||||
|
result = parseFloat(parts[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
resolve(result);
|
resolve(result);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user