This commit is contained in:
2025-09-27 00:30:45 -04:00
parent 97ae2a7811
commit c3d8893436
3 changed files with 15 additions and 4 deletions

View File

@@ -0,0 +1,7 @@
// Configuration for the frontend
const config = {
// Use services.btcforplebs.com in production, localhost in development
apiBaseUrl: window.location.hostname === 'localhost'
? 'http://localhost:5252'
: 'https://services.btcforplebs.com'
};

View File

@@ -4,7 +4,7 @@ let linkStatuses = {};
// Fetch statuses on page load
document.addEventListener('DOMContentLoaded', () => {
// Fetch statuses immediately but keep folders closed
fetch("https://services.btcforplebs.com/api/link-status")
fetch(`${config.apiBaseUrl}/api/link-status`)
.then(res => res.json())
.then(statuses => {
linkStatuses = statuses; // Store for later use
@@ -43,7 +43,7 @@ function toggleFolder(folderId, buttonId) {
if (Object.keys(linkStatuses).length > 0) {
updateFolderStatuses(folder, linkStatuses);
} else {
fetch("https://services.btcforplebs.com/api/link-status")
fetch(`${config.apiBaseUrl}/api/link-status`)
.then(res => res.json())
.then(statuses => {
linkStatuses = statuses;
@@ -60,7 +60,7 @@ async function init() {
try {
// Fetch the status first
console.log("Fetching statuses...");
const response = await fetch("https://services.btcforplebs.com/api/link-status");
const response = await fetch(`${config.apiBaseUrl}/api/link-status`);
const statuses = await response.json();
console.log("Got statuses:", statuses);