From 442b8a2a79f8c0c456892118ab9d8a06ac6e743e Mon Sep 17 00:00:00 2001 From: ImpulsiveFPS Date: Mon, 2 Feb 2026 13:28:15 +0100 Subject: [PATCH] Fix: Remove status checking to avoid SSL/CORS errors, simplify to static status --- index.html | 6 ++-- script.js | 90 +++++++++++------------------------------------------- 2 files changed, 20 insertions(+), 76 deletions(-) diff --git a/index.html b/index.html index e40d038..acab492 100644 --- a/index.html +++ b/index.html @@ -270,7 +270,7 @@
🍵

Gitea

Self-hosted Git service for code repositories

-
+
Checking...
@@ -286,7 +286,7 @@
🔧

IT-Tools

Handy tools for developers and IT professionals

-
+
Checking...
@@ -302,7 +302,7 @@
👾

Retro Arcade

Play classic DOS games including Doom! (Legally free)

-
+
Checking...
diff --git a/script.js b/script.js index ae2410c..77ee0ff 100644 --- a/script.js +++ b/script.js @@ -507,84 +507,28 @@ if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { /** - * Service Status Checker - Real-time health checks + * Service Status Checker - Simplified version + * Just shows static statuses to avoid SSL/CORS errors */ function initServiceStatusChecker() { - const statusElements = document.querySelectorAll('.service-status[data-status-url]'); + const publicServices = document.querySelectorAll('.service-card.public .service-status'); + const privateServices = document.querySelectorAll('.service-card.private-service .service-status'); - statusElements.forEach(element => { - const url = element.getAttribute('data-status-url'); - checkServiceHealth(element, url); - - // Check every 60 seconds - setInterval(() => checkServiceHealth(element, url), 60000); + // Public services show "Online" after a brief delay + publicServices.forEach((el, index) => { + setTimeout(() => { + el.className = 'service-status online'; + el.innerHTML = 'Online'; + }, 500 + (index * 200)); }); -} - -async function checkServiceHealth(element, url) { - const statusText = element.querySelector('.status-text'); - const originalText = statusText.textContent; - try { - // Try to fetch with a short timeout - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), 5000); - - const response = await fetch(url, { - method: 'HEAD', - mode: 'no-cors', - signal: controller.signal - }); - - clearTimeout(timeoutId); - - // If we get here, service is likely online - element.className = 'service-status online'; - statusText.textContent = 'Online'; - - } catch (error) { - // For no-cors requests, we can't read the response - // Try an alternative approach - image load test for same-origin - testViaImage(element, url, statusText); - } -} - -function testViaImage(element, url, statusText) { - // Extract domain from URL - const urlObj = new URL(url); - const testUrl = `${urlObj.protocol}//${urlObj.hostname}/favicon.ico`; - - const img = new Image(); - img.onload = () => { - element.className = 'service-status online'; - statusText.textContent = 'Online'; - }; - img.onerror = () => { - // Could be offline or just no favicon - // Check if it's a private/internal service - if (element.closest('.private-service')) { - element.className = 'service-status online'; - statusText.textContent = 'Restricted'; - } else { - element.className = 'service-status offline'; - statusText.textContent = 'Offline'; - } - }; - img.src = testUrl + '?t=' + Date.now(); - - // Timeout after 3 seconds - setTimeout(() => { - if (!img.complete) { - img.src = ''; - if (element.closest('.private-service')) { - element.className = 'service-status online'; - statusText.textContent = 'Restricted'; - } else { - element.className = 'service-status maintenance'; - statusText.textContent = 'Unknown'; - } - } - }, 3000); + // Private services show "Restricted" after a brief delay + privateServices.forEach((el, index) => { + setTimeout(() => { + el.className = 'service-status online'; + el.innerHTML = 'Restricted'; + }, 500 + (index * 200)); + }); } // Initialize status checker