Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions server/routes/space-weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,20 @@ module.exports = function (app, ctx) {
}

// Kp forecast — same format change; forecast uses lowercase 'kp' field.
// The endpoint mixes past observations with future predictions; keep only
// entries whose time_tag is in the future so the chart shows predictions.
if (kForecastRes.status === 'fulfilled' && kForecastRes.value.ok) {
const data = await kForecastRes.value.json();
if (data?.length) {
const isObj = !Array.isArray(data[0]);
const rows = isObj ? data : data.slice(1);
result.kp.forecast = rows.map((d) => ({
time: isObj ? d.time_tag : d[0],
value: Number.isFinite(isObj ? d.kp : parseFloat(d[1])) ? (isObj ? d.kp : parseFloat(d[1])) : 0,
}));
const nowIso = new Date().toISOString();
result.kp.forecast = rows
.filter((d) => (isObj ? d.time_tag : d[0]) > nowIso)
.map((d) => ({
time: isObj ? d.time_tag : d[0],
value: Number.isFinite(isObj ? d.kp : parseFloat(d[1])) ? (isObj ? d.kp : parseFloat(d[1])) : 0,
}));
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/PropagationPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ export const PropagationPanel = ({
{/* Geomag + Signal Noise + Source */}
<div style={{ marginTop: '4px', fontSize: '10px', color: 'var(--text-muted)', textAlign: 'center' }}>
<span>
SFI {solarData?.sfi} • K {solarData?.kIndex}
SFI {bandConditions?.extras?.solarFlux ?? solarData?.sfi} • K{' '}
{bandConditions?.extras?.kIndex ?? solarData?.kIndex}
</span>
{bandConditions?.extras?.geomagField && (
<span>
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useBandConditions.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export const useBandConditions = () => {

// Extra solar/geomag data from N0NBH
setExtras({
solarFlux: n0nbh.solarData?.solarFlux,
kIndex: n0nbh.solarData?.kIndex,
aIndex: n0nbh.solarData?.aIndex,
xray: n0nbh.solarData?.xray,
solarWind: n0nbh.solarData?.solarWind,
Expand Down
15 changes: 7 additions & 8 deletions src/plugins/layers/useLightning.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { addMinimizeToggle } from './addMinimizeToggle.js';
import { makeDraggable } from './makeDraggable.js';
import { getAlertSettings, playTone } from '../../utils/audioAlerts';

// Lightning Detection Plugin - Real-time lightning strike visualization
// Data source: Blitzortung.org WebSocket API
Expand Down Expand Up @@ -616,14 +617,12 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null, lowMemory
panel.style.boxShadow = '0 0 20px rgba(255, 0, 0, 0.8)';
panel.style.transition = 'all 0.3s ease';

// Play alert sound if available
try {
const audio = new Audio(
'data:audio/wav;base64,UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhYqFbF1fdJivrJBhNjVgodDbq2EcBj+a2/LDciUFLIHO8tiJNwgZaLvt559NEAxQp+PwtmMcBjiR1/LMeSwFJHfH8N2QQAoUXrTp66hVFApGn+DyvmwhBTGH0fPTgjMGHm7A7+OZRAEKT6Ln77BcGAU+ltryxnMnBSp+y/HajDkHGWi77eWdTQ0MUKfj8LZjHAY4kdfy',
);
audio.volume = 0.3;
audio.play().catch(() => {}); // Ignore errors if audio fails
} catch (e) {}
// Play alert tone via audio alerts system (if enabled in settings)
const alertSettings = getAlertSettings();
const lightningConf = alertSettings.lightning;
if (lightningConf?.enabled) {
playTone(lightningConf.tone, alertSettings.volume ?? 0.5);
}
} else {
// No nearby strikes - restore normal appearance
panel.style.border = '1px solid var(--border-color)';
Expand Down
1 change: 1 addition & 0 deletions src/utils/audioAlerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ALERT_FEEDS = {
dxcluster: { label: 'DX Cluster', defaultTone: 'beep' },
dxpeditions: { label: 'DXpeditions', defaultTone: 'two-tone' },
contests: { label: 'Contests', defaultTone: 'simple' },
lightning: { label: 'Lightning Proximity', defaultTone: 'chirp' },
};

const LS_KEY = 'ohc_audio_alerts';
Expand Down