Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function checkIfCompatible() {
try {
playButtonText.textContent = "Checking graphics hardware...";
const data = await si.graphics();
const identifier = ["nvidia", "advanced micro devices", "amd"]; // And so on...
for(let i = 0; i < data.controllers.length; i++){
const vendor = data.controllers[i].vendor.toLowerCase();
cardsModel.push(" " + data.controllers[i].model);
// Is incompatible if Intel is found in a substring
if(vendor.includes("intel")){
console.log("hardware is not compatible");
showIncompatiblePopup = true;
}
for(let n = 0; n < identifier.length; n++){
static async getScreens(): Promise {
const {displays} = await systemInfo.graphics();
console.log('Fetching Windows screens', displays);
return displays.map((display, i) => {
return {
index: i,
name: display.main ? 'Main screen' : 'Screen ' + i,
type: InputDeviceType.Screen,
resolution: {
x: Number(display.resolutionx),
y: Number(display.resolutiony),
},
offset: {
x: Number(display.positionX),
y: Number(display.positionY),
}
}
async setup() {
const [
graphics,
os,
cpu,
mem,
online,
] = await Promise.all([
si.graphics(),
si.osInfo(),
si.cpu(),
si.mem(),
isOnline(),
])
this._graphics = graphics
this.os = os
this.cpu = cpu
this.memory = mem
this.online = online
logger.info(`GPU devices: ${this.graphics.length}`)
logger.info(`RAM: ${this.memory.total} bytes.`)
logger.info(`Internet connection: ${this.online}`)
logger.debug(this)
export async function dynamicInfo(): Promise {
const osData = {
hostname: os.hostname(),
uptime: os.uptime(),
freemem: os.freemem(),
totalmem: os.totalmem(),
cpus: os.cpus(),
loadavg: os.loadavg()
}
const promises = [
si.battery(),
si.graphics(),
si.osInfo(),
si.fsSize(),
si.cpuTemperature()
];
const [battery, graphics, osInfo, fsSize, cpuTemp] = await Promise.all(promises);
return {
...osData,
battery,
graphics,
osInfo,
fsSize,
cpuTemp
};
}
async setup() {
const [
graphics,
cpu,
mem,
online,
] = await Promise.all([
si.graphics(),
si.cpu(),
si.mem(),
isOnline(),
])
this._graphics = graphics
this._cpu = cpu
this._memory = mem
this.online = online
}