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

View File

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

View File

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