try catch neofetch

This commit is contained in:
MeexReay 2025-05-25 15:20:13 +03:00
parent 3911454188
commit c2ba9da433
3 changed files with 23 additions and 9 deletions

View File

@ -69,7 +69,6 @@ async function draw() {
if (found_color) {
ctx.fillStyle = color_before;
ctx.fillText(buffer, x, y);
console.log(x, y, buffer)
color_before = color
x += buffer.length * CHAR_WIDTH
buffer = ""
@ -81,8 +80,6 @@ async function draw() {
ctx.fillStyle = color_before;
ctx.fillText(buffer, x, y);
console.log(x, y, buffer)
y -= CHAR_HEIGHT
}
}

View File

@ -32,10 +32,27 @@ function getDiskInfo() {
// Function to get CPU, GPU, and memory information
function getSystemInfo() {
const cpuInfo = navigator.hardwareConcurrency;
const cpuInfo = (() => {try {
return navigator.hardwareConcurrency
} catch (e) {
return 1
}})()
const memoryInfo = navigator.deviceMemory;
const totalJSHeap = performance.memory.totalJSHeapSize / (1024 * 1024);
const memoryInfo = (() => {
try {
return navigator.deviceMemory
} catch (e) {
return 8
}
})()
const totalJSHeap = (() => {
try {
return performance.memory.totalJSHeapSize / (1024 * 1024)
} catch (e) {
return 1
}
})();
const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
@ -53,8 +70,8 @@ function getSystemInfo() {
return [
cpuInfo + " cores",
memoryInfo ? memoryInfo * 1024 + ' MB' : 'Not supported',
totalJSHeap.toFixed(2) + ' MB',
memoryInfo ? memoryInfo * 1024 + 'MB' : '8096MB',
totalJSHeap.toFixed(2) + 'MB',
gpuInfo ? `${gpuInfo.renderer}` : 'Poshlosti GGraphics 1.0.233'
]
}

View File

@ -1,6 +1,6 @@
{
"name": "neofetch",
"version": "0.1.3",
"version": "0.1.4",
"description": "neofetch damn",
"author": "MeexReay",
"apps": [ "neofetch.js" ],