Compare commits

...
20 Commits
Author SHA1 Message Date
rouggy e93d2d36a8 feat(watchlist): the ClubLog expedition enrichment — phase 2 lands
clublog.org/watch.php, per entry: the DXpedition flag, OQRS, LiveStream, the
log's QSO total and the last-24h rate — the fields the schema has carried since
phase 1. Refreshed on DXHunter's own cadence (hourly for expeditions,
six-hourly for the rest), two at a time with a breath between requests: the
application API key is shared by every install, so a hundred-entry list must
read as a trickle at ClubLog's end. Nothing to configure — OpsLog's own key,
already used for cty and Most Wanted, serves.

A starred pattern is asked about by its base (ClubLog has no log for VK9*).
The card gains the 24h rate beside the QSO total and the Live link to the
expedition's stream.
2026-08-29 01:49:13 +02:00
rouggy 107c6fccf6 fix(watchlist): remove on a single click, like the bell and trophy beside it
The two-click arm goes: removing an entry is cheap to undo (type it again), so
it does not earn a confirmation its neighbours do not have. The bin reddens on
hover and the green line confirms the removal.
2026-08-29 01:36:06 +02:00
rouggy 9350af9589 fix(watchlist): remove actually removes on the second click
The two-click arm compared against the STATE variable, which each click's
handler captured at render time — a quick double-click read the pre-arm value
twice, so both clicks merely armed: the bin turned red and nothing was ever
deleted. The arm lives in a ref now, compared synchronously, and the window
grows to three seconds.
2026-08-29 01:34:09 +02:00
rouggy a9a6579a9a feat(watchlist): confirm an add, and both messages clear themselves
A green line under the toolbar says what was added (and as what — the contest
variant names the per-UTC-day rule); the already-exists error keeps its red
line. Both fade after four seconds: a stale 'added' from ten minutes ago reads
as a fresh one.
2026-08-29 01:30:10 +02:00
rouggy 7795e13432 fix(watchlist): open the store before the logbook connect
It was created after the (possibly remote) logbook connect, so a 10-30 s MySQL
dial left the tab saying 'Watchlist: 0' until the next refresh tick — twenty
seconds of an empty list for a JSON file that reads in a millisecond. It now
opens right after the data dir is known; only the auto-contest pattern waits
for the settings store.
2026-08-29 01:28:50 +02:00
rouggy c9e98d5fdd feat(watchlist): exact match by default, * for a family
The prefix matching ported from DXHunter swallowed too much: a three-letter
special-event entry N8W lit up NEEDED for N8WCR, a different station entirely.
The implicit becomes explicit — a bare entry matches exactly that call, a
trailing star makes it a family: VK9* catches every VK9…, RI0SP* the
expedition's portable forms. A star anywhere else (or alone) is refused at Add
rather than silently matching nothing. Same rule in the backend Match and the
tab's own matcher, pinned by test.
2026-08-29 01:25:34 +02:00
rouggy 72253f99fa style(watchlist): the toolbar is two atomic groups — no more orphan chip
Add-controls left, filters right, justify-between: when the pane narrows, the
whole filter group drops below as a block instead of shedding its last chip.
Shorter chip labels (Active / Needed) and a slimmer search keep both groups on
one line at the tab's normal width.
2026-08-29 01:16:53 +02:00
rouggy f0d3bed8a2 style(stats): room for a long entity beside its badges
The F1 panel widens 560 → 600 px, the header row drops its outer padding and
wide gaps, and the country badge tightens — so 'Central African Republic' and
the NEW SLOT chip share one line instead of the chip dropping alone underneath.
2026-08-29 01:11:02 +02:00
rouggy 30c9acf0d2 style(watchlist): counters on their own centred line, sane placeholders
The counters are the tab's headline and now sit alone, centred, above the
toolbar; everything one interacts with lives on the second row. The inputs stop
shouting their placeholders — the uppercase belonged to the VALUE (callsigns),
not the hint text — and the auto-contest field says what it is.
2026-08-29 01:08:39 +02:00
rouggy e3175ef6a3 fix(watchlist): never draw a spot before its verdict
A new spot rendered as Needed the instant it arrived and was withdrawn half a
second later when the worked answer landed — the list twitched on every burst.
Unsettled spots are now invisible everywhere (card lines, counters, the
Active/Needed-only filters) until their verdict is in: nobody needs a spot
150 ms early, they need it settled. The answer map is merged rather than
replaced, so a settled line can never fall back to unknown, and the query
debounce drops to 150 ms since there is nothing on screen waiting for it.
2026-08-29 01:06:01 +02:00
rouggy 441eb295c6 feat(watchlist): header counters, mode filter — and the alert checks worked FIRST
DXHunter's header row, ported: Watchlist / Active / Needed counts up front and
the All-Modes select beside the other filters (DIGI matches the digital class,
SSB folds USB/LSB). Counters, card lists and the Active/Needed-only filters all
read the same mode-filtered view, so the numbers add up to what is on screen.

And the notify alert now asks the SAME worked-slot question the tab asks —
before making a sound. It used to fire on the raw spot while the tab's verdict
arrived on a debounce, so the bell rang for a slot that showed Worked a moment
later. Judged in the backend at emit time: exact slot for named modes, digital
class for generic DATA, today-only for contest entries.
2026-08-29 01:03:37 +02:00
rouggy cb2f8aba72 fix(watchlist): the auto-contest FIELD — the backend shipped without its UI
The wiring script died on an app.go anchor mid-run: the backend half was
committed, the frontend half (the pattern field, the changed-event refresh, the
i18n keys) never ran. Replayed; the field sits after Add.
2026-08-29 00:58:46 +02:00
rouggy 7b9cda93bc style(watchlist): drop the lone '!' on needed lines
A needed line already says so twice — the amber left border and the Needed!
badge — and the exclamation mark was noise. The green tick stays on worked
lines.
2026-08-29 00:52:38 +02:00
rouggy 8f64e3fee3 feat(watchlist): the auto-contest pattern — DXHunter's contest_prefix
A field in the tab's toolbar (e.g. WWA): while non-empty, any spotted callsign
CONTAINING it joins the watchlist as a contest entry by itself — a
special-event fleet (HB9WWA, DL0WWA, F4WWA/P…) is collected as it appears
instead of typed in one by one, and each is judged per UTC day like any contest
entry. Contains, not prefix, because the event string sits anywhere in those
calls.

Global setting, cached in an atomic so the spot pipeline never touches the
settings store per spot. Emptying the field stops the collecting but keeps what
was collected — DXHunter deletes non-matching contest entries on a pattern
change, and a setting that silently empties an operator's list is the one
behaviour of the original this port refuses.

The tab also refreshes on backend auto-adds (event) and on a slow tick, so
last-seen and the counters stay honest while it sits open.
2026-08-29 00:50:14 +02:00
rouggy c4de5f2ea0 style(watchlist): a wider column, and the country stops truncating first
max-w-4xl left 'Central African R…' cut mid-name: the column grows to 5xl and
the country cell flexes with the row (capped at 14rem) instead of a hard 8rem.
2026-08-29 00:46:34 +02:00
rouggy 9172f504e5 fix(watchlist): judge generic DATA spots at digital-class grain; tidy the toolbar wrap
7.0589 falls in the band plan's generic [7.04-7.1] DATA segment — an F/H
DXpedition off the standard dials — and 'DATA' is in nobody's log, so the spot
read NEW MODE / Needed while the FT8 contact sat right there. A generic mode
cannot be matched exactly; it is now judged at digital-class grain — worked if
ANY digital mode of that call is logged on that band — against a second
class-folded slot set built beside the exact one (shared when the grouping
option already folds them). DXHunter answers this with a finer frequency table,
which fails on exactly these off-dial expeditions; the class rule cannot.

The toolbar also wraps as a whole with tighter gaps instead of dropping its
last filter chip onto a lone second line.
2026-08-29 00:43:30 +02:00
rouggy 7322e2ab66 feat(watchlist): dockable in the Main tab; sticky filters; Needed-only hides worked lines
The watchlist joins the Main-tab pane list (Settings → Main view), rendered in
a card like the other docked panels.

The three filters persist across tab switches — the component unmounts on every
switch, and filters that reset each time are filters nobody trusts.

Needed-only now hides the worked SPOT LINES as well as the all-worked cards,
which is DXHunter's own Not-Worked behaviour and the reported complaint: a
filter that says needed and still lists five green Worked rows answers a
different question than the one asked.

The add-row checkbox is relabelled 'as contest' — it marks the entry being
ADDED, and read as a filter beside the All/DX/Contest buttons it looked
redundant.
2026-08-29 00:39:07 +02:00
rouggy 29d79fb5d1 fix(watchlist): read the cluster's slot index, and cap the card width
The first version asked the alerts' worked-index — keyed by RAW mode (FT8) —
with a CLASS name (DIGI). Nothing ever matched, and a DXpedition worked on five
bands showed every slot as Needed.

The verdict now reads the cluster's own WorkedCallSlotKeys set, built in the
cached status maps (now unconditionally — it used to exist only when a display
option wanted it). Same index, same mode normalisation as the grid, so the
watchlist can never contradict the cluster about the same spot. The contest
today-set is normalised through the same function.

And the cards column is capped at a reading width instead of stretching
callsign-to-badge lines across the whole window.
2026-08-29 00:33:52 +02:00
rouggy f6b70184a7 chore(qso): drop the redundant SlotsSince free function 2026-08-29 00:26:32 +02:00
rouggy e4abcda94f feat(watchlist): the DXHunter watchlist as an OpsLog tab
The concept, transplanted: a list of callsigns or prefixes being hunted,
matched against the live spot stream, one card per entry with the spots
underneath and the two questions that matter answered on every line — is this
slot still needed, and what is it worth (the cluster's own NEW badges, read
from the same status index).

The file is DXHunter's own watchlist.json, field for field, ClubLog block
included though phase 2 will fill it — a file that round-trips unchanged is the
whole of 'same format', and a test pins it with a real DXHunter entry. Global
(dataDir), not per profile.

CONTEST is per entry, not the global mode DXHunter has: a contest entry is
judged against the current UTC day — the boundary lives in the query's date
bound, so midnight needs no timer and resets nothing. Normal entries read the
same in-memory worked index the alerts use. Prefix matching is why RI0SP
catches RI0SP/MM, pinned by test.

Notify goes through the existing alert:fired event — the frontend already
toasts and sounds it — throttled to one alert per entry per two minutes,
because a DXpedition lights every skimmer on the planet.

