From 9fd801ea69031db5f848be64d93ee6fbc92d6852 Mon Sep 17 00:00:00 2001 From: Gregory Salaun Date: Tue, 11 Aug 2026 18:11:09 +0200 Subject: [PATCH] fix(bandopen): stop subscribing to a band nobody watches, and drop the toast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A saved band selection outlives the code that made it. 12 m was removed from the watched set, but every operator who had already enabled the watch kept subscribing to it — paying for a firehose whose messages the detector then threw away. The stored list is filtered against the offered one now. The badge appeared on the next poll rather than on the event, up to twenty seconds after the announcement, so the two read as unrelated things that happened to mention the same band. It appears immediately. And the toast is gone. It said the same thing as the badge and vanished after five seconds — an operator who was tuning when it passed had no way back to it, which is precisely what the badge was built to fix. Keeping both announced an opening twice and still lost it once. --- bandopen_sources.go | 19 +++++++++++++++++++ changelog.json | 4 ++-- frontend/src/App.tsx | 15 ++++++++++----- frontend/src/lib/i18n.tsx | 4 ++-- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/bandopen_sources.go b/bandopen_sources.go index 614985d..424c439 100644 --- a/bandopen_sources.go +++ b/bandopen_sources.go @@ -51,12 +51,31 @@ func (a *App) GetBandOpenSettings() BandOpenSettings { Bands: splitCSV(a.settingOr(keyBandOpenBands, "")), Available: pskr.Bands, } + // Keep only bands that are still offered. A saved selection outlives the code + // that made it: 12 m was dropped from the watched set, but every operator who + // had already enabled the watch kept subscribing to it — paying for a firehose + // whose messages the detector then threw away. + s.Bands = keepKnownBands(s.Bands) if len(s.Bands) == 0 { s.Bands = append(s.Bands, pskr.Bands...) } return s } +func keepKnownBands(want []string) []string { + ok := make(map[string]bool, len(pskr.Bands)) + for _, b := range pskr.Bands { + ok[b] = true + } + out := make([]string, 0, len(want)) + for _, b := range want { + if ok[strings.ToLower(strings.TrimSpace(b))] { + out = append(out, b) + } + } + return out +} + func (a *App) SaveBandOpenSettings(s BandOpenSettings) error { a.setSetting(keyBandOpenEnabled, map[bool]string{true: "1", false: "0"}[s.Enabled]) a.setSetting(keyBandOpenBands, strings.Join(s.Bands, ",")) diff --git a/changelog.json b/changelog.json index e227044..d69c245 100644 --- a/changelog.json +++ b/changelog.json @@ -7,7 +7,7 @@ "CW over CAT now works on a Kenwood. The KY command was sent in Elecraft's variable-length form; a Kenwood needs exactly 24 characters, so every message was refused.", "Shared CAT is steadier and now diagnoses itself. It survives a rig answering \"busy\" just after transmit instead of dropping the link, stops repeating a PTT state the client never changed, and logs a plain explanation when another program has taken its port or when a client is set to a rig model instead of Hamlib NET rigctl. It also answers the lock-mode and stop-morse commands some clients send around every transmit, instead of refusing them.", "Web publishing now offers every field a QSO carries, awards included — 123 instead of 23 — from a searchable dropdown, with the chosen columns listed above it in publication order. Choose carefully: the page is public and the list includes addresses and e-mail.", - "Band-opening detection now works on the bands it was meant for. Switching on \"Watch for band openings\" (Settings › DX Cluster) subscribes to the PSK Reporter feed and adds the two RBN nodes it needs — it was reading a handful of VHF cluster spots while thousands of stations were reporting. It watches 10, 6, 4 and 2 m, counts only reports collected within 300 km of you so an opening means an opening HERE, no longer throws away paths beyond 2400 km, and looks for the busiest direction instead of demanding that every station heard sit in one sector. An opening under way shows as a blinking badge beside the clock — band, direction and typical distance, with a mark when it is unusual for the season — and stays until the band goes quiet, and the direction it names is right — a sector crossing north used to be announced as its opposite.", + "Band-opening detection now works on the bands it was meant for. Switching on \"Watch for band openings\" (Settings › DX Cluster) subscribes to the PSK Reporter feed and adds the two RBN nodes it needs — it was reading a handful of VHF cluster spots while thousands of stations were reporting. It watches 10, 6, 4 and 2 m, counts only reports collected within 300 km of you so an opening means an opening HERE, no longer throws away paths beyond 2400 km, and looks for the busiest direction instead of demanding that every station heard sit in one sector. An opening under way shows as a blinking badge beside the clock the moment it is found — band, direction and typical distance, with a mark when it is unusual for the season — and stays until the band goes quiet, and the direction it names is right — a sector crossing north used to be announced as its opposite.", "Test connection now actually tests. Club Log checked that the three fields were not empty and reported success without contacting anyone, so a wrong password looked exactly like a right one; it now signs in for real, through the read-only endpoint so a test can never add a record. LoTW reports its two credentials separately: TQSL signs uploads and never uses the website password, so a wrong one used to break nothing until the day confirmations were downloaded.", "The Ultrabeam / SteppIR widget in Station Control can now drive the antenna, not just describe it: a button per configured band tunes it there, up and down move it 25 kHz at a time, and tracking can be switched on or off with its 25 / 50 / 100 kHz threshold beside it. The band you are on lights up, and the commanded frequency is shown in the header.", "The QSO filter can express a real question. Every condition was joined by one global AND or OR, so \"2 m or 70 cm, in FT8, since January\" had no form: AND killed the two bands, OR let every FT8 QSO through. Two operators — is one of / is none of — take a comma-separated list, so the OR sits inside one condition and the rest keeps ANDing.", @@ -18,7 +18,7 @@ "Le CW par CAT fonctionne sur Kenwood. La commande KY partait sous la forme Elecraft à longueur libre ; un Kenwood exige exactement 24 caractères, donc chaque message était refusé.", "Le CAT partagé est plus solide et se diagnostique tout seul. Il survit à un rig qui répond « occupé » juste après une émission au lieu de lâcher le lien, cesse de répéter un état PTT que le client n a pas changé, et écrit une explication claire quand un autre programme lui a pris son port ou qu un client est réglé sur un modèle de rig au lieu de Hamlib NET rigctl. Il répond aussi aux commandes de verrouillage et d arrêt du morse que certains logiciels envoient à chaque émission, au lieu de les refuser.", "La publication web propose désormais tous les champs d un QSO, awards compris — 123 au lieu de 23 — depuis une liste déroulante cherchable, les colonnes choisies étant listées au-dessus dans l ordre de publication. À choisir avec soin : la page est publique et la liste contient adresses et e-mails.", - "La détection d ouverture de bande fonctionne enfin sur les bandes visées. Activer « Surveiller les ouvertures de bande » (Paramètres › Cluster DX) souscrit au flux PSK Reporter et ajoute les deux nœuds RBN nécessaires — elle lisait quelques spots VHF du cluster alors que des milliers de stations rapportaient. Elle surveille le 10, 6, 4 et 2 m, ne retient que les reports collectés à moins de 300 km de toi pour qu une ouverture veuille dire une ouverture ICI, ne jette plus les chemins au-delà de 2400 km, et cherche la direction la plus dense au lieu d exiger que toutes les stations entendues soient dans un même secteur. Une ouverture en cours s affiche en pastille clignotante à côté de l heure — bande, direction et distance typique, avec une marque si elle est inhabituelle pour la saison — et y reste jusqu à ce que la bande se taise, et la direction annoncée est juste — un secteur traversant le nord était auparavant annoncé à l opposé.", + "La détection d ouverture de bande fonctionne enfin sur les bandes visées. Activer « Surveiller les ouvertures de bande » (Paramètres › Cluster DX) souscrit au flux PSK Reporter et ajoute les deux nœuds RBN nécessaires — elle lisait quelques spots VHF du cluster alors que des milliers de stations rapportaient. Elle surveille le 10, 6, 4 et 2 m, ne retient que les reports collectés à moins de 300 km de toi pour qu une ouverture veuille dire une ouverture ICI, ne jette plus les chemins au-delà de 2400 km, et cherche la direction la plus dense au lieu d exiger que toutes les stations entendues soient dans un même secteur. Une ouverture en cours s affiche en pastille clignotante à côté de l heure dès qu elle est détectée — bande, direction et distance typique, avec une marque si elle est inhabituelle pour la saison — et y reste jusqu à ce que la bande se taise, et la direction annoncée est juste — un secteur traversant le nord était auparavant annoncé à l opposé.", "Le bouton Tester la connexion teste vraiment. Club Log vérifiait que les trois champs n étaient pas vides et annonçait la réussite sans contacter personne : un mauvais mot de passe ressemblait exactement à un bon. Il s authentifie maintenant pour de vrai, via le point d accès en lecture seule pour qu un test ne puisse jamais ajouter un enregistrement. LoTW annonce ses deux identifiants séparément : TQSL signe les envois et n utilise jamais le mot de passe du site, donc un mauvais ne cassait rien jusqu au jour du téléchargement des confirmations.", "Le widget Ultrabeam / SteppIR de Station Control pilote enfin l antenne au lieu de seulement la décrire : un bouton par bande configurée l accorde dessus, haut et bas la déplacent par pas de 25 kHz, et le suivi s active ou se coupe avec son seuil de 25 / 50 / 100 kHz à côté. La bande courante s allume, et la fréquence commandée s affiche dans l en-tête.", "Le filtre des QSO sait exprimer une vraie question. Toutes les conditions étaient jointes par un seul ET ou OU global, donc « 2 m ou 70 cm, en FT8, depuis janvier » n avait aucune forme : le ET tuait les deux bandes, le OU laissait passer tous les QSO FT8. Deux opérateurs — est parmi / n est pas parmi — acceptent une liste séparée par des virgules, le OU tient donc dans une seule condition et le reste continue de se combiner en ET.", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 954904e..2b84ff0 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2126,13 +2126,18 @@ export default function App() { useEffect(() => { const off = EventsOn('bandopen:detected', (o: any) => { if (!o?.band) return; - const season = o.in_season ? '' : ` — ${t('bmp.openUnusual')}`; - showToast(`📡 ${t('bmp.openToast', { - band: String(o.band).toUpperCase(), n: o.calls, km: o.median_km, - })}${season}`); + // The badge appears on the EVENT, not on the next poll. It used to wait for + // one, so the announcement and the badge were up to twenty seconds apart and + // read as two unrelated things happening to mention the same band. + // + // No toast any more: the badge says the same thing and does not vanish after + // five seconds. An operator who was tuning when the toast passed had no way + // back to it, which is exactly what the badge was built to fix — keeping + // both meant announcing an opening twice and still losing it once. + setLiveOpenings((cur) => [...cur.filter((x: any) => x.band !== o.band), o]); }); return () => { off(); }; - }, [showToast, t]); + }, []); // DX-cluster spot alerts: a matched rule fires here. Play a beep (WebAudio, no // asset needed — CSP-safe) and/or show a toast, per the rule's chosen actions. diff --git a/frontend/src/lib/i18n.tsx b/frontend/src/lib/i18n.tsx index 61e335d..9e4bd62 100644 --- a/frontend/src/lib/i18n.tsx +++ b/frontend/src/lib/i18n.tsx @@ -347,7 +347,7 @@ const en: Dict = { 'bmp.statusWorked': 'Worked (this band + mode already in log)', 'bmp.statusUnresolved': 'Entity not resolved', 'bmp.bandMap': 'Band map', 'bmp.notConfigured': 'Not configured for {band}.', 'bmp.map': 'Map', 'bmp.zoomOut': 'Zoom out', 'bmp.zoomIn': 'Zoom in', 'bmp.scrollToRig': 'Scroll to current rig frequency', 'bmp.moveLeft': 'Move band map to the left', 'bmp.moveRight': 'Move band map to the right', 'bmp.hide': 'Hide band map', 'bmp.bandsLabel': 'Bands:', 'bmp.fit': 'FIT', 'bmp.hideFt': 'Hide FTx', 'bmp.hideFtTitle': 'Hide all digital (FT8/FT4/JS8/…) spots on every band map', 'bmp.fitBand': 'Fit to band', 'bmp.widthTip': 'Drag to resize — double-click to reset', 'bmp.fitTitle': 'Size each band map to show the whole band edge-to-edge', - 'bmp.legendNewDxcc': 'New DXCC', 'bmp.legendNewBand': 'New band', 'bmp.legendNewSlot': 'New slot (mode)', 'bmp.openToast': '{band} is open — {n} stations around {km} km', 'bmp.openUnusual': 'unusual for the season', 'bmp.legendWorked': 'Worked', 'bmp.legendNewPota': 'New POTA', 'bmp.legendNewCounty': 'New county', 'bmp.legendWorkedCall': 'Callsign already worked', 'bmp.legendCW': 'CW', 'bmp.legendData': 'Data', 'bmp.legendPhone': 'Phone', 'bmp.footerHint': 'scroll · ctrl+wheel = zoom · ◎ = jump to rig', 'bmp.spotsHidden': '{n} FT8/FT4 spots hidden — top {max} kept (CW/SSB all shown)', + 'bmp.legendNewDxcc': 'New DXCC', 'bmp.legendNewBand': 'New band', 'bmp.legendNewSlot': 'New slot (mode)', 'bmp.openUnusual': 'unusual for the season', 'bmp.legendWorked': 'Worked', 'bmp.legendNewPota': 'New POTA', 'bmp.legendNewCounty': 'New county', 'bmp.legendWorkedCall': 'Callsign already worked', 'bmp.legendCW': 'CW', 'bmp.legendData': 'Data', 'bmp.legendPhone': 'Phone', 'bmp.footerHint': 'scroll · ctrl+wheel = zoom · ◎ = jump to rig', 'bmp.spotsHidden': '{n} FT8/FT4 spots hidden — top {max} kept (CW/SSB all shown)', 'frm.welcome': 'Welcome to OpsLog', 'frm.intro': 'Set up your station to start logging. These fields stamp every QSO and can be changed later in Preferences → Station Information (and per profile).', 'frm.callsign': 'Callsign', 'frm.locator': 'Locator', 'frm.operator': 'Operator', 'frm.operatorPh': 'same as callsign', 'frm.owner': 'Owner', 'frm.ownerPh': 'station owner callsign', 'frm.name': 'Name', 'frm.namePh': 'your first name', 'frm.awardRefs': 'Award reference lists', 'frm.awardRefsHint': 'IOTA · POTA · WWFF · SOTA — names & totals for those awards (optional, can take a minute).', 'frm.downloading': 'Downloading…', 'frm.reDownload': 'Re-download', 'frm.download': 'Download', 'frm.required': 'Callsign and locator are required.', 'frm.saving': 'Saving…', 'frm.startLogging': 'Start logging', @@ -759,7 +759,7 @@ const fr: Dict = { 'bmp.statusWorked': 'Contacté (cette bande + mode déjà au log)', 'bmp.statusUnresolved': 'Entité non résolue', 'bmp.bandMap': 'Carte de bande', 'bmp.notConfigured': 'Non configurée pour {band}.', 'bmp.map': 'Carte', 'bmp.zoomOut': 'Dézoomer', 'bmp.zoomIn': 'Zoomer', 'bmp.scrollToRig': 'Aller à la fréquence actuelle du poste', 'bmp.moveLeft': 'Déplacer la carte de bande à gauche', 'bmp.moveRight': 'Déplacer la carte de bande à droite', 'bmp.hide': 'Masquer la carte de bande', 'bmp.bandsLabel': 'Bandes :', 'bmp.fit': 'FIT', 'bmp.hideFt': 'Masquer FTx', 'bmp.hideFtTitle': 'Masquer tous les spots numériques (FT8/FT4/JS8/…) sur toutes les cartes', 'bmp.fitBand': 'Ajuster à la bande', 'bmp.widthTip': 'Glisser pour redimensionner — double-clic pour réinitialiser', 'bmp.fitTitle': 'Dimensionner chaque carte pour afficher toute la bande', - 'bmp.legendNewDxcc': 'Nouveau DXCC', 'bmp.legendNewBand': 'Nouvelle bande', 'bmp.legendNewSlot': 'Nouveau mode', 'bmp.openToast': 'Ouverture {band} — {n} stations vers {km} km', 'bmp.openUnusual': 'inhabituel pour la saison', 'bmp.legendWorked': 'Contacté', 'bmp.legendNewPota': 'Nouveau POTA', 'bmp.legendNewCounty': 'Nouveau comté', 'bmp.legendWorkedCall': 'Indicatif déjà contacté', 'bmp.legendCW': 'CW', 'bmp.legendData': 'Numérique', 'bmp.legendPhone': 'Phonie', 'bmp.footerHint': 'défiler · ctrl+molette = zoom · ◎ = aller au poste', 'bmp.spotsHidden': '{n} spots FT8/FT4 masqués — {max} meilleurs conservés (CW/SSB tous affichés)', + 'bmp.legendNewDxcc': 'Nouveau DXCC', 'bmp.legendNewBand': 'Nouvelle bande', 'bmp.legendNewSlot': 'Nouveau mode', 'bmp.openUnusual': 'inhabituel pour la saison', 'bmp.legendWorked': 'Contacté', 'bmp.legendNewPota': 'Nouveau POTA', 'bmp.legendNewCounty': 'Nouveau comté', 'bmp.legendWorkedCall': 'Indicatif déjà contacté', 'bmp.legendCW': 'CW', 'bmp.legendData': 'Numérique', 'bmp.legendPhone': 'Phonie', 'bmp.footerHint': 'défiler · ctrl+molette = zoom · ◎ = aller au poste', 'bmp.spotsHidden': '{n} spots FT8/FT4 masqués — {max} meilleurs conservés (CW/SSB tous affichés)', 'frm.welcome': 'Bienvenue dans OpsLog', 'frm.intro': 'Configure ta station pour commencer à logger. Ces champs sont inscrits sur chaque QSO et peuvent être modifiés plus tard dans Préférences → Informations station (et par profil).', 'frm.callsign': 'Indicatif', 'frm.locator': 'Locator', 'frm.operator': 'Opérateur', 'frm.operatorPh': "identique à l'indicatif", 'frm.owner': 'Propriétaire', 'frm.ownerPh': 'indicatif du propriétaire de la station', 'frm.name': 'Nom', 'frm.namePh': 'ton prénom', 'frm.awardRefs': 'Listes de références des diplômes', 'frm.awardRefsHint': 'IOTA · POTA · WWFF · SOTA — noms et totaux pour ces diplômes (optionnel, peut prendre une minute).', 'frm.downloading': 'Téléchargement…', 'frm.reDownload': 'Retélécharger', 'frm.download': 'Télécharger', 'frm.required': "L'indicatif et le locator sont obligatoires.", 'frm.saving': 'Enregistrement…', 'frm.startLogging': 'Commencer à logger',