Fix runtime errors: PerformanceObserver, localStorage, crypto.randomUUID, hydration issues, and linting errors

This commit is contained in:
2026-01-10 16:54:28 +01:00
parent ca2ed13446
commit a980ee8fcd
8 changed files with 22 additions and 23 deletions

View File

@@ -28,18 +28,18 @@ export default function KernelPanic404() {
let audioCtx: AudioContext | null = null;
let systemFrozen = false;
let currentMusic: any = null;
let currentMusic: AudioBufferSourceNode | null = null;
let hawkinsActive = false;
let fsocietyActive = false;
// Timers storage to clear on unmount
const timers: (NodeJS.Timeout | number)[] = [];
const interval = (fn: Function, ms: number) => {
const interval = (fn: () => void, ms: number) => {
const id = setInterval(fn, ms);
timers.push(id);
return id;
};
const timeout = (fn: Function, ms: number) => {
const timeout = (fn: () => void, ms: number) => {
const id = setTimeout(fn, ms);
timers.push(id);
return id;
@@ -49,7 +49,7 @@ export default function KernelPanic404() {
function initAudio() {
if (!audioCtx) {
const AudioContextClass =
window.AudioContext || (window as any).webkitAudioContext;
window.AudioContext || (window as typeof window & { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;
if (AudioContextClass) {
audioCtx = new AudioContextClass();
}
@@ -444,6 +444,7 @@ export default function KernelPanic404() {
}
/* --- FILE SYSTEM --- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const fileSystem: any = {
home: {
type: "dir",
@@ -551,7 +552,7 @@ export default function KernelPanic404() {
let currentPath = fileSystem.home.children.guest;
let pathStr = "~";
let commandHistory: string[] = [];
const commandHistory: string[] = [];
let historyIndex = -1;
/* --- UTILS --- */
@@ -671,7 +672,7 @@ export default function KernelPanic404() {
// Clear initial output
output!.innerHTML = "";
for (let msg of bootMessages) {
for (const msg of bootMessages) {
printLine(msg.t, msg.type);
await sleep(msg.d);
}
@@ -794,7 +795,7 @@ export default function KernelPanic404() {
if (suggestions.length === 0) {
try {
playSynth("beep");
} catch (e) {}
} catch {}
return;
}
@@ -817,13 +818,13 @@ export default function KernelPanic404() {
input.setSelectionRange(input.value.length, input.value.length);
try {
playSynth("beep");
} catch (e) {}
} catch {}
} else {
// Multiple matches
printLine(`Possible completions: ${suggestions.join(" ")}`, "log-dim");
try {
playSynth("beep");
} catch (e) {}
} catch {}
}
}
@@ -832,7 +833,7 @@ export default function KernelPanic404() {
if (systemFrozen || !input) {
try {
playSynth("beep");
} catch (e) {}
} catch {}
return;
}
@@ -871,7 +872,7 @@ export default function KernelPanic404() {
args.includes("-a") || args.includes("-la") || args.includes("-l");
const longFormat = args.includes("-l") || args.includes("-la");
let items = Object.keys(currentPath.children).filter(
const items = Object.keys(currentPath.children).filter(
(n) => !n.startsWith(".") || showHidden,
);
@@ -1177,7 +1178,7 @@ export default function KernelPanic404() {
overlay.style.display = "none";
overlay.innerHTML = "";
const sporeInterval = interval(() => {
const _sporeInterval = interval(() => {
const spore = document.createElement("div");
spore.className = "spore";
spore.style.left = Math.random() * 100 + "%";
@@ -1187,7 +1188,7 @@ export default function KernelPanic404() {
setTimeout(() => spore.remove(), 3000);
}, 300);
const glitchInterval = interval(() => {
const _glitchInterval = interval(() => {
if (!hawkinsActive) return;
body.style.filter = "hue-rotate(180deg) contrast(1.3) brightness(0.9)";
setTimeout(
@@ -1412,7 +1413,7 @@ export default function KernelPanic404() {
try {
playSynth("key");
} catch (e) {}
} catch {}
if (e.key === "ArrowUp" && historyIndex > 0) {
historyIndex--;

View File

@@ -2,7 +2,7 @@
import { useState, useEffect } from "react";
import { motion, Variants } from "framer-motion";
import { ExternalLink, Github, Layers, ArrowRight, ArrowLeft, Calendar } from "lucide-react";
import { ExternalLink, Github, ArrowRight, Calendar } from "lucide-react";
import Link from "next/link";
import Image from "next/image";