Tab wired like NET Control: opt-in from Tools, persisted, closable. Single
click fills the callsign, double click works the spot — the cluster's own
gesture, kept.
2026-08-29 00:25:40 +02:00
15 changed files with 1483 additions and 23 deletions
+45 -12
View File
@@ -74,6 +74,7 @@ import (
"hamlog/internal/tunergenius"
"hamlog/internal/uls"
"hamlog/internal/ultrabeam"
"hamlog/internal/watchlist"
"hamlog/internal/winkeyer"
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
@@ -95,12 +96,13 @@ const (
keyLookupFailsafe = "lookup.failsafe"
keyLookupImages = "lookup.download_images" // 1 = expose QRZ ImageURL to UI
keyStationCallsign = "station.callsign"
keyStationOperator = "station.operator"
keyStationMyGrid = "station.my_grid"
keyStationCountry = "station.my_country"
keyStationSOTA = "station.my_sota_ref"
keyStationPOTA = "station.my_pota_ref"
keyStationCallsign = "station.callsign"
keyStationOperator = "station.operator"
keyWatchlistContestPattern = "watchlist.contest_pattern" // auto-add contest calls containing this
keyStationMyGrid = "station.my_grid"
keyStationCountry = "station.my_country"
keyStationSOTA = "station.my_sota_ref"
keyStationPOTA = "station.my_pota_ref"
keyListsBands = "lists.bands"
keyListsModes = "lists.modes"
@@ -735,6 +737,10 @@ type App struct {
uls *uls.Store // US callsign→county/grid (offline FCC ULS), lazily opened
awardRefs *awardref.Repo
qslTemplates *qslcard.Repo
watchlist *watchlist.Store // Tools → Watchlist (global watchlist.json)
watchAlertMu sync.Mutex // throttles watchlist alerts…
watchAlertAt map[string]time.Time // …per entry
watchPattern atomic.Value // auto-contest pattern (string), loaded at startup
operating *operating.Repo
udp *udp.Manager
udpRepo *udp.Repo
@@ -1015,6 +1021,13 @@ func (a *App) startup(ctx context.Context) {
return
}
a.dataDir = dataDir
// The watchlist needs nothing but its file, so it opens FIRST. It used to be
// created after the logbook connect, and a remote MySQL dial of 10-30 s left
// the tab saying "Watchlist: 0" until the next refresh tick — twenty seconds
// of an empty list for a JSON file that reads in a millisecond. (The
// auto-contest pattern still loads later, once the settings store is open.)
a.watchlist = watchlist.New(filepath.Join(dataDir, "watchlist.json"))
a.watchAlertAt = map[string]time.Time{}
// Settings/config database (settings + profiles). Fresh installs use
// settings.db; existing installs keep their opslog.db (which also held the
// QSOs before they were split into a dedicated logbook file — see below).
@@ -1385,6 +1398,8 @@ func (a *App) startup(ctx context.Context) {
// POTA: background poller of api.pota.app so cluster spots can be tagged
// when the DX station is currently activating a park. Best-effort.
a.pota = pota.New(func(format string, args ...any) { applog.Printf(format, args...) })
a.startWatchlistClubLog()
a.watchPattern.Store(strings.ToUpper(strings.TrimSpace(a.settingOr(keyWatchlistContestPattern, ""))))
go a.pota.Run(a.ctx)
// DX Cluster (multi-server): the spot callback enriches each spot
@@ -1796,6 +1811,9 @@ func (a *App) setSettingGlobal(key, val string) {
}
func (a *App) shutdown(ctx context.Context) {
if a.watchlist != nil {
a.watchlist.Flush() // the save debounce would lose the last edits
}
// If the user managed to skip beforeClose (force kill, OS shutdown,
// crash recovery) we still try the backup here as a best-effort
// safety net. HasBackupToday makes a double-run a no-op.
@@ -9003,6 +9021,10 @@ func (a *App) clusterEventWorker() {
a.detectBandOpening(s)
// Fire any matching alert rules (sound / visual / e-mail).
a.evaluateAlerts(s)
// The watchlist sees the same live stream the alerts do — never the
// SH/DX replay above, which would mark forty stations "just seen" with
// spots from three hours ago.
a.watchSpot(s.DXCall, s.Band, alerts.InferMode(s.Comment, s.FreqHz), s.Country, s.Comment, s.FreqHz)
// Mirror the spot onto the FlexRadio panadapter when enabled. Infer the
// mode (from the comment, else the band plan) so clicking the spot on the
// panadapter tunes AND switches mode — a DX cluster line carries no mode,
@@ -19704,10 +19726,11 @@ type SpotStatus struct {
// that already holds the pointer keeps reading valid (stale-by-one-log) data
// while a newer snapshot is being built. See clusterStatusMaps.
type clusterStatusCache struct {
entities map[int]*qso.EntitySlot
workedCalls map[string]struct{}
workedCallSlots map[string]struct{} // nil unless the "same slot" option is on
workedCounties map[string]struct{}
entities map[int]*qso.EntitySlot
workedCalls map[string]struct{}
workedCallSlots map[string]struct{}
workedCallSlotsDig map[string]struct{} // same set, digital modes folded to DIG // nil unless the "same slot" option is on
workedCounties map[string]struct{}
// callCounties holds callsign → "STATE,County" for stations already logged
// with a county, so a spot shows the county the entry panel showed rather
// than the one derived from the licence ZIP. See qso.CallCounties.
@@ -19790,8 +19813,18 @@ func (a *App) clusterStatusMaps() *clusterStatusCache {
// "Already worked only on the same slot" option (Settings → DX Cluster): the
// WORKED-call flag then needs the SAME band and mode (digital-grouped through
// the same normMode when that option is on) rather than the call anywhere.
if sameSlot || slotHighlight {
c.workedCallSlots, _ = a.qso.WorkedCallSlotKeys(a.ctx, c.normMode)
// Built UNCONDITIONALLY since the watchlist arrived: its per-slot verdict
// needs this set whatever the cluster's own display options say, and the
// scan already runs at cache-rebuild cadence, not per batch.
c.workedCallSlots, _ = a.qso.WorkedCallSlotKeys(a.ctx, c.normMode)
// And once more at digital-CLASS grain, for the spots whose mode the band
// plan can only call "DATA": a generic mode cannot be matched exactly, so it
// is judged against "any digital mode of this call on this band". When the
// grouping option is on, workedCallSlots is already at that grain.
if c.normMode != nil {
c.workedCallSlotsDig = c.workedCallSlots
} else {
c.workedCallSlotsDig, _ = a.qso.WorkedCallSlotKeys(a.ctx, qso.GroupDigitalMode)
}
// Orthogonal dimensions: worked US counties (for the ULS callsign→county
// lookup) and worked POTA parks.
+293
View File
@@ -0,0 +1,293 @@
package main
// Watchlist bindings — the DXHunter watchlist concept as an OpsLog tab.
// The store lives in internal/watchlist (global watchlist.json, DXHunter's own
// schema); this file is the Wails boundary plus the two places the list meets
// the rest of the app: the spot stream (MarkSeen + alert) and the logbook (the
// worked-today answer contest entries are judged by).
import (
"context"
"fmt"
"net/http"
"strings"
"time"
"hamlog/internal/applog"
"hamlog/internal/qso"
"hamlog/internal/watchlist"
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
)
// The auto-contest pattern, DXHunter's contest_prefix: while non-empty, any
// spotted callsign CONTAINING it is added to the watchlist as a contest entry
// by itself — a special-event fleet (HB9WWA, DL0WWA, F4WWA…) is collected as
// it appears instead of typed in one by one. Held in an atomic so the spot
// pipeline never touches the settings store per spot.
func (a *App) GetWatchlistContestPattern() string {
if v := a.watchPattern.Load(); v != nil {
return v.(string)
}
return ""
}
// SetWatchlistContestPattern stores the pattern (global, like the list itself).
// Emptying it stops the auto-add; entries already collected stay — deleting an
// operator's list because a setting changed is DXHunter behaviour this port
// deliberately drops.
func (a *App) SetWatchlistContestPattern(p string) {
p = strings.ToUpper(strings.TrimSpace(p))
a.watchPattern.Store(p)
a.setSettingGlobal(keyWatchlistContestPattern, p)
}
// WatchlistEntries returns the list for the tab.
func (a *App) WatchlistEntries() []watchlist.Entry {
if a.watchlist == nil {
return nil
}
return a.watchlist.Entries()
}
// WatchlistAdd adds a callsign or prefix; contest entries are judged per UTC day.
func (a *App) WatchlistAdd(callsign string, contest bool) error {
if a.watchlist == nil {
return fmt.Errorf("watchlist not initialized")
}
return a.watchlist.Add(callsign, contest)
}
// WatchlistRemove deletes an entry.
func (a *App) WatchlistRemove(callsign string) error {
if a.watchlist == nil {
return fmt.Errorf("watchlist not initialized")
}
return a.watchlist.Remove(callsign)
}
// WatchlistSetNotify arms the existing alert path (sound + toast) for an entry.
func (a *App) WatchlistSetNotify(callsign string, on bool) error {
if a.watchlist == nil {
return fmt.Errorf("watchlist not initialized")
}
return a.watchlist.SetNotify(callsign, on)
}
// WatchlistSetContest flips the per-entry contest rule.
func (a *App) WatchlistSetContest(callsign string, on bool) error {
if a.watchlist == nil {
return fmt.Errorf("watchlist not initialized")
}
return a.watchlist.SetContest(callsign, on)
}
// WatchlistSlotQuery asks whether one spot's slot is worked — against the whole
// log for a normal entry, against TODAY (UTC) for a contest one.
type WatchlistSlotQuery struct {
Call string `json:"call"`
Band string `json:"band"`
Mode string `json:"mode"`
Contest bool `json:"contest"`
}
// WatchlistWorkedSlots answers a batch of slot questions for the tab.
//
// Normal entries read the CLUSTER's own slot set — the same cached
// WorkedCallSlotKeys index that colours the grid — so the watchlist can never
// contradict the cluster about the same spot. That index normalises the mode
// exactly as the operator configured (digital grouping on → FT4 counts as FT8's
// class; off → exact mode), and the first version of this ignored that: it
// asked the alerts' raw-mode index with a CLASS name, matched nothing, and
// showed a fully-worked DXpedition as all Needed.
//
// Contest entries read TODAY's contacts instead — the midnight-UTC reset is
// the query's date bound, nothing stored, nothing to reset — normalised through
// the same function so the two answers use one grammar.
func (a *App) WatchlistWorkedSlots(queries []WatchlistSlotQuery) []bool {
out := make([]bool, len(queries))
if a.qso == nil || len(queries) == 0 {
return out
}
idx := a.clusterStatusMaps()
norm := func(m string) string {
m = strings.ToUpper(strings.TrimSpace(m))
if idx.normMode != nil {
m = idx.normMode(m)
}
return m
}
slotKey := func(call, band, mode string) string {
up := strings.ToUpper(strings.TrimSpace(call))
b := strings.ToLower(strings.TrimSpace(band))
if m := norm(mode); m != "" {
return up + "|" + b + "|" + m
}
return up + "|" + b
}
// A spot whose mode the band plan could only call "DATA" (an F/H DXpedition
// off the standard dials, a comment with no mode) cannot be matched exactly:
// "DATA" is in nobody's log. Such a spot is judged at digital-CLASS grain —
// worked if ANY digital mode of that call is logged on that band. Claiming
// NEW MODE because the label differs from FT8 was the reported bug.
generic := func(m string) bool {
switch strings.ToUpper(strings.TrimSpace(m)) {
case "", "DATA", "DIG", "DIGI", "DIGITAL":
return true
}
return false
}
digKey := func(call, band string) string {
return strings.ToUpper(strings.TrimSpace(call)) + "|" + strings.ToLower(strings.TrimSpace(band)) + "|DIG"
}
needToday := false
for _, q := range queries {
if q.Contest {
needToday = true
break
}
}
today := map[string]bool{}
if needToday {
midnight := time.Now().UTC().Truncate(24 * time.Hour)
rows, err := a.qso.SlotsSince(a.ctx, midnight)
if err == nil {
for _, r := range rows {
today[slotKey(r.Callsign, r.Band, r.Mode)] = true
today[digKey(r.Callsign, r.Band)] = qso.ModeClass(r.Mode) == "DIG" || today[digKey(r.Callsign, r.Band)]
}
}
}
for i, q := range queries {
if q.Contest {
if generic(q.Mode) {
out[i] = today[digKey(q.Call, q.Band)]
} else {
out[i] = today[slotKey(q.Call, q.Band, q.Mode)]
}
} else if generic(q.Mode) {
if idx.workedCallSlotsDig != nil {
_, out[i] = idx.workedCallSlotsDig[digKey(q.Call, q.Band)]
}
} else if idx.workedCallSlots != nil {
_, out[i] = idx.workedCallSlots[slotKey(q.Call, q.Band, q.Mode)]
}
}
return out
}
// watchSpot runs one live spot through the watchlist: last-seen bookkeeping and
// the alert, through the SAME event the alert rules fire — the frontend already
// knows how to toast and sound it, and a second notification path would be a
// second thing to misconfigure.
func (a *App) watchSpot(dxCall, band, mode, country, comment string, freqHz int64) {
if a.watchlist == nil {
return
}
entry, notify, ok := a.watchlist.MarkSeen(dxCall)
if !ok {
// Not watched yet — the auto-contest pattern may claim it. Contains, not
// prefix: the event string sits anywhere in these calls (HB9WWA, F4WWA/P).
if p := a.GetWatchlistContestPattern(); p != "" &&
strings.Contains(strings.ToUpper(dxCall), p) {
if err := a.watchlist.Add(dxCall, true); err == nil {
applog.Printf("watchlist: auto-added %s (contest pattern %q)", dxCall, p)
entry, notify, ok = a.watchlist.MarkSeen(dxCall)
if a.ctx != nil {
wruntime.EventsEmit(a.ctx, "watchlist:changed")
}
}
}
}
if !ok || !notify || a.ctx == nil {
return
}
// Already worked? Then nothing to announce. Judged HERE, before the sound —
// the report was an alert ringing for a slot the tab showed as Worked a
// moment later, because the frontend's verdict arrives on a debounce while
// the alert used to fire on the raw spot. Same verdict as the tab: exact
// slot for named modes, digital class for a generic DATA spot, today-only
// for a contest entry.
if e, found := a.watchlist.Get(entry); found {
if a.WatchlistWorkedSlots([]WatchlistSlotQuery{{Call: dxCall, Band: band, Mode: mode, Contest: e.IsContest}})[0] {
return
}
}
// Throttled per entry: a DXpedition lights up every skimmer on the planet,
// and forty alerts a minute for one station is a alarm nobody keeps on.
a.watchAlertMu.Lock()
last := a.watchAlertAt[entry]
now := time.Now()
if now.Sub(last) < 2*time.Minute {
a.watchAlertMu.Unlock()
return
}
a.watchAlertAt[entry] = now
a.watchAlertMu.Unlock()
wruntime.EventsEmit(a.ctx, "alert:fired", map[string]any{
"rule": "Watchlist " + entry,
"call": strings.ToUpper(strings.TrimSpace(dxCall)),
"band": band,
"mode": mode,
"freq_hz": freqHz,
"country": country,
"comment": comment,
"sound": true,
"visual": true,
})
}
// startWatchlistClubLog begins the expedition enrichment: every entry's
// ClubLog block (expedition flag, OQRS, LiveStream, QSO totals and 24 h rate)
// is refreshed on a rolling schedule — hourly for expeditions, six-hourly for
// the rest, DXHunter's own cadence. OpsLog's application API key is used, so
// there is nothing to configure.
//
// Two at a time with a breath between requests: the key is shared by every
// OpsLog install, and a hundred-entry watchlist must read as a trickle at
// ClubLog's end, not a burst.
func (a *App) startWatchlistClubLog() {
if a.watchlist == nil {
return
}
go func() {
client := &http.Client{Timeout: 30 * time.Second}
// Let the app finish starting before the first network pass.
time.Sleep(15 * time.Second)
for {
stale := a.watchlist.StaleEntries(1*time.Hour, 6*time.Hour)
changed := false
for _, call := range stale {
// The pattern's BASE is what ClubLog knows: VK9* has no log.
base := strings.TrimSuffix(call, "*")
if base == "" {
continue
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
d, err := watchlist.FetchWatch(ctx, client, clublogAppAPIKey, base)
cancel()
if err != nil {
applog.Printf("watchlist clublog: %s: %v", base, err)
continue
}
if a.watchlist.ApplyClubLog(call, d) {
changed = true
if d.IsExpedition {
applog.Printf("watchlist clublog: %s is a DXpedition (%d QSOs, %d/24h, OQRS=%v)",
base, func() int {
if d.ClubLogInfo != nil {
return d.ClubLogInfo.TotalQSOs
}
return 0
}(), d.QSOs24h(), d.HasOQRS)
}
}
time.Sleep(400 * time.Millisecond)
}
if changed && a.ctx != nil {
wruntime.EventsEmit(a.ctx, "watchlist:changed")
}
time.Sleep(10 * time.Minute)
}
}()
}
+4 -2
View File
@@ -9,7 +9,8 @@
"Elecraft console: a mode row — CW, USB, LSB, DATA and DATA RTTY. The two DATA buttons set the K3s submode as well (DATA A for FT8/FT4, FSK D for RTTY): switching to DATA by mode alone kept whatever submode the last session left, which is how a K3 “in DATA” keys FT8 with no audio.",
"DX Cluster settings: “I chase POTA” and “I chase SOTA”, on by default. Unticked, the NEW POTA badge, colour and filter disappear — a new-band + new-POTA spot reads NEW BAND alone — and the reference columns stay empty.",
"Elecraft console: RIT and XIT use the same control as the Icom and TCI consoles — ± buttons, mouse wheel, typed value, Ctrl+←/→ — and the power slider moves in 1 W steps instead of 5.",
"Bulk edit: My DXCC, My CQ zone and My ITU zone join the My-station fields — numbers checked against their real ranges, empty clears."
"Bulk edit: My DXCC, My CQ zone and My ITU zone join the My-station fields — numbers checked against their real ranges, empty clears.",
"Watchlist (Tools): the DXHunter watchlist as an OpsLog tab — callsigns you are hunting (exact, or a family with a trailing * — VK9* catches every VK9), the live cluster spots under each with the NEW badges and a Needed/Worked verdict per slot, an ON AIR badge, per-entry alerts through the normal alert path, and CONTEST entries judged per UTC day (at midnight everything is workable again). Reads and writes DXHunters own watchlist.json format — drop your existing file into the data folder to carry it over."
],
"fr": [
"TCI (SunSDR) : l'abonnement aux mesures est renouvelé quand la radio annonce qu'elle est prête — envoyé seulement à la connexion, il pouvait tomber pendant l'envoi initial de l'état et être ignoré, laissant la puissance et le ROS vides en émission. Le journal enregistre aussi l'abonnement et les premières trames de mesure, pour distinguer « la radio ne les envoie jamais » de « elles arrivaient et étaient perdues ».",
@@ -18,7 +19,8 @@
"Console Elecraft : une rangée de modes — CW, USB, LSB, DATA et DATA RTTY. Les deux boutons DATA règlent aussi le sous-mode du K3 (DATA A pour FT8/FT4, FSK D pour le RTTY) : passer en DATA par le seul mode gardait le sous-mode de la session précédente, et un K3 « en DATA » manipulait le FT8 sans audio.",
"Réglages DX Cluster : « Je chasse le POTA » et « Je chasse le SOTA », cochés par défaut. Décochés, le badge, la couleur et le filtre NOUVEAU POTA disparaissent — un spot nouvelle bande + nouveau POTA affiche seulement NOUVELLE BANDE — et les colonnes de références restent vides.",
"Console Elecraft : le RIT et le XIT utilisent la même commande que les consoles Icom et TCI — boutons ±, molette, valeur tapée, Ctrl+←/→ — et le curseur de puissance avance par pas de 1 W au lieu de 5.",
"Édition groupée : My DXCC, My CQ zone et My ITU zone rejoignent les champs Ma station — valeurs vérifiées contre leurs bornes réelles, vide efface."
"Édition groupée : My DXCC, My CQ zone et My ITU zone rejoignent les champs Ma station — valeurs vérifiées contre leurs bornes réelles, vide efface.",
"Watchlist (Outils) : la watchlist de DXHunter en onglet OpsLog — indicatifs chassés (exacts, ou une famille avec une * finale — VK9* attrape tous les VK9), les spots cluster en direct sous chaque entrée avec les badges NOUVEAU et un verdict Manquant/Contacté par créneau, un badge ON AIR, des alertes par entrée via le circuit d'alerte normal, et des entrées CONTEST jugées par jour UTC (à minuit tout redevient à faire). Lit et écrit le format watchlist.json de DXHunter — déposez votre fichier existant dans le dossier data pour le récupérer."
]
},
{
+38 -4
View File
@@ -69,6 +69,7 @@ import {
} from '@/components/ui/dropdown-menu';
import { APP_VERSION, APP_AUTHOR } from '@/version';
import { QSLManagerPanel } from '@/components/QSLManagerModal';
import { WatchlistTab } from '@/components/WatchlistTab';
import { QslDesignerModal } from '@/components/qsl/QslDesignerModal';
import { SendEQSLModal } from '@/components/qsl/SendEQSLModal';
import { AutoEQSL } from '@/components/qsl/AutoEQSL';
@@ -1684,6 +1685,9 @@ export default function App() {
// NET Control tab — enabled from Tools (persisted; once on it's a tab like Cluster).
const [netEnabled, setNetEnabled] = useState(() => localStorage.getItem('opslog.netEnabled') === '1');
useEffect(() => { localStorage.setItem('opslog.netEnabled', netEnabled ? '1' : '0'); }, [netEnabled]);
// Watchlist tab — opt-in from Tools, persisted, closable like NET Control.
const [watchlistEnabled, setWatchlistEnabled] = useState(() => localStorage.getItem('opslog.watchlistEnabled') === '1');
useEffect(() => { localStorage.setItem('opslog.watchlistEnabled', watchlistEnabled ? '1' : '0'); }, [watchlistEnabled]);
// Contest tab is hidden until enabled from Tools → Contest mode.
const [contestTabEnabled, setContestTabEnabled] = useState(() => localStorage.getItem('opslog.contestTab') === '1');
useEffect(() => { localStorage.setItem('opslog.contestTab', contestTabEnabled ? '1' : '0'); }, [contestTabEnabled]);
@@ -2014,7 +2018,7 @@ export default function App() {
// so it's loaded async on mount and re-read on profile:changed below.
// 'none' is only ever stored for the third and fourth panes: the first two are
// the Main view, and a layout with no panes at all is not a layout.
type MainPaneKind = 'map1' | 'map2' | 'cluster' | 'worked' | 'flex' | 'recent' | 'icom' | 'yaesu' | 'elecraft' | 'tci' | 'netcontrol' | 'decodes' | 'none';
type MainPaneKind = 'map1' | 'map2' | 'cluster' | 'worked' | 'flex' | 'recent' | 'icom' | 'yaesu' | 'elecraft' | 'tci' | 'netcontrol' | 'decodes' | 'watchlist' | 'none';
const [mapZoomSignal, setMapZoomSignal] = useState(0); // bump → world map auto-zooms now
const [mainPaneLeft, setMainPaneLeft] = useState<MainPaneKind>('map1');
const [mainPaneRight, setMainPaneRight] = useState<MainPaneKind>('map2');
@@ -2025,7 +2029,7 @@ export default function App() {
// quarter-width map is unreadable.
const [mainLayout4, setMainLayout4] = useState<'cols' | 'quad'>('quad');
const loadMainPanes = useCallback(async () => {
const valid = (v: string): v is MainPaneKind => v === 'map1' || v === 'map2' || v === 'cluster' || v === 'worked' || v === 'flex' || v === 'recent' || v === 'icom' || v === 'yaesu' || v === 'elecraft' || v === 'tci' || v === 'netcontrol' || v === 'decodes';
const valid = (v: string): v is MainPaneKind => v === 'map1' || v === 'map2' || v === 'cluster' || v === 'worked' || v === 'flex' || v === 'recent' || v === 'icom' || v === 'yaesu' || v === 'elecraft' || v === 'tci' || v === 'netcontrol' || v === 'decodes' || v === 'watchlist';
const [l, r, p3, p4, lay] = await Promise.all([
GetUIPref('mainPaneLeft').catch(() => ''),
GetUIPref('mainPaneRight').catch(() => ''),
@@ -5004,6 +5008,7 @@ export default function App() {
{ type: 'item', label: (cwEnabled ? '✓ ' : '') + t('tools.cwDecoder'), action: 'tools.cwdecoder' },
{ type: 'separator' },
{ type: 'item', label: (netEnabled ? '✓ ' : '') + t('tools.net'), action: 'tools.net' },
{ type: 'item', label: (watchlistEnabled ? '✓ ' : '') + t('tools.watchlist'), action: 'tools.watchlist' },
{ type: 'item', label: (contestTabEnabled ? '✓ ' : '') + t('tools.contest'), action: 'tools.contest' },
{ type: 'item', label: t('tools.alerts'), action: 'tools.alerts' },
{ type: 'separator' },
@@ -5027,7 +5032,7 @@ export default function App() {
{ type: 'separator' },
{ type: 'item', label: t('help.about'), action: 'help.about' },
]},
], [total, selectedId, selectedIds, exporting, wkEnabled, dvkEnabled, cwEnabled, netEnabled, contestTabEnabled, smtpConfigured, sendingLog, t]);
], [total, selectedId, selectedIds, exporting, wkEnabled, dvkEnabled, cwEnabled, netEnabled, watchlistEnabled, contestTabEnabled, smtpConfigured, sendingLog, t]);
function handleMenu(action: string) {
switch (action) {
@@ -5055,6 +5060,7 @@ export default function App() {
case 'tools.dvk': setDvkEnabled((v) => !v); break;
case 'tools.cwdecoder': toggleCwDecoder(); break;
case 'tools.net': setNetEnabled((v) => { const nv = !v; if (nv) setActiveTab('net'); return nv; }); break;
case 'tools.watchlist': setWatchlistEnabled((v) => { const nv = !v; if (nv) setActiveTab('watchlist'); return nv; }); break;
case 'tools.contest': setContestTabEnabled((v) => { const nv = !v; if (nv) setActiveTab('contest'); else setActiveTab((tb) => (tb === 'contest' ? 'recent' : tb)); return nv; }); break;
case 'tools.alerts': setAlertsOpen(true); break;
case 'tools.duplicates': setShowDuplicates(true); break;
@@ -6333,6 +6339,13 @@ export default function App() {
<IcomPanel isNetwork={catBackend === 'icom-net'} onReportRST={(r) => { setRstSent(r); rstUserEditedRef.current = true; }} />
</div>
);
case 'watchlist':
return (
<div className="h-full w-full min-h-0 flex flex-col bg-card border border-border rounded-lg overflow-hidden">
<WatchlistTab spots={spots} spotStatus={spotStatus}
onSpotSelect={handleSpotSelect} onSpotClick={handleSpotClick} />
</div>
);
case 'netcontrol':
return (
<div className="h-full w-full min-h-0 flex flex-col rounded-lg overflow-hidden border border-border">
@@ -7226,7 +7239,7 @@ export default function App() {
// relative + absolute inner: the panel's content can't grow the row, so
// the row height is set by the ENTRY STRIP. A taller tab (Awards/F3) then
// scrolls inside this fixed height instead of pushing everything down.
<div className="w-[560px] shrink-0 min-h-0 relative">
<div className="w-[600px] shrink-0 min-h-0 relative">
<div className="absolute inset-0 flex flex-col min-h-0">
<DetailsPanel
callsign={callsign}
@@ -7601,6 +7614,21 @@ export default function App() {
</span>
</TabsTrigger>
)}
{watchlistEnabled && (
<TabsTrigger value="watchlist" className="gap-1.5">
{t('tab.watchlist')}
<span
role="button"
aria-label="Close Watchlist"
title="Close"
className="inline-flex items-center justify-center size-4 rounded hover:bg-foreground/10 text-muted-foreground hover:text-foreground"
onPointerDown={(e) => { e.stopPropagation(); }}
onClick={(e) => { e.stopPropagation(); setWatchlistEnabled(false); setActiveTab((t) => (t === 'watchlist' ? 'recent' : t)); }}
>
<X className="size-3" />
</span>
</TabsTrigger>
)}
{catState.backend === 'flex' && <TabsTrigger value="flex">Flex Console</TabsTrigger>}
{catState.backend === 'icom' && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
{catState.backend === 'yaesu' && <TabsTrigger value="yaesu">Yaesu Console</TabsTrigger>}
@@ -8312,6 +8340,12 @@ export default function App() {
{/* Band Map: several bands shown side-by-side (panadapter-style
strips). Pick bands with the chips; each strip is clickable to
tune the rig. */}
{watchlistEnabled && (
<TabsContent value="watchlist" className="mt-0 flex flex-col min-h-0 flex-1">
<WatchlistTab spots={spots} spotStatus={spotStatus}
onSpotSelect={handleSpotSelect} onSpotClick={handleSpotClick} />
</TabsContent>
)}
{netEnabled && (
<TabsContent value="net" className="mt-0 flex flex-col min-h-0 flex-1">
<NetControlPanel onLogged={refresh} countries={countries} bands={bands} modes={modes}
+3 -3
View File
@@ -242,11 +242,11 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
return (
<section
className={cn(
'flex items-center gap-4 px-3 py-2 flex-wrap shrink-0',
'flex items-center gap-2 px-2 py-2 flex-wrap shrink-0',
newOne && 'bg-gradient-to-br from-warning-muted to-warning-muted rounded-lg',
)}
>
<div className="flex items-center gap-2 min-w-[220px] flex-1">
<div className="flex items-center gap-2 min-w-0 flex-1">
{newOne ? (
<>
<Badge className="bg-warning text-warning-foreground gap-1 px-3 py-1 text-[11px]">
@@ -269,7 +269,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
{forCall}
</Badge>
)}
<Badge className="bg-primary text-primary-foreground px-3 py-1 text-xs normal-case font-semibold tracking-normal">
<Badge className="bg-primary text-primary-foreground px-2 py-0.5 text-xs normal-case font-semibold tracking-normal leading-tight">
{dxccName || `DXCC #${dxcc}`}
</Badge>
{mwBadge}
+1 -1
View File
@@ -1086,7 +1086,7 @@ function RelayAutoPanel() {
// panes. The first two are the view; the third and fourth can be left empty, and
// an empty one is not drawn at all. Per-profile (stored via SetUIPref, which is
// profile-prefixed). Self-contained so it owns its async-loaded state.
const MAIN_PANE_VALUES = ['map1', 'map2', 'cluster', 'worked', 'recent', 'netcontrol', 'decodes'];
const MAIN_PANE_VALUES = ['map1', 'map2', 'cluster', 'worked', 'recent', 'netcontrol', 'decodes', 'watchlist'];
const PANE_NONE = 'none';
function MainViewPanes({ onChanged, flexAvailable, icomAvailable, yaesuAvailable, elecraftAvailable, tciAvailable }: { onChanged?: (side: 'left' | 'right' | 'p3' | 'p4' | 'layout', value: string) => void; flexAvailable?: boolean; icomAvailable?: boolean; yaesuAvailable?: boolean; elecraftAvailable?: boolean; tciAvailable?: boolean }) {
const { t } = useI18n();
+417
View File
@@ -0,0 +1,417 @@
// Watchlist — the DXHunter concept as an OpsLog tab.
//
// One card per watched callsign (or prefix), the live spots that match it
// underneath, and the two questions an operator actually asks answered on every
// line: is this slot still NEEDED, and what would it be worth (the same NEW
// DXCC / band / mode / slot badges the cluster shows, resolved from the same
// index). A CONTEST entry is judged against the current UTC day — at midnight
// everything reads "work today" again; the boundary lives in the backend query,
// so there is nothing to reset.
//
// The design is DXHunter's — the layout, the badges, the wording — repainted in
// the app's theme tokens rather than its hard-coded slate/pink.
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Eye, Plus, Trash2, Bell, BellOff, Trophy, Search } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Checkbox } from '@/components/ui/checkbox';
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
import {
WatchlistEntries, WatchlistAdd, WatchlistRemove, WatchlistSetNotify,
WatchlistSetContest, WatchlistWorkedSlots,
GetWatchlistContestPattern, SetWatchlistContestPattern, OpenExternalURL,
} from '../../wailsjs/go/main/App';
import { EventsOn } from '../../wailsjs/runtime/runtime';
import type { ClusterSpot, SpotStatusEntry } from '@/components/ClusterGrid';
import { inferSpotMode, spotStatusKey } from '@/lib/spot';
interface WLEntry {
callsign: string; lastSeenStr: string; addedAt: string; spotCount: number;
isContest: boolean; notify: boolean;
isExpedition: boolean; clubLogQSOs24h: number; clubLogTotalQSOs: number;
clubLogHasOQRS: boolean; clubLogLiveStream: boolean;
}
interface Props {
spots: ClusterSpot[];
spotStatus: Record<string, SpotStatusEntry>;
onSpotSelect?: (s: ClusterSpot) => void;
onSpotClick?: (s: ClusterSpot) => void;
}
// A spot is ON AIR for the badge while its last sighting is this fresh.
const ON_AIR_MS = 10 * 60 * 1000;
// Exact unless the entry carries a trailing * — the same rule the backend's
// Match applies to the live stream, mirrored so the tab and the alerts can
// never disagree about what an entry covers.
function matchesEntry(call: string, pattern: string): boolean {
const c = call.toUpperCase();
if (pattern.endsWith('*')) {
const p = pattern.slice(0, -1);
return p !== '' && c.startsWith(p);
}
return c === pattern;
}
export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: Props) {
const { t } = useI18n();
const [entries, setEntries] = useState<WLEntry[]>([]);
const [addCall, setAddCall] = useState('');
const [addContest, setAddContest] = useState(false);
const [search, setSearch] = useState('');
// The filters survive leaving the tab: the component unmounts on every tab
// switch, and filters that reset each time are filters nobody trusts.
const [neededOnly, setNeededOnlyRaw] = useState(() => localStorage.getItem('opslog.wlNeededOnly') === '1');
const [activeOnly, setActiveOnlyRaw] = useState(() => localStorage.getItem('opslog.wlActiveOnly') === '1');
const [family, setFamilyRaw] = useState<'all' | 'normal' | 'contest'>(() => {
const v = localStorage.getItem('opslog.wlFamily');
return v === 'normal' || v === 'contest' ? v : 'all';
});
const setNeededOnly = (f: (v: boolean) => boolean) => setNeededOnlyRaw((v) => { const nv = f(v); try { localStorage.setItem('opslog.wlNeededOnly', nv ? '1' : '0'); } catch {} return nv; });
const setActiveOnly = (f: (v: boolean) => boolean) => setActiveOnlyRaw((v) => { const nv = f(v); try { localStorage.setItem('opslog.wlActiveOnly', nv ? '1' : '0'); } catch {} return nv; });
const setFamily = (v: 'all' | 'normal' | 'contest') => { setFamilyRaw(v); try { localStorage.setItem('opslog.wlFamily', v); } catch {} };
// Mode filter — DXHunter's "All Modes" select. DIGI matches the digital class
// (FT8, FT4, a generic DATA spot…), the named modes match exactly.
const [modeFilter, setModeFilterRaw] = useState(() => localStorage.getItem('opslog.wlMode') || 'ALL');
const setModeFilter = (v: string) => { setModeFilterRaw(v); try { localStorage.setItem('opslog.wlMode', v); } catch {} };
const modeMatches = (s2: ClusterSpot): boolean => {
if (modeFilter === 'ALL') return true;
const m = (inferSpotMode(s2.comment ?? '', s2.freq_hz) || '').toUpperCase();
if (modeFilter === 'DIGI') return !['', 'CW', 'SSB', 'USB', 'LSB', 'FM', 'AM'].includes(m);
if (modeFilter === 'SSB') return m === 'SSB' || m === 'USB' || m === 'LSB';
return m === modeFilter;
};
const [error, setError] = useState('');
// A quiet confirmation under the toolbar; both messages clear themselves —
// a stale "added" from ten minutes ago reads as a fresh one.
const [notice, setNotice] = useState('');
const noticeTimer = useRef<number | undefined>(undefined);
const flash = (msg: string, isError: boolean) => {
if (noticeTimer.current) window.clearTimeout(noticeTimer.current);
setError(isError ? msg : '');
setNotice(isError ? '' : msg);
noticeTimer.current = window.setTimeout(() => { setError(''); setNotice(''); }, 4000) as unknown as number;
};
// worked answer per "call|band|modeclass|contest" key.
const [worked, setWorked] = useState<Record<string, boolean>>({});
const refresh = useCallback(async () => {
try { setEntries(((await WatchlistEntries()) ?? []) as any as WLEntry[]); }
catch (e: any) { setError(String(e?.message ?? e)); }
}, []);
// Refreshed on mount, when the backend auto-adds (event), and on a slow tick
// so last-seen and the spot counters stay honest while the tab sits open.
useEffect(() => {
void refresh();
const off = EventsOn('watchlist:changed', () => { void refresh(); });
const id = window.setInterval(() => { void refresh(); }, 30_000);
return () => { off(); window.clearInterval(id); };
}, [refresh]);
// The auto-contest pattern (DXHunter's contest_prefix): spots whose call
// contains it are added as contest entries by the backend.
const [pattern, setPattern] = useState('');
useEffect(() => { GetWatchlistContestPattern().then((p: string) => setPattern(p ?? '')).catch(() => {}); }, []);
// Live spots per entry — prefix-matched, newest first, deduped per band+mode
// (one line per slot; the freshest spot represents it).
const spotsFor = useMemo(() => {
const map = new Map<string, ClusterSpot[]>();
for (const e of entries) map.set(e.callsign, []);
for (const s of spots) {
for (const e of entries) {
if (matchesEntry(s.dx_call ?? '', e.callsign)) { map.get(e.callsign)!.push(s); break; }
}
}
for (const [k, list] of map) {
const seen = new Set<string>();
map.set(k, list.filter((s) => {
const key = `${(s.band ?? '')}|${inferSpotMode(s.comment ?? '', s.freq_hz)}|${s.dx_call}`;
if (seen.has(key)) return false;
seen.add(key);
return true;
}));
}
return map;
}, [spots, entries]);
// The worked answers, refreshed when the visible slots change. Debounced: a
// spot burst must cost one round trip, not one per spot.
const queryTimer = useRef<number | undefined>(undefined);
useEffect(() => {
if (queryTimer.current) window.clearTimeout(queryTimer.current);
queryTimer.current = window.setTimeout(async () => {
const queries: { call: string; band: string; mode: string; contest: boolean }[] = [];
const keys: string[] = [];
for (const e of entries) {
for (const s of spotsFor.get(e.callsign) ?? []) {
const mode = inferSpotMode(s.comment ?? '', s.freq_hz) || '';
queries.push({ call: s.dx_call, band: s.band ?? '', mode, contest: e.isContest });
keys.push(`${s.dx_call}|${s.band ?? ''}|${mode}|${e.isContest ? 1 : 0}`);
}
}
if (queries.length === 0) { setWorked({}); return; }
try {
const res: boolean[] = (await WatchlistWorkedSlots(queries as any)) ?? [];
// MERGED, not replaced: replacing made every already-answered key
// momentarily unknown on each refresh, which re-hid settled lines.
setWorked((prev) => {
const next = { ...prev };
keys.forEach((k, i) => { next[k] = !!res[i]; });
return next;
});
} catch { /* the badges just stay conservative */ }
}, 150) as unknown as number;
return () => { if (queryTimer.current) window.clearTimeout(queryTimer.current); };
}, [spotsFor, entries]);
const wkey = (e: WLEntry, s: ClusterSpot) =>
`${s.dx_call}|${s.band ?? ''}|${inferSpotMode(s.comment ?? '', s.freq_hz) || ''}|${e.isContest ? 1 : 0}`;
const workedFor = (e: WLEntry, s: ClusterSpot): boolean => worked[wkey(e, s)] ?? false;
// A spot whose verdict has not come back yet is NOT drawn. Showing it as
// Needed and withdrawing it half a second later made the list twitch on
// every burst — and nobody needs a spot 400 ms early, they need it settled.
const settled = (e: WLEntry, s: ClusterSpot): boolean => wkey(e, s) in worked;
const add = async () => {
const c = addCall.trim().toUpperCase();
if (!c) return;
try {
await WatchlistAdd(c, addContest);
setAddCall('');
flash(t(addContest ? 'wl.addedContest' : 'wl.added', { call: c }), false);
await refresh();
} catch (e: any) { flash(String(e?.message ?? e), true); }
};
// One click, like the bell and the trophy beside it: removing a watchlist
// entry is cheap to undo (type it again), so it does not earn a confirmation
// the other two buttons do not have.
const remove = async (call: string) => {
try { await WatchlistRemove(call); flash(t('wl.removed', { call }), false); await refresh(); }
catch (e: any) { flash(String(e?.message ?? e), true); }
};
const isOnAir = (e: WLEntry): boolean =>
(spotsFor.get(e.callsign) ?? []).some((s) => {
const ts = Date.parse(String((s as any).received_at ?? ''));
return ts > 0 && Date.now() - ts < ON_AIR_MS;
});
const shown = entries.filter((e) => {
if (family === 'normal' && e.isContest) return false;
if (family === 'contest' && !e.isContest) return false;
if (search && !e.callsign.includes(search.trim().toUpperCase())) return false;
const list = (spotsFor.get(e.callsign) ?? []).filter(modeMatches).filter((s2) => settled(e, s2));
if (activeOnly && list.length === 0) return false;
if (neededOnly && !list.some((s2) => !workedFor(e, s2))) return false;
return true;
});
const counters = useMemo(() => {
let active = 0, needed = 0;
for (const e of entries) {
const list = (spotsFor.get(e.callsign) ?? []).filter(modeMatches).filter((s2) => settled(e, s2));
if (list.length > 0) active++;
if (list.some((s2) => !workedFor(e, s2))) needed++;
}
return { total: entries.length, active, needed };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [entries, spotsFor, worked, modeFilter]);
// The cluster's own badge for a spot, read from the shared status index.
const dxccBadge = (s: ClusterSpot): { label: string; color: string } | null => {
const st = spotStatus[spotStatusKey(s.dx_call, s.band ?? '', s.comment ?? '', s.freq_hz)];
switch (st?.status) {
case 'new': return { label: t('wl.newDxcc'), color: 'var(--danger)' };
case 'new-band-mode': return { label: t('clg2.newBandMode'), color: 'var(--danger)' };
case 'new-band': return { label: t('clg2.newBand'), color: 'var(--warning)' };
case 'new-mode': return { label: t('clg2.newMode'), color: 'var(--caution)' };
case 'new-slot': return { label: t('clg2.newSlot'), color: '#5AC8FA' };
default: return null;
}
};
const chip = (color: string, text: string, extra?: string) => (
<span className={cn('px-1.5 py-0.5 rounded text-[10px] font-bold border', extra)}
style={{ color, borderColor: `color-mix(in srgb, ${color} 40%, transparent)`, background: `color-mix(in srgb, ${color} 12%, transparent)` }}>
{text}
</span>
);
return (
// Capped and centred: a card is a reading surface, and callsign-to-badge
// lines stretched across a 34-inch window are not readable, they are long.
<div className="flex flex-col min-h-0 flex-1 gap-2 p-2 w-full max-w-5xl mx-auto">
{/* Header: the counters alone, centred — they are the tab's headline.
Everything one INTERACTS with lives on the second row. */}
<div className="flex items-center justify-center gap-2 text-sm text-muted-foreground">
<Eye className="size-4 text-primary shrink-0" />
<span>
{t('wl.cTotal')} <b className="text-foreground">{counters.total}</b>
<span className="mx-1.5 opacity-50">|</span>
{t('wl.cActive')} <b className="text-info">{counters.active}</b>
<span className="mx-1.5 opacity-50">|</span>
{t('wl.cNeeded')} <b className="text-warning">{counters.needed}</b>
</span>
</div>
{/* toolbar */}
<div className="flex items-start justify-between gap-x-3 gap-y-1.5 flex-wrap">
<div className="flex items-center gap-2 shrink-0">
<Input className="h-8 w-40 font-mono placeholder:font-sans placeholder:normal-case" placeholder={t('wl.addPh')} value={addCall}
onChange={(e) => setAddCall(e.target.value.toUpperCase())}
onKeyDown={(e) => { if (e.key === 'Enter') void add(); }} />
<label className="flex items-center gap-1.5 text-xs cursor-pointer" title={t('wl.contestHint')}>
<Checkbox checked={addContest} onCheckedChange={(c) => setAddContest(!!c)} />
<Trophy className="size-3.5 text-warning" /> {t('wl.addAsContest')}
</label>
<Button size="sm" className="h-8" onClick={() => void add()} disabled={!addCall.trim()}>
<Plus className="size-3.5" /> {t('wl.add')}
</Button>
<Input className="h-8 w-28 font-mono placeholder:font-sans placeholder:normal-case" placeholder={t('wl.patternPh')}
title={t('wl.patternHint')}
value={pattern}
onChange={(e) => setPattern(e.target.value.toUpperCase())}
onBlur={() => { void SetWatchlistContestPattern(pattern.trim()); }} />
</div>
<div className="flex items-center gap-2 shrink-0">
<div className="relative">
<Search className="size-3.5 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground" />
<Input className="h-8 w-28 pl-7 text-sm" placeholder={t('wl.searchPh')} value={search}
onChange={(e) => setSearch(e.target.value)} />
</div>
{/* families kept together, told apart — per review of the DXHunter port,
no global contest mode: each entry carries its own rule. */}
<div className="inline-flex rounded-md border border-border overflow-hidden text-xs">
{([['all', t('wl.famAll')], ['normal', t('wl.famNormal')], ['contest', t('wl.famContest')]] as const).map(([k, label]) => (
<button key={k} type="button" onClick={() => setFamily(k)}
className={cn('px-2 py-1 border-l border-border first:border-l-0',
family === k ? 'bg-accent font-medium' : 'text-muted-foreground hover:bg-accent/50')}>
{label}
</button>
))}
</div>
<select value={modeFilter} onChange={(e) => setModeFilter(e.target.value)}
title={t('wl.modeFilter')}
className="h-7 px-1.5 rounded-md border border-border bg-background text-xs text-foreground">
{['ALL', 'CW', 'SSB', 'FT8', 'FT4', 'RTTY', 'DIGI'].map((m) => (
<option key={m} value={m}>{m === 'ALL' ? t('wl.allModes') : m}</option>
))}
</select>
<button type="button" onClick={() => setActiveOnly((v) => !v)}
className={cn('px-2 py-1 rounded-md border text-xs', activeOnly ? 'bg-accent border-border font-medium' : 'border-border text-muted-foreground hover:bg-accent/50')}>
{t('wl.activeOnly')}
</button>
<button type="button" onClick={() => setNeededOnly((v) => !v)}
className={cn('px-2 py-1 rounded-md border text-xs', neededOnly ? 'bg-accent border-border font-medium' : 'border-border text-muted-foreground hover:bg-accent/50')}>
{t('wl.neededOnly')}
</button>
</div>
</div>
{error && <div className="text-xs text-danger px-1">{error}</div>}
{notice && <div className="text-xs text-success px-1">{notice}</div>}
{/* cards */}
<div className="flex-1 min-h-0 overflow-y-auto space-y-2 pr-1">
{shown.length === 0 ? (
<div className="text-sm text-muted-foreground text-center pt-16 max-w-md mx-auto leading-relaxed">
{entries.length === 0 ? t('wl.empty') : t('wl.noneMatch')}
</div>
) : shown.map((e) => {
const all = (spotsFor.get(e.callsign) ?? []).filter(modeMatches).filter((s2) => settled(e, s2));
const needed = all.filter((s) => !workedFor(e, s)).length;
// Needed-only hides the worked LINES as well as the all-worked cards:
// a filter that says needed and still lists five green Worked rows is
// answering a different question than the one asked.
const list = neededOnly ? all.filter((s) => !workedFor(e, s)) : all;
return (
<div key={e.callsign}
className={cn('rounded-lg border bg-card p-3',
needed > 0 ? 'border-warning/50' : 'border-border',
e.isContest && 'border-l-4 border-l-warning')}>
<div className="flex items-center gap-2 flex-wrap">
<span className="text-lg font-bold font-mono text-primary">{e.callsign}</span>
{isOnAir(e) && chip('var(--danger)', t('wl.onAir'), 'animate-pulse')}
{e.isContest && (
<span className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-bold bg-warning-muted text-warning-muted-foreground border border-warning-border"
title={t('wl.contestHint')}>
<Trophy className="size-3" /> {t('wl.contest')}
</span>
)}
{e.isExpedition && chip('var(--chart-5)', t('wl.expedition'))}
{e.clubLogTotalQSOs > 0 && <span className="text-[11px] text-muted-foreground">{e.clubLogTotalQSOs.toLocaleString()} QSOs{e.clubLogQSOs24h > 0 ? ` · ${e.clubLogQSOs24h}/24h` : ''}</span>}
{e.clubLogHasOQRS && chip('var(--success)', 'OQRS')}
{e.clubLogLiveStream && (
<a href="#" onClick={(ev) => { ev.preventDefault(); void OpenExternalURL(`https://clublog.org/livestream/${e.callsign.replace('*', '')}`); }}
className="px-1.5 py-0.5 rounded text-[10px] font-bold border text-info border-info/40 bg-info/10 hover:bg-info/20">Live</a>
)}
{list.length > 0 && (needed > 0
? chip('var(--warning)', e.isContest ? t('wl.nToday', { n: needed }) : t('wl.nNeeded', { n: needed }))
: chip('var(--success)', e.isContest ? t('wl.workedToday') : t('wl.allWorked')))}
{e.lastSeenStr && e.lastSeenStr !== 'Never' && (
<span className="text-[11px] text-muted-foreground">· {e.lastSeenStr}</span>
)}
{e.spotCount > 0 && (
<span className="text-[11px] text-muted-foreground/70">· {t('wl.totalSpots', { n: e.spotCount })}</span>
)}
<div className="flex-1" />
<button type="button" title={t('wl.toggleContest')}
onClick={() => void WatchlistSetContest(e.callsign, !e.isContest).then(refresh)}
className={cn('p-1 rounded hover:bg-muted', e.isContest ? 'text-warning' : 'text-muted-foreground/40')}>
<Trophy className="size-3.5" />
</button>
<button type="button" title={e.notify ? t('wl.notifyOff') : t('wl.notifyOn')}
onClick={() => void WatchlistSetNotify(e.callsign, !e.notify).then(refresh)}
className={cn('p-1 rounded hover:bg-muted', e.notify ? 'text-warning' : 'text-muted-foreground/40')}>
{e.notify ? <Bell className="size-3.5" /> : <BellOff className="size-3.5" />}
</button>
<button type="button" title={t('wl.remove')}
onClick={() => void remove(e.callsign)}
className="p-1 rounded hover:bg-muted text-muted-foreground/40 hover:text-danger">
<Trash2 className="size-3.5" />
</button>
</div>
{list.length > 0 ? (
<div className="mt-2 space-y-1 max-h-52 overflow-y-auto">
{list.slice(0, 12).map((s, i) => {
const done = workedFor(e, s);
const badge = dxccBadge(s);
const mode = inferSpotMode(s.comment ?? '', s.freq_hz);
return (
<button key={i} type="button"
onClick={() => onSpotSelect?.(s)}
onDoubleClick={() => onSpotClick?.(s)}
title={t('wl.spotTip')}
className={cn('w-full flex items-center gap-2 px-2 py-1.5 rounded text-[11px] bg-muted/40 hover:bg-muted text-left',
!done && 'border-l-2 border-warning')}>
{done && <span className='font-bold shrink-0 text-success'></span>}
<span className="font-mono font-bold text-info shrink-0">{s.dx_call}</span>
<span className="text-muted-foreground truncate flex-1 min-w-0 max-w-56">{(s as any).country ?? ''}</span>
<span className="px-1.5 rounded bg-muted shrink-0">{s.band}</span>
{mode && <span className="px-1.5 rounded shrink-0" style={{ color: 'var(--chart-5)', background: 'color-mix(in srgb, var(--chart-5) 12%, transparent)' }}>{mode}</span>}
<span className="font-mono text-muted-foreground shrink-0">{(s.freq_hz / 1e6).toFixed(4)}</span>
{badge && chip(badge.color, badge.label)}
<div className="flex-1" />
{done
? chip('var(--success)', e.isContest ? t('wl.todayOk') : t('wl.worked'))
: chip('var(--warning)', e.isContest ? t('wl.workToday') : t('wl.needed'))}
<span className="text-muted-foreground/70 shrink-0">{s.time_utc ?? ''}</span>
</button>
);
})}
</div>
) : (
<div className="mt-2 text-[11px] text-muted-foreground text-center py-1.5 bg-muted/30 rounded">
{t('wl.noSpots')}
</div>
)}
</div>
);
})}
</div>
</div>
);
}
+29 -1
View File
@@ -38,6 +38,20 @@ const en: Dict = {
'cwd.tipOnCw': 'CW decoder — on (decoding) · click to disable',
'cwd.tipOnIdle': 'CW decoder — on, idle until CW mode · click to disable',
'cwd.tipOff': 'CW decoder · click to enable (decodes RX audio in CW mode)',
'tools.watchlist': 'Watchlist…', 'tab.watchlist': 'Watchlist',
'wl.addPh': 'Callsign or VK9*', 'wl.added': '{call} added to the watchlist.', 'wl.addedContest': '{call} added as a contest entry (judged per UTC day).', 'wl.add': 'Add', 'wl.contest': 'Contest', 'wl.addAsContest': 'as contest', 'wl.cTotal': 'Watchlist:', 'wl.cActive': 'Active:', 'wl.cNeeded': 'Needed:', 'wl.allModes': 'All modes', 'wl.modeFilter': 'Only show spots in this mode', 'wl.patternPh': 'Auto contest (e.g. WWA)', 'wl.patternHint': 'Auto-add as contest: any spotted callsign CONTAINING this text joins the watchlist as a contest entry by itself. Empty = off; collected entries stay.',
'wl.contestHint': 'Contest station: worked/needed is judged against the current UTC day — at 00:00 UTC every slot can be worked again.',
'wl.searchPh': 'Search…', 'wl.famAll': 'All', 'wl.famNormal': 'DX', 'wl.famContest': 'Contest',
'wl.activeOnly': 'Active', 'wl.neededOnly': 'Needed',
'wl.empty': 'Add the callsigns you are hunting. A bare entry matches exactly that call; end it with * for a family — VK9* catches every VK9…, RI0SP* the expedition\u2019s portable forms. Spots from the cluster appear under each entry with what they are worth.',
'wl.noneMatch': 'Nothing matches the current filters.',
'wl.onAir': 'ON AIR', 'wl.expedition': 'DXpedition',
'wl.nNeeded': '{n} needed', 'wl.nToday': '{n} today', 'wl.allWorked': 'All worked', 'wl.workedToday': 'Worked today',
'wl.totalSpots': '{n} spots', 'wl.toggleContest': 'Contest entry: judged per UTC day',
'wl.notifyOn': 'Alert me when this station is spotted', 'wl.notifyOff': 'Stop alerting for this station',
'wl.remove': 'Remove', 'wl.removed': '{call} removed from the watchlist.', 'wl.noSpots': 'No live spots',
'wl.newDxcc': 'NEW DXCC', 'wl.worked': 'Worked', 'wl.needed': 'Needed!', 'wl.todayOk': 'Today ✓', 'wl.workToday': 'Work today!',
'wl.spotTip': 'Click: fill the callsign · double-click: tune and work',
'tools.net': 'NET Control', 'tools.alerts': 'Alert management…', 'tools.contest': 'Contest mode',
'alert.tuneHint': 'Click to tune the rig to this spot (freq + mode) and fill the call', 'alert.dismiss': 'Dismiss', 'alert.pending': '{n} recent spot alert(s) — click to view', 'alert.noneShort': 'No recent alerts', 'alert.recent': 'Recent alerts', 'alert.clear': 'Clear',
'menu.help': 'Help', 'prof.switchTitle': 'Switch station profile', 'prof.manage': 'Manage profiles…', 'logview.title': "Diagnostic log", 'logview.empty': "(log is empty)", 'logview.searchPh': "Filter lines — e.g. cluster, acom, cat", 'logview.matches': "{n} of {total} lines", 'logview.autoScroll': "Follow the end", 'logview.updated': "refreshed {time}", 'logview.copy': "Copy", 'logview.toEnd': "Jump to end", 'help.about': 'About OpsLog', 'help.donate': '♥ Support OpsLog (donate)', 'tools.duplicates': 'Find duplicates…',
@@ -108,7 +122,7 @@ const en: Dict = {
'settings.leftPane': 'Left pane', 'settings.thirdPane': 'Third pane', 'settings.fourthPane': 'Fourth pane', 'settings.paneNone': '— none —', 'settings.paneLayout': 'With four panes:', 'settings.paneQuad': 'Quarters (2 × 2)', 'settings.paneCols': 'Four columns', 'settings.rightPane': 'Right pane',
'settings.pane.map1': 'Map — great-circle + beam', 'settings.pane.map2': 'Map — locator (street)',
'settings.pane.cluster': 'Cluster spots', 'settings.pane.worked': 'Worked before',
'settings.pane.recent': 'Recent QSOs', 'settings.pane.netcontrol': 'Net control', 'settings.pane.decodes': 'FT decodes',
'settings.pane.recent': 'Recent QSOs', 'settings.pane.netcontrol': 'Net control', 'settings.pane.decodes': 'FT decodes', 'settings.pane.watchlist': 'Watchlist',
'settings.pane.flex': 'Flex Console', 'tcip.console': "SunSDR Console", 'settings.pane.tci': "SunSDR Console", 'settings.pane.elecraft': "Elecraft Console", 'tcip.waiting': "Waiting for the radio — TCI is not connected.", 'tcip.meters': "Meters", 'tcip.transmit': "Transmit", 'tcip.receive': "Receive", 'tcip.drive': "Drive", 'tcip.tuneDrive': "Tune drive", 'tcip.mic': "Mic gain", 'tcip.volume': "Volume", 'tcip.squelch': "Squelch", 'tcip.agc': "AGC", 'tcip.filter': "Filter", 'tcip.mute': "MUTE", 'tcip.lock': "LOCK", 'tcip.off': "off", 'tcip.tune': "TUNE", 'tcip.tuning': "TUNING", 'tcip.txDisabled': "The radio is not allowing transmit", 'tcip.sMeterHint': "Click to put this report in the entry form. The radio sends a real signal level in dBm, so the S units are arithmetic rather than a calibration guess.", 'settings.pane.icom': 'Icom Console', 'settings.pane.yaesu': 'Yaesu Console', 'yaesu.notConnected': 'Yaesu CAT not connected', 'yaesu.meters': 'Meters', 'yaesu.bandMode': 'Band & mode', 'yaesu.receive': 'Receive', 'yaesu.noiseFilter': 'Noise & filter', 'yaesu.transmit': 'Transmit', 'yaesu.refresh': 'Refresh', 'yaesu.narrowHint': 'Narrow IF filter (NAR) — tightens the receive bandwidth. Only shown when the radio answers the command.', 'yaesu.tuneHint': 'Start an antenna-tuner cycle', 'yaesu.sToRst': 'Click to fill the RST sent', 'yaesu.sidebandHint': 'Click to select this mode; click again to switch sideband (U/L)', 'yaesu.splitUpHint': 'Transmit this far above the receive frequency, and turn split on', 'yaesu.txOn': 'TX', 'yaesu.cw': 'CW', 'yaesu.breakInHint': 'Break-in: the rig switches to receive between characters', 'yaesu.zinHint': 'Zero-in: retune so the station you hear lands on your CW pitch',
'theme.auto': 'Auto (system)', 'theme.light-warm': 'Warm light', 'theme.light-cool': 'Cool light',
'theme.light-sage': 'Sage light', 'theme.light-nordic': 'Nordic light', 'theme.sahara': 'Sahara', 'theme.dim-slate': 'Dim slate', 'theme.dark-warm': 'Warm dark',
@@ -548,6 +562,20 @@ const fr: Dict = {
'cwd.tipOnCw': 'Décodeur CW — actif (décode) · clic pour désactiver',
'cwd.tipOnIdle': 'Décodeur CW — actif, en veille hors mode CW · clic pour désactiver',
'cwd.tipOff': 'Décodeur CW · clic pour activer (décode laudio RX en mode CW)',
'tools.watchlist': 'Watchlist…', 'tab.watchlist': 'Watchlist',
'wl.addPh': 'Indicatif ou VK9*', 'wl.added': '{call} ajouté à la watchlist.', 'wl.addedContest': '{call} ajouté en entrée contest (jugée par jour UTC).', 'wl.add': 'Ajouter', 'wl.contest': 'Contest', 'wl.addAsContest': 'comme contest', 'wl.cTotal': 'Watchlist :', 'wl.cActive': 'Actives :', 'wl.cNeeded': 'Manquantes :', 'wl.allModes': 'Tous les modes', 'wl.modeFilter': 'Ne montrer que les spots de ce mode', 'wl.patternPh': 'Auto contest (ex. WWA)', 'wl.patternHint': "Ajout auto comme contest : tout indicatif spotté CONTENANT ce texte rejoint la watchlist en entrée contest tout seul. Vide = désactivé ; les entrées déjà collectées restent.",
'wl.contestHint': "Station contest : contacté/manquant est jugé sur la journée UTC courante — à 00:00 UTC chaque créneau redevient à faire.",
'wl.searchPh': 'Chercher…', 'wl.famAll': 'Tous', 'wl.famNormal': 'DX', 'wl.famContest': 'Contest',
'wl.activeOnly': 'Actifs', 'wl.neededOnly': 'Manquants',
'wl.empty': "Ajoutez les indicatifs que vous chassez. Une entrée nue matche exactement ce call ; terminez par * pour une famille — VK9* attrape tous les VK9…, RI0SP* les formes portables de l'expédition. Les spots du cluster apparaissent sous chaque entrée avec ce qu'ils valent.",
'wl.noneMatch': 'Rien ne correspond aux filtres actuels.',
'wl.onAir': 'ON AIR', 'wl.expedition': 'DXpédition',
'wl.nNeeded': '{n} manquants', 'wl.nToday': "{n} aujourd'hui", 'wl.allWorked': 'Tout contacté', 'wl.workedToday': "Contacté aujourd'hui",
'wl.totalSpots': '{n} spots', 'wl.toggleContest': 'Entrée contest : jugée par jour UTC',
'wl.notifyOn': "M'alerter quand cette station est spottée", 'wl.notifyOff': "Ne plus alerter pour cette station",
'wl.remove': 'Supprimer', 'wl.removed': '{call} retiré de la watchlist.', 'wl.noSpots': 'Aucun spot en cours',
'wl.newDxcc': 'NOUV DXCC', 'wl.worked': 'Contacté', 'wl.needed': 'Manquant !', 'wl.todayOk': "Auj. ✓", 'wl.workToday': "À faire auj. !",
'wl.spotTip': "Clic : remplir l'indicatif · double-clic : régler la radio et travailler",
'tools.net': 'Contrôle de NET', 'tools.alerts': 'Gestion des alertes…', 'tools.contest': 'Mode contest',
'alert.tuneHint': 'Cliquer pour accorder la radio sur ce spot (fréq + mode) et remplir l\'indicatif', 'alert.dismiss': 'Fermer', 'alert.pending': '{n} alerte(s) de spot récente(s) — cliquer pour voir', 'alert.noneShort': 'Aucune alerte récente', 'alert.recent': 'Alertes récentes', 'alert.clear': 'Effacer',
'menu.help': 'Aide', 'prof.switchTitle': 'Changer de profil de station', 'prof.manage': 'Gérer les profils…', 'logview.title': "Journal de diagnostic", 'logview.empty': "(journal vide)", 'logview.searchPh': "Filtrer les lignes — ex. cluster, acom, cat", 'logview.matches': "{n} lignes sur {total}", 'logview.autoScroll': "Suivre la fin", 'logview.updated': "actualisé {time}", 'logview.copy': "Copier", 'logview.toEnd': "Aller à la fin", 'help.about': 'À propos d\'OpsLog', 'help.donate': '♥ Soutenir OpsLog (don)', 'tools.duplicates': 'Trouver les doublons…',
+17
View File
@@ -30,6 +30,7 @@ import {lotwusers} from '../models';
import {lookup} from '../models';
import {netctl} from '../models';
import {scp} from '../models';
import {watchlist} from '../models';
export function ACOMSetOperate(arg1:boolean):Promise<void>;
@@ -601,6 +602,8 @@ export function GetUltrabeamSettings():Promise<main.UltrabeamSettings>;
export function GetUltrabeamStatus():Promise<main.UltrabeamStatusInfo>;
export function GetWatchlistContestPattern():Promise<string>;
export function GetWebPublishConfig():Promise<webpub.Config>;
export function GetWebPublishStatus():Promise<main.WebPublishStatus>;
@@ -1227,6 +1230,8 @@ export function SetUIPref(arg1:string,arg2:string):Promise<void>;
export function SetUltrabeamDirection(arg1:number):Promise<void>;
export function SetWatchlistContestPattern(arg1:string):Promise<void>;
export function SetWinkeyerTrace(arg1:boolean):Promise<void>;
export function SetWorkedCallVariants(arg1:boolean):Promise<void>;
@@ -1357,6 +1362,18 @@ export function UploadCallsign(arg1:string):Promise<string>;
export function UploadQSOsManual(arg1:string,arg2:Array<number>):Promise<void>;
export function WatchlistAdd(arg1:string,arg2:boolean):Promise<void>;
export function WatchlistEntries():Promise<Array<watchlist.Entry>>;
export function WatchlistRemove(arg1:string):Promise<void>;
export function WatchlistSetContest(arg1:string,arg2:boolean):Promise<void>;
export function WatchlistSetNotify(arg1:string,arg2:boolean):Promise<void>;
export function WatchlistWorkedSlots(arg1:Array<main.WatchlistSlotQuery>):Promise<Array<boolean>>;
export function WebPublishColumns():Promise<Array<Record<string, string>>>;
export function WinkeyerBackspace():Promise<void>;
+32
View File
@@ -1142,6 +1142,10 @@ export function GetUltrabeamStatus() {
return window['go']['main']['App']['GetUltrabeamStatus']();
}
export function GetWatchlistContestPattern() {
return window['go']['main']['App']['GetWatchlistContestPattern']();
}
export function GetWebPublishConfig() {
return window['go']['main']['App']['GetWebPublishConfig']();
}
@@ -2394,6 +2398,10 @@ export function SetUltrabeamDirection(arg1) {
return window['go']['main']['App']['SetUltrabeamDirection'](arg1);
}
export function SetWatchlistContestPattern(arg1) {
return window['go']['main']['App']['SetWatchlistContestPattern'](arg1);
}
export function SetWinkeyerTrace(arg1) {
return window['go']['main']['App']['SetWinkeyerTrace'](arg1);
}
@@ -2654,6 +2662,30 @@ export function UploadQSOsManual(arg1, arg2) {
return window['go']['main']['App']['UploadQSOsManual'](arg1, arg2);
}
export function WatchlistAdd(arg1, arg2) {
return window['go']['main']['App']['WatchlistAdd'](arg1, arg2);
}
export function WatchlistEntries() {
return window['go']['main']['App']['WatchlistEntries']();
}
export function WatchlistRemove(arg1) {
return window['go']['main']['App']['WatchlistRemove'](arg1);
}
export function WatchlistSetContest(arg1, arg2) {
return window['go']['main']['App']['WatchlistSetContest'](arg1, arg2);
}
export function WatchlistSetNotify(arg1, arg2) {
return window['go']['main']['App']['WatchlistSetNotify'](arg1, arg2);
}
export function WatchlistWorkedSlots(arg1) {
return window['go']['main']['App']['WatchlistWorkedSlots'](arg1);
}
export function WebPublishColumns() {
return window['go']['main']['App']['WebPublishColumns']();
}
+80
View File
@@ -4301,6 +4301,24 @@ export namespace main {
this.text = source["text"];
}
}
export class WatchlistSlotQuery {
call: string;
band: string;
mode: string;
contest: boolean;
static createFrom(source: any = {}) {
return new WatchlistSlotQuery(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.call = source["call"];
this.band = source["band"];
this.mode = source["mode"];
this.contest = source["contest"];
}
}
export class WebPublishStatus {
last_run: string;
last_err: string;
@@ -5990,6 +6008,68 @@ export namespace udp {
}
export namespace watchlist {
export class Entry {
callsign: string;
// Go type: time
lastSeen: any;
lastSeenStr: string;
// Go type: time
addedAt: any;
spotCount: number;
isContest: boolean;
notify: boolean;
isExpedition: boolean;
clubLogQSOs24h: number;
clubLogTotalQSOs: number;
clubLogHasOQRS: boolean;
clubLogLiveStream: boolean;
// Go type: time
clubLogUpdatedAt?: any;
static createFrom(source: any = {}) {
return new Entry(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.callsign = source["callsign"];
this.lastSeen = this.convertValues(source["lastSeen"], null);
this.lastSeenStr = source["lastSeenStr"];
this.addedAt = this.convertValues(source["addedAt"], null);
this.spotCount = source["spotCount"];
this.isContest = source["isContest"];
this.notify = source["notify"];
this.isExpedition = source["isExpedition"];
this.clubLogQSOs24h = source["clubLogQSOs24h"];
this.clubLogTotalQSOs = source["clubLogTotalQSOs"];
this.clubLogHasOQRS = source["clubLogHasOQRS"];
this.clubLogLiveStream = source["clubLogLiveStream"];
this.clubLogUpdatedAt = this.convertValues(source["clubLogUpdatedAt"], null);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
export namespace webpub {
export class Config {
+33
View File
@@ -2003,6 +2003,39 @@ func bandStatusCode(callWorked, callConfirmed, entityConfirmed bool) int {
// modeClass collapses ADIF modes into the three buckets DXers care about.
// Anything not voice and not CW is treated as digital.
// ModeClass is modeClass for callers outside the package — the watchlist
// judges slots at the same grain the cluster does.
func ModeClass(mode string) string { return modeClass(mode) }
// SlotRow is one (callsign, band, mode) triple from SlotsSince.
type SlotRow struct {
Callsign string
Band string
Mode string
}
// SlotsSince lists the slots of every contact made since the given instant —
// the contest watchlist's "worked today", where the day boundary lives in this
// query's bound and nowhere else.
func (r *Repo) SlotsSince(ctx context.Context, since time.Time) ([]SlotRow, error) {
rows, err := r.db.QueryContext(ctx,
"SELECT callsign, band, mode FROM qso WHERE qso_date >= ?",
since.UTC().Format(isoMillis))
if err != nil {
return nil, err
}
defer rows.Close()
var out []SlotRow
for rows.Next() {
var sr SlotRow
if err := rows.Scan(&sr.Callsign, &sr.Band, &sr.Mode); err != nil {
return nil, err
}
out = append(out, sr)
}
return out, rows.Err()
}
func modeClass(mode string) string {
switch strings.ToUpper(mode) {
case "SSB", "USB", "LSB", "AM", "FM", "DIGITALVOICE", "PHONE":
+131
View File
@@ -0,0 +1,131 @@
package watchlist
// ClubLog enrichment — phase 2 of the DXHunter port. clublog.org/watch.php
// answers, per callsign: is this an expedition, does it run OQRS, is there a
// LiveStream, the log's QSO total and the last 24 hours' rate. That block has
// been in the Entry schema since phase 1 (the file round-trips DXHunter's);
// this file finally fills it.
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
)
// WatchData is clublog.org/watch.php's answer, reduced to what the tab shows.
type WatchData struct {
IsExpedition bool `json:"is_expedition"`
HasOQRS bool `json:"has_oqrs"`
LiveStream bool `json:"livestream"`
ClubLogInfo *struct {
TotalQSOs int `json:"total_qsos"`
} `json:"clublog_info"`
// {} when populated, [] when empty — RawMessage swallows both shapes.
QSOsPerBand json.RawMessage `json:"24h_qsos_per_band_mode"`
}
// QSOs24h sums the per-band/per-mode counts.
func (d *WatchData) QSOs24h() int {
if len(d.QSOsPerBand) == 0 {
return 0
}
var parsed map[string]map[string]int
if err := json.Unmarshal(d.QSOsPerBand, &parsed); err != nil {
return 0 // "[]" for an empty answer lands here, which is the right zero
}
n := 0
for _, modes := range parsed {
for _, c := range modes {
n += c
}
}
return n
}
// FetchWatch asks ClubLog about one callsign. A 404 is "ClubLog has no log for
// this call" — an ordinary answer, not an error.
func FetchWatch(ctx context.Context, client *http.Client, apiKey, callsign string) (*WatchData, error) {
url := fmt.Sprintf("https://clublog.org/watch.php?call=%s&api=%s",
strings.ToUpper(strings.TrimSpace(callsign)), apiKey)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, err
}
req.Header.Set("User-Agent", "OpsLog")
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusNotFound {
return &WatchData{}, nil
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("clublog watch %s: HTTP %d", callsign, resp.StatusCode)
}
body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
if err != nil {
return nil, err
}
if len(strings.TrimSpace(string(body))) == 0 {
return &WatchData{}, nil
}
var data WatchData
if err := json.Unmarshal(body, &data); err != nil {
return nil, fmt.Errorf("clublog watch %s: %w", callsign, err)
}
return &data, nil
}
// ApplyClubLog writes one answer into the entry and reports whether anything
// the tab shows actually changed — the caller only broadcasts on true.
func (s *Store) ApplyClubLog(callsign string, d *WatchData) bool {
s.mu.Lock()
defer s.mu.Unlock()
e, ok := s.entries[strings.ToUpper(strings.TrimSpace(callsign))]
if !ok {
return false
}
total := e.ClubLogTotalQSOs
if d.ClubLogInfo != nil {
total = d.ClubLogInfo.TotalQSOs
}
q24 := d.QSOs24h()
changed := e.IsExpedition != d.IsExpedition || e.ClubLogHasOQRS != d.HasOQRS ||
e.ClubLogLiveStream != d.LiveStream || e.ClubLogTotalQSOs != total ||
e.ClubLogQSOs24h != q24
e.IsExpedition = d.IsExpedition
e.ClubLogHasOQRS = d.HasOQRS
e.ClubLogLiveStream = d.LiveStream
e.ClubLogTotalQSOs = total
e.ClubLogQSOs24h = q24
e.ClubLogUpdatedAt = time.Now()
s.scheduleSave()
return changed
}
// StaleEntries lists the callsigns whose ClubLog block is due a refresh.
// Expeditions age faster — their totals are the interesting number and move by
// the hour; a quiet call is asked about four times a day at most.
func (s *Store) StaleEntries(expTTL, otherTTL time.Duration) []string {
s.mu.RLock()
defer s.mu.RUnlock()
now := time.Now()
var out []string
for call, e := range s.entries {
// A starred pattern is a family, not a station — ClubLog has no log
// for "VK9*". The base (star stripped) is what gets asked about.
ttl := otherTTL
if e.IsExpedition {
ttl = expTTL
}
if now.Sub(e.ClubLogUpdatedAt) >= ttl {
out = append(out, call)
}
}
return out
}
+268
View File
@@ -0,0 +1,268 @@
// Package watchlist is the DXHunter watchlist, transplanted: a list of
// callsigns (or prefixes) the operator is hunting, matched against the live
// spot stream, with per-entry state that survives restarts.
//
// The JSON file is DXHunter's OWN schema, field for field — including the
// ClubLog expedition block this phase does not fill yet. Deliberate: the
// operator asked to carry their watchlist.json across, and a file that
// round-trips unchanged is the whole of "same format". The file is GLOBAL
// (dataDir, beside nets.json), not per profile: a DXpedition worth hunting is
// worth hunting whichever station is on.
//
// The CONTEST idea is per entry, not a global mode as in DXHunter: an entry
// marked contest is judged against the CURRENT UTC DAY — at midnight UTC
// yesterday's contacts stop counting and every slot reads "work today" again.
// Nothing resets and nothing is stored for it: the day boundary lives in the
// query, which is why it cannot drift or need a timer.
package watchlist
import (
"encoding/json"
"fmt"
"os"
"sort"
"strings"
"sync"
"time"
)
// Entry is one watched callsign. JSON tags match DXHunter's watchlist.json
// exactly — see the package comment before renaming anything.
type Entry struct {
Callsign string `json:"callsign"`
LastSeen time.Time `json:"lastSeen"`
LastSeenStr string `json:"lastSeenStr"`
AddedAt time.Time `json:"addedAt"`
SpotCount int `json:"spotCount"`
IsContest bool `json:"isContest"`
Notify bool `json:"notify"`
// ClubLog expedition enrichment — phase 2. Carried so a DXHunter file
// round-trips; not filled by OpsLog yet.
IsExpedition bool `json:"isExpedition"`
ClubLogQSOs24h int `json:"clubLogQSOs24h"`
ClubLogTotalQSOs int `json:"clubLogTotalQSOs"`
ClubLogHasOQRS bool `json:"clubLogHasOQRS"`
ClubLogLiveStream bool `json:"clubLogLiveStream"`
ClubLogUpdatedAt time.Time `json:"clubLogUpdatedAt,omitempty"`
}
// Store owns the file. All methods are safe for concurrent use; writes are
// debounced so a burst of MarkSeen calls costs one disk write.
type Store struct {
mu sync.RWMutex
entries map[string]*Entry
path string
saveMu sync.Mutex
saveTimer *time.Timer
ioMu sync.Mutex
}
func New(path string) *Store {
s := &Store{entries: map[string]*Entry{}, path: path}
s.load()
return s
}
func (s *Store) load() {
data, err := os.ReadFile(s.path)
if err != nil {
return // absent on first run — created on first save
}
var list []Entry
if err := json.Unmarshal(data, &list); err != nil {
return // a corrupt file must not take the app down; it is left for repair
}
s.mu.Lock()
defer s.mu.Unlock()
for i := range list {
e := list[i]
e.Callsign = strings.ToUpper(strings.TrimSpace(e.Callsign))
if e.Callsign == "" {
continue
}
s.entries[e.Callsign] = &e
}
}
// Entries returns a snapshot, watched-first ordering left to the UI.
func (s *Store) Entries() []Entry {
s.mu.RLock()
defer s.mu.RUnlock()
out := make([]Entry, 0, len(s.entries))
for _, e := range s.entries {
c := *e
c.LastSeenStr = lastSeenLabel(c.LastSeen)
out = append(out, c)
}
sort.Slice(out, func(i, j int) bool { return out[i].Callsign < out[j].Callsign })
return out
}
// Add creates an entry; contest marks it as re-workable every UTC day. A
// trailing * makes the entry a prefix (VK9* catches every VK9…); anywhere else
// the star is refused rather than silently matching nothing.
func (s *Store) Add(callsign string, contest bool) error {
call := strings.ToUpper(strings.TrimSpace(callsign))
if call == "" {
return fmt.Errorf("callsign required")
}
if i := strings.Index(call, "*"); i >= 0 && i != len(call)-1 {
return fmt.Errorf("* is only allowed at the end (VK9*)")
}
if call == "*" {
return fmt.Errorf("a bare * would match every spot")
}
s.mu.Lock()
defer s.mu.Unlock()
if _, ok := s.entries[call]; ok {
return fmt.Errorf("%s is already on the watchlist", call)
}
s.entries[call] = &Entry{Callsign: call, AddedAt: time.Now(), IsContest: contest}
s.scheduleSave()
return nil
}
// Remove deletes an entry.
func (s *Store) Remove(callsign string) error {
call := strings.ToUpper(strings.TrimSpace(callsign))
s.mu.Lock()
defer s.mu.Unlock()
if _, ok := s.entries[call]; !ok {
return fmt.Errorf("%s is not on the watchlist", call)
}
delete(s.entries, call)
s.scheduleSave()
return nil
}
// SetNotify arms or disarms the alert for one entry.
func (s *Store) SetNotify(callsign string, on bool) error {
return s.patch(callsign, func(e *Entry) { e.Notify = on })
}
// SetContest flips the per-entry contest rule.
func (s *Store) SetContest(callsign string, on bool) error {
return s.patch(callsign, func(e *Entry) { e.IsContest = on })
}
func (s *Store) patch(callsign string, fn func(*Entry)) error {
call := strings.ToUpper(strings.TrimSpace(callsign))
s.mu.Lock()
defer s.mu.Unlock()
e, ok := s.entries[call]
if !ok {
return fmt.Errorf("%s is not on the watchlist", call)
}
fn(e)
s.scheduleSave()
return nil
}
// Match returns the entry a spotted callsign belongs to, or "".
//
// EXACT unless the entry says otherwise: N8W matches only N8W, and it takes
// N8W* to catch N8WCR. The first version prefix-matched everything, DXHunter
// style, and a three-letter special-event call swallowed every longer call
// sharing its start — N8W lit up for N8WCR, which is a different station
// entirely. The operator writes the star when they MEAN a family (VK9*, an
// expedition's portable forms via RI0SP*); a bare entry means that call.
func (s *Store) Match(callsign string) (string, bool) {
call := strings.ToUpper(strings.TrimSpace(callsign))
if call == "" {
return "", false
}
s.mu.RLock()
defer s.mu.RUnlock()
for pattern := range s.entries {
if PatternMatches(pattern, call) {
return pattern, true
}
}
return "", false
}
// PatternMatches reports whether one watchlist pattern covers a callsign:
// exact equality, or — with a trailing * — a prefix.
func PatternMatches(pattern, call string) bool {
if p, ok := strings.CutSuffix(pattern, "*"); ok {
return p != "" && strings.HasPrefix(call, p)
}
return call == pattern
}
// MarkSeen records a spot against the matching entry and reports whether the
// entry wants an alert.
func (s *Store) MarkSeen(callsign string) (entry string, notify bool, ok bool) {
pattern, found := s.Match(callsign)
if !found {
return "", false, false
}
s.mu.Lock()
defer s.mu.Unlock()
e := s.entries[pattern]
if e == nil {
return "", false, false
}
e.LastSeen = time.Now()
e.SpotCount++
s.scheduleSave()
return e.Callsign, e.Notify, true
}
// scheduleSave debounces the write: a burst of spots costs one file write two
// seconds after the last of them. Callers hold s.mu.
func (s *Store) scheduleSave() {
s.saveMu.Lock()
defer s.saveMu.Unlock()
if s.saveTimer != nil {
s.saveTimer.Stop()
}
s.saveTimer = time.AfterFunc(2*time.Second, func() { s.persist() })
}
func (s *Store) persist() {
list := s.Entries()
data, err := json.MarshalIndent(list, "", " ")
if err != nil {
return
}
s.ioMu.Lock()
defer s.ioMu.Unlock()
_ = os.WriteFile(s.path, data, 0o644)
}
// Flush writes now — for shutdown, where the two-second debounce would lose
// the last edits.
func (s *Store) Flush() { s.persist() }
// lastSeenLabel is DXHunter's "Just now / 5m ago / 3h ago / 2d ago" string,
// computed at read time so it never goes stale in the file.
func lastSeenLabel(t time.Time) string {
if t.IsZero() {
return "Never"
}
d := time.Since(t)
switch {
case d < time.Minute:
return "Just now"
case d < time.Hour:
return fmt.Sprintf("%dm ago", int(d.Minutes()))
case d < 24*time.Hour:
return fmt.Sprintf("%dh ago", int(d.Hours()))
default:
return fmt.Sprintf("%dd ago", int(d.Hours()/24))
}
}
// Get returns one entry by its exact name — the alert path needs its contest
// flag after MarkSeen named it.
func (s *Store) Get(callsign string) (Entry, bool) {
s.mu.RLock()
defer s.mu.RUnlock()
e, ok := s.entries[strings.ToUpper(strings.TrimSpace(callsign))]
if !ok {
return Entry{}, false
}
return *e, true
}
+92
View File
@@ -0,0 +1,92 @@
package watchlist
import (
"encoding/json"
"os"
"path/filepath"
"testing"
)
func TestGlobMatch(t *testing.T) {
s := New(filepath.Join(t.TempDir(), "watchlist.json"))
if err := s.Add("RI0SP*", false); err != nil {
t.Fatal(err)
}
if err := s.Add("N8W", false); err != nil {
t.Fatal(err)
}
// A starred entry is a family: the expedition's portable forms.
for _, call := range []string{"RI0SP", "RI0SP/MM", "RI0SP/P"} {
if _, ok := s.Match(call); !ok {
t.Errorf("Match(%q) = false, want true", call)
}
}
// A bare entry is THAT call — the reported bug was N8W lighting up for
// N8WCR, a different station entirely.
if _, ok := s.Match("N8W"); !ok {
t.Error("exact entry must match its own call")
}
if _, ok := s.Match("N8WCR"); ok {
t.Error("exact entry must NOT match a longer call")
}
if _, ok := s.Match("RI0S"); ok {
t.Error("a SHORTER call must not match a starred entry")
}
if err := s.Add("VK*9", false); err == nil {
t.Error("a mid-string star must be refused")
}
if err := s.Add("*", false); err == nil {
t.Error("a bare star must be refused")
}
}
func TestDXHunterFileRoundTrips(t *testing.T) {
// A real DXHunter entry, ClubLog block included. It must survive
// load → save byte-meaningfully: same keys, values preserved.
src := `[{"callsign":"C5SP","lastSeen":"0001-01-01T00:00:00Z","lastSeenStr":"Never",
"addedAt":"2026-01-17T00:18:43.89Z","spotCount":7,"isContest":true,"notify":true,
"isExpedition":true,"clubLogQSOs24h":120,"clubLogTotalQSOs":30500,
"clubLogHasOQRS":true,"clubLogLiveStream":true,"clubLogUpdatedAt":"2026-08-28T22:32:18Z"}]`
dir := t.TempDir()
path := filepath.Join(dir, "watchlist.json")
if err := os.WriteFile(path, []byte(src), 0o644); err != nil {
t.Fatal(err)
}
s := New(path)
s.Flush()
out, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
var list []map[string]any
if err := json.Unmarshal(out, &list); err != nil {
t.Fatal(err)
}
if len(list) != 1 {
t.Fatalf("got %d entries", len(list))
}
e := list[0]
for k, want := range map[string]any{
"callsign": "C5SP", "isContest": true, "notify": true,
"isExpedition": true, "clubLogQSOs24h": float64(120),
"clubLogTotalQSOs": float64(30500), "clubLogHasOQRS": true,
} {
if e[k] != want {
t.Errorf("%s = %v, want %v", k, e[k], want)
}
}
}
func TestMarkSeenAndNotify(t *testing.T) {
s := New(filepath.Join(t.TempDir(), "watchlist.json"))
_ = s.Add("HB040A", false)
_ = s.SetNotify("HB040A", true)
entry, notify, ok := s.MarkSeen("HB040A")
if !ok || !notify || entry != "HB040A" {
t.Fatalf("MarkSeen = %q %v %v", entry, notify, ok)
}
list := s.Entries()
if list[0].SpotCount != 1 || list[0].LastSeenStr != "Just now" {
t.Errorf("entry after MarkSeen: %+v", list[0])
}
}