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++){
export async function legacyJsonOutput(results: BenchmarkResult[]):
Promise {
// TODO Add git info.
const battery = await systeminformation.battery();
const cpu = await systeminformation.cpu();
const currentLoad = await systeminformation.currentLoad();
const memory = await systeminformation.mem();
return {
benchmarks: results,
datetime: new Date().toISOString(),
system: {
cpu: {
manufacturer: cpu.manufacturer,
model: cpu.model,
family: cpu.family,
speed: cpu.speed,
cores: cpu.cores,
},
load: {
average: currentLoad.avgload,
current: currentLoad.currentload,
},
battery: {
export async function legacyJsonOutput(results: BenchmarkResult[]):
Promise {
// TODO Add git info.
const battery = await systeminformation.battery();
const cpu = await systeminformation.cpu();
const currentLoad = await systeminformation.currentLoad();
const memory = await systeminformation.mem();
return {
benchmarks: results,
datetime: new Date().toISOString(),
system: {
cpu: {
manufacturer: cpu.manufacturer,
model: cpu.model,
family: cpu.family,
speed: cpu.speed,
cores: cpu.cores,
},
load: {
average: currentLoad.avgload,
current: currentLoad.currentload,
export async function legacyJsonOutput(results: BenchmarkResult[]):
Promise {
// TODO Add git info.
const battery = await systeminformation.battery();
const cpu = await systeminformation.cpu();
const currentLoad = await systeminformation.currentLoad();
const memory = await systeminformation.mem();
return {
benchmarks: results,
datetime: new Date().toISOString(),
system: {
cpu: {
manufacturer: cpu.manufacturer,
model: cpu.model,
family: cpu.family,
speed: cpu.speed,
cores: cpu.cores,
},
load: {
average: currentLoad.avgload,
current: currentLoad.currentload,
},
api.get('/cpu/usage', function(req, res) { // CPU Usage % (cpu/usage)
si.currentLoad()
.then(data => res.send(data.currentload.toString()))
.catch(error => res.status(404).send(siError))
})
function updateSi() { // Gather params
var sysInfo = {cpu:0,mem:0,temp:0};
si.currentLoad(function(data) {
sysInfo.cpu = data.currentload;
si.mem(function(data) {
sysInfo.mem = (data.active/data.total)*100;
si.cpuTemperature(function(data) {
sysInfo.temp = data.main;
systemMonitor.system.cpu = sysInfo.cpu.toPrecision(3).toString() + ' %';
systemMonitor.system.mem = sysInfo.mem.toPrecision(2).toString() + ' %';
systemMonitor.system.temp = sysInfo.temp.toPrecision(3).toString() + ' °C';
systemMonitor.system.ip = ip.address();
});
});
});
api.get('/network/receive/:interface', function(req, res) {
let interface = req.params.interface
si.networkStats(interface)
.then(data => res.send((data[0].rx_sec / 125) + '')) // Total data received in kilobits/second (network/recieve/[interface])
.catch(error => res.status(404).send(siError))
})
setInterval(() => {
// get upload speed
si.networkStats(defaultNetwork, data => {
let speed = Math.abs(data.tx_sec / 1024).toFixed(2)
this.upSpeed = speed > 0 ? speed : 0
// up bar update
max = max < this.upSpeed ? this.upSpeed : max
let percent = this.upSpeed / max < 1 ? this.upSpeed / max : 1
upBar.animate(percent)
})
}, 1000)
})
setInterval(() => {
// get down speed
si.networkStats(defaultNetwork, data => {
let speed = Math.abs(data.rx_sec / 1024).toFixed(2)
this.downSpeed = speed > 0 ? speed : 0
// down bar update
max = max < this.downSpeed ? this.downSpeed : max
let percent = this.downSpeed / max < 1 ? this.downSpeed / max : 1
downBar.animate(percent)
})
}, 1000)
})
api.get('/sys/model', function(req, res) { // Device Model (sys/model)
si.system()
.then(data => res.send('\"' + data.model.toString() + '\"'))
.catch(error => res.status(404).send(siError))
})
api.get('/sys/os', function(req, res) { // Device OS (sys/os)