diff --git a/.env.example b/.env.example index e3495bf..f23ac27 100644 --- a/.env.example +++ b/.env.example @@ -67,6 +67,13 @@ LAYOUT=modern # Only uncomment if you have your own proxy running # DXSPIDER_PROXY_URL=https://your-dxspider-proxy.com +# DX Cluster source: auto | proxy | hamqth | dxspider +# auto = tries proxy first, then HamQTH, then direct telnet +# proxy = use DX Spider Proxy (set DXSPIDER_PROXY_URL above) +# hamqth = HamQTH CSV feed (HTTP, works everywhere) +# dxspider = direct telnet to DX Spider nodes (works locally/Pi) +# DX_CLUSTER_SOURCE=auto + # OpenWeatherMap API key (for local weather display) # Get a free key at https://openweathermap.org/api # OPENWEATHER_API_KEY=your_api_key_here diff --git a/server.js b/server.js index e335222..c53244b 100644 --- a/server.js +++ b/server.js @@ -148,7 +148,7 @@ const CONFIG = { // DX Cluster settings spotRetentionMinutes: parseInt(process.env.SPOT_RETENTION_MINUTES) || jsonConfig.dxCluster?.spotRetentionMinutes || 30, - dxClusterSource: jsonConfig.dxCluster?.source || 'auto', + dxClusterSource: process.env.DX_CLUSTER_SOURCE || jsonConfig.dxCluster?.source || 'auto', // API keys (don't expose to frontend) _openWeatherApiKey: process.env.OPENWEATHER_API_KEY || '', @@ -983,7 +983,7 @@ let dxSpiderCache = { spots: [], timestamp: 0 }; const DXSPIDER_CACHE_TTL = 90000; // 90 seconds cache - reduces reconnection frequency app.get('/api/dxcluster/spots', async (req, res) => { - const source = (req.query.source || 'auto').toLowerCase(); + const source = (req.query.source || CONFIG.dxClusterSource || 'auto').toLowerCase(); // Helper function for HamQTH (HTTP-based, works everywhere) async function fetchHamQTH() { diff --git a/src/hooks/useDXCluster.js b/src/hooks/useDXCluster.js index 83a7303..571f1bb 100644 --- a/src/hooks/useDXCluster.js +++ b/src/hooks/useDXCluster.js @@ -89,7 +89,7 @@ export const useDXCluster = (source = 'auto', filters = {}) => { useEffect(() => { const fetchData = async () => { try { - const response = await fetch('/api/dxcluster/spots'); + const response = await fetch(`/api/dxcluster/spots?source=${encodeURIComponent(source)}`); if (response.ok) { const newSpots = await response.json();