From c2ba9da4338852e6cd27f2df78fd77093e0726f6 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Sun, 25 May 2025 15:20:13 +0300 Subject: [PATCH] try catch neofetch --- app/mxwm/zterm.js | 3 --- app/neofetch/neofetch.js | 27 ++++++++++++++++++++++----- app/neofetch/package.json | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/mxwm/zterm.js b/app/mxwm/zterm.js index 8a49add..af34114 100644 --- a/app/mxwm/zterm.js +++ b/app/mxwm/zterm.js @@ -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 } } diff --git a/app/neofetch/neofetch.js b/app/neofetch/neofetch.js index 297e346..b53fcb4 100644 --- a/app/neofetch/neofetch.js +++ b/app/neofetch/neofetch.js @@ -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' ] } diff --git a/app/neofetch/package.json b/app/neofetch/package.json index dbd1263..4c03cc3 100644 --- a/app/neofetch/package.json +++ b/app/neofetch/package.json @@ -1,6 +1,6 @@ { "name": "neofetch", - "version": "0.1.3", + "version": "0.1.4", "description": "neofetch damn", "author": "MeexReay", "apps": [ "neofetch.js" ],