code cleanup, refresh rate (win)
This commit is contained in:
parent
24cfe4690c
commit
c5647a66fd
@ -525,11 +525,11 @@ function getSocketTypesByName(str) {
|
|||||||
let result = '';
|
let result = '';
|
||||||
for (const key in socketTypesByName) {
|
for (const key in socketTypesByName) {
|
||||||
const names = socketTypesByName[key].split(' ');
|
const names = socketTypesByName[key].split(' ');
|
||||||
for (let i = 0; i < names.length; i++) {
|
names.forEach(element => {
|
||||||
if (str.indexOf(names[i]) >= 0) {
|
if (str.indexOf(element) >= 0) {
|
||||||
result = key;
|
result = key;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -458,7 +458,7 @@ function dockerContainerStats(containerIDs, callback) {
|
|||||||
containerIDsSanitized = '';
|
containerIDsSanitized = '';
|
||||||
const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim();
|
const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim();
|
||||||
for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
|
for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
|
||||||
if (!(s[i] === undefined)) {
|
if (s[i] !== undefined) {
|
||||||
s[i].__proto__.toLowerCase = util.stringToLower;
|
s[i].__proto__.toLowerCase = util.stringToLower;
|
||||||
const sl = s[i].toLowerCase();
|
const sl = s[i].toLowerCase();
|
||||||
if (sl && sl[0] && !sl[1]) {
|
if (sl && sl[0] && !sl[1]) {
|
||||||
|
|||||||
@ -864,10 +864,12 @@ function graphics(callback) {
|
|||||||
if (_pixelDepth) {
|
if (_pixelDepth) {
|
||||||
result.displays[0].pixelDepth = _pixelDepth;
|
result.displays[0].pixelDepth = _pixelDepth;
|
||||||
}
|
}
|
||||||
if (_refreshRate && !result.displays[0].currentRefreshRate) {
|
|
||||||
result.displays[0].currentRefreshRate = _refreshRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
result.displays = result.displays.map(element => {
|
||||||
|
if (_refreshRate && !element.currentRefreshRate) {
|
||||||
|
element.currentRefreshRate = _refreshRate;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(result);
|
callback(result);
|
||||||
|
|||||||
@ -46,7 +46,7 @@ function inetChecksite(url, callback) {
|
|||||||
let urlSanitized = '';
|
let urlSanitized = '';
|
||||||
const s = util.sanitizeShellString(url, true);
|
const s = util.sanitizeShellString(url, true);
|
||||||
for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
|
for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
|
||||||
if (!(s[i] === undefined)) {
|
if (!s[i] !== undefined) {
|
||||||
s[i].__proto__.toLowerCase = util.stringToLower;
|
s[i].__proto__.toLowerCase = util.stringToLower;
|
||||||
const sl = s[i].toLowerCase();
|
const sl = s[i].toLowerCase();
|
||||||
if (sl && sl[0] && !sl[1] && sl[0].length === 1) {
|
if (sl && sl[0] && !sl[1] && sl[0].length === 1) {
|
||||||
|
|||||||
@ -305,7 +305,6 @@ function getWindowsDNSsuffixes() {
|
|||||||
|
|
||||||
return dnsSuffixes;
|
return dnsSuffixes;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// console.log('An error occurred trying to bring the Connection-specific DNS suffix', error.message);
|
|
||||||
return {
|
return {
|
||||||
primaryDNS: '',
|
primaryDNS: '',
|
||||||
exitCode: 0,
|
exitCode: 0,
|
||||||
|
|||||||
@ -47,7 +47,6 @@ function system(callback) {
|
|||||||
|
|
||||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||||
exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||||
// if (!error) {
|
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
result.manufacturer = util.getValue(lines, 'manufacturer');
|
result.manufacturer = util.getValue(lines, 'manufacturer');
|
||||||
result.model = util.getValue(lines, 'product name');
|
result.model = util.getValue(lines, 'product name');
|
||||||
@ -55,7 +54,6 @@ function system(callback) {
|
|||||||
result.serial = util.getValue(lines, 'serial number');
|
result.serial = util.getValue(lines, 'serial number');
|
||||||
result.uuid = util.getValue(lines, 'uuid').toLowerCase();
|
result.uuid = util.getValue(lines, 'uuid').toLowerCase();
|
||||||
result.sku = util.getValue(lines, 'sku number');
|
result.sku = util.getValue(lines, 'sku number');
|
||||||
// }
|
|
||||||
// Non-Root values
|
// Non-Root values
|
||||||
const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;
|
const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;
|
||||||
echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;
|
echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;
|
||||||
|
|||||||
@ -350,7 +350,6 @@ function parseWinUsersQuery(lines) {
|
|||||||
if (lines[i].trim()) {
|
if (lines[i].trim()) {
|
||||||
const user = lines[i].substring(headerDelimiter[0] + 1, headerDelimiter[1]).trim() || '';
|
const user = lines[i].substring(headerDelimiter[0] + 1, headerDelimiter[1]).trim() || '';
|
||||||
const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || '';
|
const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || '';
|
||||||
// const dateTime = util.parseDateTime(lines[i].substring(headerDelimiter[5] + 1, 2000).trim(), culture) || '';
|
|
||||||
result.push({
|
result.push({
|
||||||
user: user,
|
user: user,
|
||||||
tty: tty,
|
tty: tty,
|
||||||
|
|||||||
@ -254,7 +254,6 @@ function parseHead(head, rights) {
|
|||||||
let result = [];
|
let result = [];
|
||||||
for (let i = 0; i < head.length; i++) {
|
for (let i = 0; i < head.length; i++) {
|
||||||
if (count <= rights) {
|
if (count <= rights) {
|
||||||
// if (head[i] === ' ' && !space) {
|
|
||||||
if (/\s/.test(head[i]) && !space) {
|
if (/\s/.test(head[i]) && !space) {
|
||||||
to = i - 1;
|
to = i - 1;
|
||||||
result.push({
|
result.push({
|
||||||
|
|||||||
@ -68,7 +68,6 @@ function printTitle(title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process.stdin.on('keypress', (key, data) => {
|
process.stdin.on('keypress', (key, data) => {
|
||||||
// console.log(data);
|
|
||||||
if (data.name === 'q' && !data.shift) {
|
if (data.name === 'q' && !data.shift) {
|
||||||
// shut down
|
// shut down
|
||||||
process.exit();
|
process.exit();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user