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

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +1,178 @@
body {
font-family: -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif, "apple color emoji", "segoe ui emoji", "segoe ui symbol";
font-weight: 300;
min-height: 100%;
background-color: rgb(89, 53, 30);
font-family: -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif, "apple color emoji",
"segoe ui emoji", "segoe ui symbol";
font-weight: 300;
min-height: 100%;
background-color: rgb(89, 53, 30);
}
h1, 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;
h1,
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;
}
.center {
text-align: center;
text-align: center;
}
.bold {
font-weight: 700;
font-weight: 700;
}
.warning {
font-weight: 500;
color: rgb(156, 1, 1);
font-weight: 500;
color: rgb(156, 1, 1);
}
.container-fluid {
background-color: rgb(255,255,255);
background-color: rgb(255, 255, 255);
padding-bottom: 30px;
}
.bg-image-full {
background: no-repeat center center scroll;
background-color: #4b2313; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #4b2313, #2c0c0a ); /* Standard syntax (must be last) */
background: no-repeat center center scroll;
background-color: #4b2313; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #4b2313, #2c0c0a); /* Standard syntax (must be last) */
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
height: 100vh; //calc(100vh);
height: calc(var(--vh, 1vh) * 100);
opacity: 0.95;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
height: 100vh; //calc(100vh);
height: calc(var(--vh, 1vh) * 100);
opacity: 0.95;
display: flex;
justify-content: center;
text-align: center;
// align-items: center;
flex-direction: column;
.container {
text-align: center;
align-self: center;
display: flex;
justify-content: center;
text-align: center;
// align-items: center;
flex-direction: column;
.container {
text-align: center;
align-self: center;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
flex-grow: 1;
align-items: center;
flex-grow: 1;
}
.recommendation {
position: absolute;
top: 40px;
right: -95px;
z-index: 10;
display: inline-block;
width: 330px;
text-align: center;
padding: 0.25em 0;
color: white;
transform: rotate(45deg);
background: rgb(151, 29, 29);
font-size: 0.9rem;
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
.recommendation {
position: absolute;
top: 40px;
right: -95px;
z-index: 10;
display: inline-block;
width: 330px;
text-align: center;
padding: .25em 0;
color: white;
transform: rotate(45deg);
background: rgb(151, 29, 29);
@media only screen and (min-width: 768px) {
font-size: 1.1rem;
}
@media only screen and (min-width: 1024px) {
top: 50px;
right: -75px;
font-size: 1.2rem;
}
&:hover {
text-decoration: none;
}
}
.title {
color: #fff;
padding-top: 10px;
font-size: 1.8rem;
margin-bottom: 10px;
@media only screen and (min-width: 420px) {
font-size: 2.4rem;
}
@media only screen and (min-width: 768px) {
font-size: 3.2rem;
}
@media only screen and (min-width: 1024px) {
font-size: 4rem;
}
}
.logo {
width: 100px;
@media only screen and (min-width: 420px) {
width: 120px;
}
@media only screen and (min-width: 768px) {
width: 160px;
}
@media only screen and (min-width: 1024px) {
width: 200px;
}
}
.subtitle {
text-align: center;
color: #bbb;
font-size: 0.78rem;
@media only screen and (min-width: 375px) {
font-size: 0.9rem;
@media only screen and (min-width: 420px) {
font-size: 1.0rem;
}
@media only screen and (min-width: 768px) {
font-size: 1.1rem;
}
@media only screen and (min-width: 1024px) {
top: 50px;
right: -75px;
font-size: 1.2rem;
}
&:hover {
text-decoration: none;;
}
}
.title {
color: #fff;
padding-top: 10px;
font-size: 1.8rem;
margin-bottom: 10px;
@media only screen and (min-width: 420px) {
font-size: 2.4rem;
}
@media only screen and (min-width: 768px) {
font-size: 3.2rem;
}
@media only screen and (min-width: 1024px) {
font-size: 4rem;
}
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
.logo {
width: 100px;
@media only screen and (min-width: 420px) {
width: 120px;
}
@media only screen and (min-width: 768px) {
width: 160px;
}
@media only screen and (min-width: 1024px) {
width: 200px;
}
@media only screen and (min-width: 768px) {
font-size: 1.1rem;
}
.subtitle {
text-align: center;
color: #bbb;
font-size: 0.78rem;
@media only screen and (min-width: 375px) {
font-size: 0.9rem;
}
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
@media only screen and (min-width: 768px) {
font-size: 1.1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.3rem;
}
}
.text > a {
text-align: center;
color: #fff;
font-size: 0.9rem;
&:hover {
color: #aaa;
text-decoration: none;
}
@media only screen and (min-width: 375px) {
font-size: 0.9rem;
}
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
@media only screen and (min-width: 768px) {
font-size: 1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.1rem;
}
}
.version {
text-align: center;
margin-bottom: 10px;
color: #fff;
font-size: .9rem;
@media only screen and (min-width: 420px) {
font-size: .9rem;
}
@media only screen and (min-width: 768px) {
font-size: 1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.1rem;
}
}
.down {
text-align: center;
color: #fff;
@media only screen and (min-width: 1024px) {
font-size: 1.3rem;
line-height: 1;
margin-bottom: 15px;
cursor: pointer;
.caret {
font-size: 3rem;
}
}
}
.text > a {
text-align: center;
color: #fff;
font-size: 0.9rem;
&:hover {
color: #aaa;
text-decoration: none;
}
@media only screen and (min-width: 375px) {
font-size: 0.9rem;
}
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
@media only screen and (min-width: 768px) {
font-size: 1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.1rem;
}
}
.version {
text-align: center;
margin-bottom: 10px;
color: #fff;
font-size: 0.9rem;
@media only screen and (min-width: 420px) {
font-size: 0.9rem;
}
@media only screen and (min-width: 768px) {
font-size: 1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.1rem;
}
}
.down {
text-align: center;
color: #fff;
font-size: 1.3rem;
line-height: 1;
margin-bottom: 15px;
cursor: pointer;
.caret {
font-size: 3rem;
}
}
}
// a[ id="quickstart" ]:target ~ #main div.row {
@ -178,312 +183,318 @@ h1, h2, h3, h4 {
// background-color: #ff3333;
// }
.nav {
background: no-repeat center center scroll;
// background-color: #1A1F30; /* For browsers that do not support gradients */
// background-image: linear-gradient(210deg, #2A2D66, #060520); /* Standard syntax (must be last) */
background-color: #4b2313; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #4b2313, #2c0c0a ); /* Standard syntax (must be last) */
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
height: 65px;
position: relative;
.logo {
width: 60px;
margin-top: 12px;
}
.title {
display: none;
color: #fff;
font-size: 1.2rem;
margin-left: 15px;
margin-top: 18px;
@media only screen and (min-width: 768px) {
display: inline-block;
}
@media only screen and (min-width: 1024px) {
font-size: 1.2rem;
}
}
.text {
margin-top: 18px;
a {
color: #fff;
margin-top: 12px;
font-size: 1.0rem;
@media only screen and (min-width: 1023px) {
margin-top: 10px;
font-size: 1.2rem;
}
&:hover {
color: #aaa;
text-decoration: none;
}
}
}
.github {
display: none;
@media only screen and (min-width: 768px) {
display: inline-block;
}
}
.todocs {
background: no-repeat center center scroll;
// background-color: #1A1F30; /* For browsers that do not support gradients */
// background-image: linear-gradient(210deg, #2A2D66, #060520); /* Standard syntax (must be last) */
background-color: #4b2313; /* For browsers that do not support gradients */
background-image: linear-gradient(210deg, #4b2313, #2c0c0a); /* Standard syntax (must be last) */
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
height: 65px;
position: relative;
.logo {
width: 60px;
margin-top: 12px;
}
.title {
display: none;
color: #fff;
font-size: 1.2rem;
margin-left: 15px;
margin-top: 18px;
@media only screen and (min-width: 768px) {
display: inline-block;
@media only screen and (min-width: 768px) {
display: none;
}
@media only screen and (min-width: 1024px) {
font-size: 1.2rem;
}
}
.text {
margin-top: 18px;
a {
color: #fff;
margin-top: 12px;
font-size: 1rem;
@media only screen and (min-width: 1023px) {
margin-top: 10px;
font-size: 1.2rem;
}
&:hover {
color: #aaa;
text-decoration: none;
}
}
}
.github {
display: none;
@media only screen and (min-width: 768px) {
display: inline-block;
}
}
.todocs {
display: inline-block;
@media only screen and (min-width: 768px) {
display: none;
}
}
}
.features {
text-align: center;
color: #333;
.inner {
padding: 10px 0px;
text-align: center;
color: #333;
.inner {
padding: 10px 0px;
@media only screen and (min-width: 768px) {
padding: 15px 20px;
}
.icons {
display: block;
font-size: 3rem;
color: #bbb;
@media only screen and (min-width: 420px) {
font-size: 3.5rem;
}
@media only screen and (min-width: 768px) {
padding: 15px 20px;
font-size: 4rem;
}
.icons {
display: block;
font-size: 3rem;
color: #bbb;
@media only screen and (min-width: 420px) {
font-size: 3.5rem;
}
@media only screen and (min-width: 768px) {
font-size: 4rem;
}
@media only screen and (min-width: 1024px) {
font-size: 5rem;
}
}
.icontitle {
font-size: 1.2rem;
}
&:hover {
background: #f4f4f4;
color: rgb(86, 122, 223);
.icons {
color: rgb(86, 122, 223);
}
@media only screen and (min-width: 1024px) {
font-size: 5rem;
}
}
.icontitle {
font-size: 1.2rem;
}
&:hover {
background: #f4f4f4;
color: rgb(86, 122, 223);
.icons {
color: rgb(86, 122, 223);
}
}
}
}
.sectionheader {
.title {
text-align: center;
padding-top: 20px;
font-size: 2rem;
@media only screen and (min-width: 420px) {
font-size: 2.3rem;
}
@media only screen and (min-width: 768px) {
text-align: left;
padding-top: 25px;
font-size: 2.6rem;
}
@media only screen and (min-width: 1024px) {
padding-top: 30px;
font-size: 3rem;
}
.title {
text-align: center;
padding-top: 20px;
font-size: 2rem;
@media only screen and (min-width: 420px) {
font-size: 2.3rem;
}
.title-small {
text-align: center;
font-size: 1.4rem;
@media only screen and (min-width: 420px) {
font-size: 1.6rem;
}
@media only screen and (min-width: 768px) {
text-align: left;
padding-top: 25px;
font-size: 1.8rem;
}
@media only screen and (min-width: 1024px) {
padding-top: 30px;
font-size: 2rem;
}
@media only screen and (min-width: 768px) {
text-align: left;
padding-top: 25px;
font-size: 2.6rem;
}
.subtitle {
text-align: center;
font-size: .9rem;
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
@media only screen and (min-width: 768px) {
text-align: left;
font-size: 1.1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.3rem;
}
@media only screen and (min-width: 1024px) {
padding-top: 30px;
font-size: 3rem;
}
.npmicons {
text-align: center;
}
.title-small {
text-align: center;
font-size: 1.4rem;
@media only screen and (min-width: 420px) {
font-size: 1.6rem;
}
.text {
text-align: center;
padding-top: 10px;
@media only screen and (min-width: 768px) {
text-align: left;
}
@media only screen and (min-width: 768px) {
text-align: left;
padding-top: 25px;
font-size: 1.8rem;
}
hr {
margin-top: 40px;
margin-bottom: 0px;
border: 1px solid #ddd;
@media only screen and (min-width: 1024px) {
padding-top: 30px;
font-size: 2rem;
}
}
.subtitle {
text-align: center;
font-size: 0.9rem;
@media only screen and (min-width: 420px) {
font-size: 1rem;
}
@media only screen and (min-width: 768px) {
text-align: left;
font-size: 1.1rem;
}
@media only screen and (min-width: 1024px) {
font-size: 1.3rem;
}
}
.npmicons {
text-align: center;
}
.text {
text-align: center;
padding-top: 10px;
@media only screen and (min-width: 768px) {
text-align: left;
}
}
hr {
margin-top: 40px;
margin-bottom: 0px;
border: 1px solid #ddd;
}
}
.index {
margin: 0 0 10px 0;
.text, .subtitle, .title, .title-small, .npmicons {
text-align: center;
.text,
.subtitle,
.title,
.title-small,
.npmicons {
text-align: center;
}
a {
text-decoration: none;
&:hover {
text-decoration: none;
&:hover {
text-decoration: none;
color: rgb(86, 122, 223);
}
color: rgb(86, 122, 223);
}
}
}
.left {
.text, .subtitle, .title, .title-small .npmicons {
text-align: left;
}
.text,
.subtitle,
.title,
.title-small .npmicons {
text-align: left;
}
}
.table {
text-align: left;
text-align: left;
}
ul {
text-align: left;
text-align: left;
}
.number-section {
margin-top: 40px;
text-align: center;
.numbers {
font-size: 2rem;
@media only screen and (min-width: 420px) {
font-size: 2.4rem;
}
@media only screen and (min-width: 768px) {
font-size: 2.8rem;
}
margin-top: 40px;
text-align: center;
.numbers {
font-size: 2rem;
@media only screen and (min-width: 420px) {
font-size: 2.4rem;
}
.title {
color: #999;
font-size: 1rem;
@media only screen and (min-width: 420px) {
font-size: 1.1rem;
}
@media only screen and (min-width: 768px) {
font-size: 1.2rem;
}
@media only screen and (min-width: 768px) {
font-size: 2.8rem;
}
}
.title {
color: #999;
font-size: 1rem;
@media only screen and (min-width: 420px) {
font-size: 1.1rem;
}
@media only screen and (min-width: 768px) {
font-size: 1.2rem;
}
}
}
.menu {
display: none;
@media only screen and (min-width: 768px) {
margin-top: 30px;
display: inline-block;
}
.title {
margin: 25px 0 5px 0;
color: #000;
a {
width: 100%;
color: #000;
text-decoration: none;
&:hover {
color: rgb(86, 122, 223);
}
}
}
hr {
margin: 5px 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
li {
padding: 2px 0;
a {
width: 100%;
color: #666;
text-decoration: none;
&:hover {
color: rgb(86, 122, 223);
}
}
&.active > a {
color: rgb(86, 122, 223);
}
}
}
}
.code {
font-family: Menlo, "dejavu sans mono", "lucida console", monospace;
-webkit-font-smoothing: antialiased;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: 400;
display: none;
@media only screen and (min-width: 768px) {
margin-top: 30px;
display: inline-block;
background-color: #eee;
margin: 0;
padding: 0 5px;
}
pre {
padding: 4px 10px 4px 10px;
font-family: Menlo, "dejavu sans mono", "lucida console", monospace;
-webkit-font-smoothing: antialiased;
font-size: 13px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 18px;
background-color: #eee;
width: 100%;
text-align: left;
}
.example {
td:first-child {
background-color: #fff !important;
}
td:last-child {
background-color: #f8faff !important;
}
h5 {
padding-top: 5px;
padding-left: 10px;
}
pre {
background-color: unset;
.js {
background-color: #f0f0f4;
}
.title {
margin: 25px 0 5px 0;
color: #000;
a {
width: 100%;
color: #000;
text-decoration: none;
&:hover {
color: rgb(86, 122, 223);
}
}
}
hr {
margin: 5px 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
li {
padding: 2px 0;
a {
width: 100%;
color: #666;
text-decoration: none;
&:hover {
color: rgb(86, 122, 223);
}
}
&.active > a {
color: rgb(86, 122, 223);
}
}
}
}
.code {
font-family: Menlo, "dejavu sans mono", "lucida console", monospace;
-webkit-font-smoothing: antialiased;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: 400;
display: inline-block;
background-color: #eee;
margin: 0;
padding: 0 5px;
}
pre {
padding: 4px 10px 4px 10px;
font-family: Menlo, "dejavu sans mono", "lucida console", monospace;
-webkit-font-smoothing: antialiased;
font-size: 13px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 18px;
background-color: #eee;
width: 100%;
text-align: left;
}
.example {
td:first-child {
background-color: #fff !important;
}
td:last-child {
background-color: #f8faff !important;
}
h5 {
padding-top: 5px;
padding-left: 10px;
}
pre {
background-color: unset;
.js {
background-color: #f0f0f4;
}
}
}
.footer {
background-color: #eee;
padding-top: 30px;
padding-bottom: 30px;
position: relative;
a {
color: #000;
}
.badge {
color: #fff;
font-size: 0.9rem;
}
background-color: #eee;
padding-top: 30px;
padding-bottom: 30px;
position: relative;
a {
color: #000;
}
.badge {
color: #fff;
font-size: 0.9rem;
}
}
.larger {
margin-top: 10px;
font-size: 1.5rem !important;
}
.v5 {
color:rgb(86, 122, 223);
color: rgb(86, 122, 223);
}

View File

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