graphics() fix after wmic refactor (win)

This commit is contained in:
Sebastian Hildebrandt 2021-10-21 13:41:34 +02:00
parent 23650f7079
commit 0612e3aa20
3 changed files with 1964 additions and 1946 deletions

View File

@ -1,11 +1,14 @@
body { body {
font-family: 'Roboto', 'HelveticaNeue-Light','Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,sans-serif; font-family: "Roboto", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, sans-serif;
background-color: rgb(14, 24, 46); background-color: rgb(14, 24, 46);
font-weight: 300; font-weight: 300;
min-height: 100%; min-height: 100%;
} }
h1, h2, h3, h4 { h1,
font-family: 'Roboto', 'HelveticaNeue-Light','Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,sans-serif; h2,
h3,
h4 {
font-family: "Roboto", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 500; font-weight: 500;
color: rgb(61, 92, 179); color: rgb(61, 92, 179);
} }
@ -31,13 +34,13 @@ h1, h2, h3, h4 {
} }
.container-fluid { .container-fluid {
background-color: rgb(255,255,255); background-color: rgb(255, 255, 255);
padding-bottom: 30px; padding-bottom: 30px;
} }
.bg-image-full { .bg-image-full {
// background: no-repeat center center scroll; // background: no-repeat center center scroll;
background-color: #1A1F30; /* For browsers that do not support gradients */ background-color: #1a1f30; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #2A2D66, #060520); /* Standard syntax (must be last) */ background-image: linear-gradient(210deg, #2a2d66, #060520); /* Standard syntax (must be last) */
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -73,34 +76,34 @@ h1, h2, h3, h4 {
position: absolute; position: absolute;
top: 30px; top: 30px;
right: 0px; right: 0px;
margin-right:-85px; margin-right: -85px;
z-index: 10; z-index: 10;
display: inline-block; display: inline-block;
width: 280px; width: 280px;
text-align: center; text-align: center;
padding: .25em 0; padding: 0.25em 0;
color: white; color: white;
transform: rotate(45deg); transform: rotate(45deg);
background: rgb(151, 29, 29); background: rgb(151, 29, 29);
font-size: 0.9rem; font-size: 0.9rem;
@media only screen and (min-width: 420px) { @media only screen and (min-width: 420px) {
font-size: 1.0rem; font-size: 1rem;
} }
@media only screen and (min-width: 767px) { @media only screen and (min-width: 767px) {
font-size: 1.1rem; font-size: 1.1rem;
top: 40px; top: 40px;
margin-right:-95px; margin-right: -95px;
width: 330px; width: 330px;
} }
@media only screen and (min-width: 1024px) { @media only screen and (min-width: 1024px) {
width: 330px; width: 330px;
top: 60px; top: 60px;
right: 0px; right: 0px;
margin-right:-71px; margin-right: -71px;
font-size: 1.2rem; font-size: 1.2rem;
} }
&:hover { &:hover {
text-decoration: none;; text-decoration: none;
} }
} }
.title { .title {
@ -197,9 +200,9 @@ h1, h2, h3, h4 {
text-align: center; text-align: center;
margin-bottom: 10px; margin-bottom: 10px;
color: #fff; color: #fff;
font-size: .9rem; font-size: 0.9rem;
@media only screen and (min-width: 420px) { @media only screen and (min-width: 420px) {
font-size: .9rem; font-size: 0.9rem;
} }
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {
font-size: 1rem; font-size: 1rem;
@ -236,8 +239,8 @@ h1, h2, h3, h4 {
// } // }
.nav { .nav {
background: no-repeat center center scroll; background: no-repeat center center scroll;
background-color: #1A1F30; /* For browsers that do not support gradients */ background-color: #1a1f30; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #2A2D66, #060520); /* Standard syntax (must be last) */ background-image: linear-gradient(210deg, #2a2d66, #060520); /* Standard syntax (must be last) */
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
background-size: cover; background-size: cover;
@ -261,7 +264,6 @@ h1, h2, h3, h4 {
@media only screen and (min-width: 1024px) { @media only screen and (min-width: 1024px) {
font-size: 1.5rem; font-size: 1.5rem;
} }
} }
.text { .text {
margin-top: 18px; margin-top: 18px;
@ -269,7 +271,7 @@ h1, h2, h3, h4 {
a { a {
color: #fff; color: #fff;
margin-top: 12px; margin-top: 12px;
font-size: 1.0rem; font-size: 1rem;
@media only screen and (min-width: 1023px) { @media only screen and (min-width: 1023px) {
margin-top: 10px; margin-top: 10px;
font-size: 1.2rem; font-size: 1.2rem;
@ -369,7 +371,7 @@ h1, h2, h3, h4 {
} }
.subtitle { .subtitle {
text-align: center; text-align: center;
font-size: .9rem; font-size: 0.9rem;
padding-top: 3px; padding-top: 3px;
padding-bottom: 5px; padding-bottom: 5px;
@media only screen and (min-width: 420px) { @media only screen and (min-width: 420px) {
@ -401,7 +403,11 @@ h1, h2, h3, h4 {
} }
.index { .index {
margin: 0 0 10px 0; margin: 0 0 10px 0;
.text, .subtitle, .title, .title-small, .npmicons { .text,
.subtitle,
.title,
.title-small,
.npmicons {
text-align: center; text-align: center;
} }
.larger { .larger {
@ -417,7 +423,10 @@ h1, h2, h3, h4 {
} }
} }
.left { .left {
.text, .subtitle, .title, .title-small .npmicons { .text,
.subtitle,
.title,
.title-small .npmicons {
text-align: left; text-align: left;
} }
} }
@ -538,7 +547,6 @@ pre {
background-color: unset; background-color: unset;
.js { .js {
background-color: #f0f0f4; background-color: #f0f0f4;
} }
} }
} }
@ -554,7 +562,7 @@ pre {
a { a {
color: #000; color: #000;
&:hover { &:hover {
text-decoration: none text-decoration: none;
} }
} }
.badge { .badge {

View File

@ -1,11 +1,16 @@
body { body {
font-family: -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; font-family: -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif, "apple color emoji",
"segoe ui emoji", "segoe ui symbol";
font-weight: 300; font-weight: 300;
min-height: 100%; min-height: 100%;
background-color: rgb(89, 53, 30); background-color: rgb(89, 53, 30);
} }
h1, h2, h3, h4 { h1,
font-family: -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol"; h2,
h3,
h4 {
font-family: -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif, "apple color emoji",
"segoe ui emoji", "segoe ui symbol";
font-weight: 300; font-weight: 300;
} }
.center { .center {
@ -19,13 +24,13 @@ h1, h2, h3, h4 {
color: rgb(156, 1, 1); color: rgb(156, 1, 1);
} }
.container-fluid { .container-fluid {
background-color: rgb(255,255,255); background-color: rgb(255, 255, 255);
padding-bottom: 30px; padding-bottom: 30px;
} }
.bg-image-full { .bg-image-full {
background: no-repeat center center scroll; background: no-repeat center center scroll;
background-color: #4b2313; /* For browsers that do not support gradients */ background-color: #4b2313; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #4b2313, #2c0c0a ); /* Standard syntax (must be last) */ background-image: linear-gradient(210deg, #4b2313, #2c0c0a); /* Standard syntax (must be last) */
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
@ -57,13 +62,13 @@ h1, h2, h3, h4 {
display: inline-block; display: inline-block;
width: 330px; width: 330px;
text-align: center; text-align: center;
padding: .25em 0; padding: 0.25em 0;
color: white; color: white;
transform: rotate(45deg); transform: rotate(45deg);
background: rgb(151, 29, 29); background: rgb(151, 29, 29);
font-size: 0.9rem; font-size: 0.9rem;
@media only screen and (min-width: 420px) { @media only screen and (min-width: 420px) {
font-size: 1.0rem; font-size: 1rem;
} }
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {
font-size: 1.1rem; font-size: 1.1rem;
@ -74,7 +79,7 @@ h1, h2, h3, h4 {
font-size: 1.2rem; font-size: 1.2rem;
} }
&:hover { &:hover {
text-decoration: none;; text-decoration: none;
} }
} }
.title { .title {
@ -146,9 +151,9 @@ h1, h2, h3, h4 {
text-align: center; text-align: center;
margin-bottom: 10px; margin-bottom: 10px;
color: #fff; color: #fff;
font-size: .9rem; font-size: 0.9rem;
@media only screen and (min-width: 420px) { @media only screen and (min-width: 420px) {
font-size: .9rem; font-size: 0.9rem;
} }
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {
font-size: 1rem; font-size: 1rem;
@ -182,7 +187,7 @@ h1, h2, h3, h4 {
// background-color: #1A1F30; /* For browsers that do not support gradients */ // background-color: #1A1F30; /* For browsers that do not support gradients */
// background-image: linear-gradient(210deg, #2A2D66, #060520); /* Standard syntax (must be last) */ // background-image: linear-gradient(210deg, #2A2D66, #060520); /* Standard syntax (must be last) */
background-color: #4b2313; /* For browsers that do not support gradients */ background-color: #4b2313; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #4b2313, #2c0c0a ); /* Standard syntax (must be last) */ background-image: linear-gradient(210deg, #4b2313, #2c0c0a); /* Standard syntax (must be last) */
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
background-size: cover; background-size: cover;
@ -212,7 +217,7 @@ h1, h2, h3, h4 {
a { a {
color: #fff; color: #fff;
margin-top: 12px; margin-top: 12px;
font-size: 1.0rem; font-size: 1rem;
@media only screen and (min-width: 1023px) { @media only screen and (min-width: 1023px) {
margin-top: 10px; margin-top: 10px;
font-size: 1.2rem; font-size: 1.2rem;
@ -307,7 +312,7 @@ h1, h2, h3, h4 {
} }
.subtitle { .subtitle {
text-align: center; text-align: center;
font-size: .9rem; font-size: 0.9rem;
@media only screen and (min-width: 420px) { @media only screen and (min-width: 420px) {
font-size: 1rem; font-size: 1rem;
} }
@ -337,7 +342,11 @@ h1, h2, h3, h4 {
} }
.index { .index {
margin: 0 0 10px 0; margin: 0 0 10px 0;
.text, .subtitle, .title, .title-small, .npmicons { .text,
.subtitle,
.title,
.title-small,
.npmicons {
text-align: center; text-align: center;
} }
a { a {
@ -349,7 +358,10 @@ h1, h2, h3, h4 {
} }
} }
.left { .left {
.text, .subtitle, .title, .title-small .npmicons { .text,
.subtitle,
.title,
.title-small .npmicons {
text-align: left; text-align: left;
} }
} }
@ -463,7 +475,6 @@ pre {
background-color: unset; background-color: unset;
.js { .js {
background-color: #f0f0f4; background-color: #f0f0f4;
} }
} }
} }
@ -485,5 +496,5 @@ pre {
font-size: 1.5rem !important; font-size: 1.5rem !important;
} }
.v5 { .v5 {
color:rgb(86, 122, 223); color: rgb(86, 122, 223);
} }

View File

@ -13,7 +13,6 @@
// 7. Graphics (controller, display) // 7. Graphics (controller, display)
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
const os = require('os');
const fs = require('fs'); const fs = require('fs');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const execSync = require('child_process').execSync; const execSync = require('child_process').execSync;
@ -783,8 +782,8 @@ function graphics(callback) {
workload workload
).then(data => { ).then(data => {
// controller + vram // controller + vram
let csections = data[0].split(/\n\s*\n/); let csections = data[0].replace(/\r/g, '').split(/\n\s*\n/);
let vsections = data[1].split(/\n\s*\n/); let vsections = data[1].replace(/\r/g, '').split(/\n\s*\n/);
result.controllers = parseLinesWindowsControllers(csections, vsections); result.controllers = parseLinesWindowsControllers(csections, vsections);
result.controllers = result.controllers.map((controller) => { // match by subDeviceId result.controllers = result.controllers.map((controller) => { // match by subDeviceId
if (controller.vendor.toLowerCase() === 'nvidia') { if (controller.vendor.toLowerCase() === 'nvidia') {
@ -810,25 +809,25 @@ function graphics(callback) {
}); });
// displays // displays
let dsections = data[2].split(/\n\s*\n/); let dsections = data[2].replace(/\r/g, '').split(/\n\s*\n/);
// result.displays = parseLinesWindowsDisplays(dsections); // result.displays = parseLinesWindowsDisplays(dsections);
dsections.shift(); if (dsections[0].trim() === '') { dsections.shift(); }
dsections.pop(); if (dsections.length && dsections[dsections.length - 1].trim() === '') { dsections.pop(); }
// monitor (powershell) // monitor (powershell)
let msections = data[3].split('Active '); let msections = data[3].replace(/\r/g, '').split('Active ');
msections.shift(); msections.shift();
// forms.screens (powershell) // forms.screens (powershell)
let ssections = data[4].split('BitsPerPixel '); let ssections = data[4].replace(/\r/g, '').split('BitsPerPixel ');
ssections.shift(); ssections.shift();
// connection params (powershell) - video type // connection params (powershell) - video type
let tsections = data[5].split(/\n\s*\n/); let tsections = data[5].replace(/\r/g, '').split(/\n\s*\n/);
tsections.shift(); tsections.shift();
// monitor ID (powershell) - model / vendor // monitor ID (powershell) - model / vendor
const res = data[6].split(/\r\n/); const res = data[6].replace(/\r/g, '').split(/\n/);
let isections = []; let isections = [];
res.forEach(element => { res.forEach(element => {
const parts = element.split('|'); const parts = element.split('|');
@ -842,6 +841,7 @@ function graphics(callback) {
}); });
} }
}); });
result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections); result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections);
if (result.displays.length === 1) { if (result.displays.length === 1) {
@ -889,7 +889,7 @@ function graphics(callback) {
for (const i in vections) { for (const i in vections) {
if ({}.hasOwnProperty.call(vections, i)) { if ({}.hasOwnProperty.call(vections, i)) {
if (vections[i].trim() !== '') { if (vections[i].trim() !== '') {
const lines = vections[i].trim().split(os.EOL); const lines = vections[i].trim().split('\n');
const matchingDeviceId = util.getValue(lines, 'MatchingDeviceId').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i); const matchingDeviceId = util.getValue(lines, 'MatchingDeviceId').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);
if (matchingDeviceId) { if (matchingDeviceId) {
const quadWordmemorySize = parseInt(util.getValue(lines, 'HardwareInformation.qwMemorySize')); const quadWordmemorySize = parseInt(util.getValue(lines, 'HardwareInformation.qwMemorySize'));
@ -912,7 +912,7 @@ function graphics(callback) {
for (let i in sections) { for (let i in sections) {
if ({}.hasOwnProperty.call(sections, i)) { if ({}.hasOwnProperty.call(sections, i)) {
if (sections[i].trim() !== '') { if (sections[i].trim() !== '') {
let lines = sections[i].trim().split('\r\n'); let lines = sections[i].trim().split('\n');
let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', ':').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i); let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', ':').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);
let subDeviceId = null; let subDeviceId = null;
let memorySize = null; let memorySize = null;
@ -984,7 +984,7 @@ function graphics(callback) {
let resolutionX = 0; let resolutionX = 0;
let resolutionY = 0; let resolutionY = 0;
if (dsections && dsections.length) { if (dsections && dsections.length) {
let linesDisplay = dsections[0].split(os.EOL); let linesDisplay = dsections[0].split('\n');
vendor = util.getValue(linesDisplay, 'MonitorManufacturer', ':'); vendor = util.getValue(linesDisplay, 'MonitorManufacturer', ':');
model = util.getValue(linesDisplay, 'Name', ':'); model = util.getValue(linesDisplay, 'Name', ':');
deviceID = util.getValue(linesDisplay, 'PNPDeviceID', ':').replace(/&/g, '&').toLowerCase(); deviceID = util.getValue(linesDisplay, 'PNPDeviceID', ':').replace(/&/g, '&').toLowerCase();
@ -1000,10 +1000,10 @@ function graphics(callback) {
if (tsections.length === 0 || tsections[i] === undefined) { if (tsections.length === 0 || tsections[i] === undefined) {
tsections[i] = 'Unknown'; tsections[i] = 'Unknown';
} }
let linesScreen = ssections[i].split(os.EOL); let linesScreen = ssections[i].split('\n');
let linesMonitor = msections[i].split(os.EOL); let linesMonitor = msections[i].split('\n');
let linesConnection = tsections[i].split(os.EOL); let linesConnection = tsections[i].split('\n');
const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel'); const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel');
const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').split(','); const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').split(',');
const primary = util.getValue(linesScreen, 'Primary'); const primary = util.getValue(linesScreen, 'Primary');
@ -1057,7 +1057,6 @@ function graphics(callback) {
} }
return displays; return displays;
} }
} }
exports.graphics = graphics; exports.graphics = graphics;