diff --git a/checklinks.js b/checklinks.js index fa89550..07224a9 100644 --- a/checklinks.js +++ b/checklinks.js @@ -14,7 +14,6 @@ const links = [ "https://nosotros.btcforplebs.com", "https://mint.btcforplebs.com", "https://cashu.btcforplebs.com", - "https://nostrapps.com", // Add more links as needed ]; diff --git a/config.js b/config.js index c15ff76..f46c4b6 100644 --- a/config.js +++ b/config.js @@ -2,14 +2,11 @@ module.exports = { port: process.env.PORT || 5252, // Add any other configuration variables here allowedOrigins: [ - 'http://localhost', - 'http://localhost:5252', - 'https://localhost', 'https://localhost:5252', + 'https://localhost:5252', + 'https://localhost:9000', + 'http://localhost:9000', 'https://btcforplebs.com', - 'https://www.btcforplebs.com', - 'http://btcforplebs.com', - 'http://www.btcforplebs.com', 'https://services.btcforplebs.com', 'http://services.btcforplebs.com' ] diff --git a/public/assets/js/home.js b/public/assets/js/home.js index 99a18d1..fe07336 100644 --- a/public/assets/js/home.js +++ b/public/assets/js/home.js @@ -1,35 +1,3 @@ -// Store statuses globally -let linkStatuses = {}; - -// Fetch statuses on page load -document.addEventListener('DOMContentLoaded', () => { - // Fetch statuses immediately but keep folders closed - fetch(`${config.apiBaseUrl}/api/link-status`) - .then(res => res.json()) - .then(statuses => { - linkStatuses = statuses; // Store for later use - console.log("Cached link statuses:", linkStatuses); - }) - .catch(error => console.error("Error:", error)); -}); - -// Helper function to update status emojis -function updateFolderStatuses(folder, statuses) { - folder.querySelectorAll("a").forEach(link => { - const url = link.href; - const matchingUrl = Object.keys(statuses).find(statusUrl => - url.includes(new URL(statusUrl).hostname) - ); - const status = matchingUrl ? statuses[matchingUrl] : "unknown"; - const emoji = status === "online" ? "🟢" : "🔴"; - - const statusSpan = link.querySelector('.status-emoji'); - if (statusSpan) { - statusSpan.textContent = emoji; - } - }); -} - function toggleFolder(folderId, buttonId) { const folder = document.getElementById(folderId); const button = document.getElementById(buttonId); @@ -39,54 +7,8 @@ function toggleFolder(folderId, buttonId) { folder.style.display = "block"; button.innerHTML = button.innerHTML.replace("↓", "↑"); - // Use cached statuses if available, otherwise fetch new ones - if (Object.keys(linkStatuses).length > 0) { - updateFolderStatuses(folder, linkStatuses); - } else { - fetch(`${config.apiBaseUrl}/api/link-status`) - .then(res => res.json()) - .then(statuses => { - linkStatuses = statuses; - updateFolderStatuses(folder, statuses); - }) - .catch(error => console.error("Error:", error)); - } } else { folder.style.display = "none"; button.innerHTML = button.innerHTML.replace("↑", "↓"); } -// Wait for both DOM and fetch to complete -async function init() { - try { - // Fetch the status first - console.log("Fetching statuses..."); - const response = await fetch(`${config.apiBaseUrl}/api/link-status`); - const statuses = await response.json(); - console.log("Got statuses:", statuses); - - // Now update the links - document.querySelectorAll(".links a").forEach(link => { - const url = link.href; - console.log('Checking link:', url); // Debug log - const matchingUrl = Object.keys(statuses).find(statusUrl => { - const linkHostname = new URL(url).hostname; - const statusHostname = new URL(statusUrl).hostname; - console.log('Comparing:', linkHostname, 'with', statusHostname); // Debug log - return linkHostname === statusHostname; - }); - console.log('Matching URL found:', matchingUrl); // Debug log - const status = matchingUrl ? statuses[matchingUrl] : "unknown"; - console.log('Status for', url, 'is', status); // Debug log - const emoji = status === "online" ? "🟢" : "🔴"; - - // Find the span inside this link and update it - const statusSpan = link.querySelector('.status-emoji'); - if (statusSpan) { - statusSpan.textContent = emoji; - } - }); - } catch (error) { - console.error("Error:", error); - } } -} \ No newline at end of file diff --git a/public/index.html b/public/index.html index 3e57b3a..411eee2 100644 --- a/public/index.html +++ b/public/index.html @@ -1,3 +1,5 @@ + +
@@ -19,6 +21,7 @@ + @@ -31,44 +34,103 @@
-
-
-
-
-
-
-
-
+
+Learn About Bitcoin
+Learn About Nostr
+Learn About Cashu
+Bitcoin & The Bible
+
+
+
+
+
+
+
+
+
+
+
+
BTCforPlebs Live