Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async getEncryptionKey(): Promise {
const s = await system();
const c = await cpu();
const m = await mem();
const o = await osInfo();
return s.manufacturer + ';' + s.uuid + ';' + String(c.processors) + ';'
+ c.vendor + ';' + m.total + ';' + o.platform + ';' + o.release;
}
export const getSystemInformation = async () => {
return {
system: await systemInfo.system(),
time: systemInfo.time(),
cpu: await systemInfo.cpu(),
osInfo: await systemInfo.osInfo(),
package: {
name: pkg.name,
version: pkg.version,
repository: pkg.repository,
author: pkg.author,
"staart-version": pkg["staart-version"]
}
};
};
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)
}
async function systeminfo() {
const info = {};
await Promise.all([
si.battery().then(r => info.battery = r),
si.cpu().then(r => info.cpu = r),
si.osInfo().then(r => info.osInfo = r),
]);
return info;
}
function diskInfo()
{
diskspace.check('/', function(err, total, free, status)
{
var used = total-free
dUsed = (used / 1000000000).toFixed(1)
dTotal = (total / 1000000000).toFixed(1) + "GB"
diskBar.animate( used / total );
});
}
diskInfo()
setInterval(diskInfo, prop.diskDuration)
//System info
si.osInfo(function(sys)
{
$(".system-info ul").append($("<li>").append("Hostname: " + os.hostname()))
$(".system-info ul").append($("</li><li>").append("Platform: " + os.platform() + os.arch()))
$(".system-info ul").append($("</li><li>").append("Distribution: " + sys.distro ))
$(".system-info ul").append($("</li><li>").append("Total RAM: " + prettySize( os.totalmem() ) + " GB"))
$(".system-info ul").append($("</li><li>").append("CPU Model: " + os.cpus()[0].model))
$(".system-info ul").append($("</li><li>").append("CPU Cores: " + os.cpus().length))
})
}
</li>