Compare commits

..
6 Commits
Author SHA1 Message Date
rouggy ec71dd1661 chore: release v0.24.1 2026-08-09 17:02:13 +02:00
rouggy 31f9bdfc98 fix(qsolist): let the Max box be lowered
The input was bound straight to the number and committed on every keystroke, so
it could not be EMPTIED: clearing it yields "", Number("") is 0, 0 fails the
"> 0" guard, the state never moved, and value={qsoLimit} snapped the old figure
straight back. Going from 200000 down to 100 was a fight against the field — and
read as the setting refusing to persist, which it was not: writeUiPref stores it
and syncPortablePrefs makes the database authoritative at boot. It also wrote
the preference once per keystroke (1, then 10, then 100).

Raw text in local state, committed on blur or Enter, per the controlled-input
note in CLAUDE.md.
2026-08-09 17:00:46 +02:00
rouggy 57e98139ab perf(awards): release the logbook snapshot once it goes cold
Opening the Awards panel pulls every QSO into a cached slice and kept it for the rest of the session: the cache was only ever invalidated by a logbook change, never by disuse. Each cached QSO is a 1896-byte struct plus its strings AND a decoded map of its ADIF extras - one map allocation per QSO. Harmless at 30k rows, several hundred megabytes at 132k, which is where it was reported. A janitor drops it after 15 minutes without a reader and calls FreeOSMemory, because Go hands pages back lazily and the whole point is that the operator sees the memory return. 15 minutes is deliberately generous: an awards session recomputes every few seconds and re-pulling a large remote logbook costs seconds. The heap size is now logged when the snapshot is built and when it is released - a memory report was unanswerable without a number.
2026-08-09 16:57:12 +02:00
rouggy b10a867125 perf(cluster): batch the console lines instead of one render per line
Every line of cluster traffic went straight to state: a spread copy of a 2000-element array, a slice copy, and a React render, per line. An RBN feed sends hundreds a second, so that was tens of MB/s of garbage in the renderer and hundreds of re-renders - and it ran whether the console was open or not, so the cost was paid for a panel nobody was looking at. Reported on an old PC where the UI had stopped responding. Lines are staged in a ref and flushed on a 200 ms timer, the same shape the spot handler already uses. The staging buffer is bounded too, so a burst longer than the console can show is not carried in full just to be sliced away on commit.
2026-08-09 16:48:33 +02:00
rouggy 17819ea673 fix(update): survive an exe that cannot be renamed
Several operators hit "stage current exe: rename …\OpsLog.exe …\OpsLog.exe.old:
Accès refusé" and could not update again. Two separate causes, both ours to
handle.

The staging name was fixed. os.Rename replaces its target, so a single leftover
".old" that could not be deleted — a scanner holding it open is the usual
reason, and the pre-existing os.Remove was best-effort and ignored — made every
later update fail with that error, permanently, recoverable only by deleting the
file by hand. Staging now uses a unique ".old-<nanos>", which no leftover can
block, and the startup cleanup sweeps the pattern instead of one name.

Renaming a running image is legal on Windows, but some endpoint protection
(Bitdefender's ransomware remediation among them) blocks it outright, and no
retry gets past that. So the swap is deferred: the new build is parked beside
the old one and a detached helper moves it into place after this process exits,
when the file is no longer a running image. It keeps trying for ten seconds,
since a scanner tends to let go a beat after the process dies.

A short retry stays in front of both, for the ordinary case of a scanner holding
the file it has just watched being written.

If even the deferred move fails, OpsLog restarts on the CURRENT version rather
than leaving the operator with nothing — someone mid-QSO losing their logger is
worse than an update that waits — and only a successful swap passes
--post-update, so the download survives for the next attempt instead of being
swept by the cleanup.
2026-08-09 15:38:50 +02:00
rouggy a8fac52400 feat(bandmap): drag the width, and remember it
Both band maps were pinned to a hardcoded width — 300px docked beside the
tables, 260px per card in the Band map tab. On a busy band the map could not be
given more room, and on a quiet one the log could not take it back.

The docked map becomes a resizable grid column with the grip in the gap between
the panes, so the handle costs no space; the tab cards share one width with the
grip on their right edge. Side-by-side columns of different widths read as a
mistake rather than a choice, which is why the tab has one width and not one
per card. Double-click either grip to return to the default.

The drag measures from the pointer's START position rather than the container,
so the same helper serves both edges — the docked map sits on the left or the
right depending on the operator's setting, and the grip is on its inner edge
either way. Pointer capture, like the main splitter: without it the map or the
grid under the cursor swallows the moves.

Both widths are persisted through writeUiPref and registered as portable, so
they travel with the data folder like the main splitter and the rest of the
layout.
2026-08-09 13:12:43 +02:00
8 changed files with 318 additions and 33 deletions
+51 -2
View File
@@ -11,6 +11,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime"
"runtime/debug" "runtime/debug"
"sort" "sort"
"strconv" "strconv"
@@ -688,6 +689,7 @@ type App struct {
awardSnapMu sync.Mutex // guards the award QSO snapshot awardSnapMu sync.Mutex // guards the award QSO snapshot
awardSnap []qso.QSO // light-scanned + enriched logbook snapshot reused across award computations awardSnap []qso.QSO // light-scanned + enriched logbook snapshot reused across award computations
awardSnapRev string // logbook revision the snapshot was built at ("" = none) awardSnapRev string // logbook revision the snapshot was built at ("" = none)
awardSnapUsed time.Time // last read — the snapshot is dropped once it goes cold (see awardSnapshotJanitor)
dataDir string // <exeDir>/data — holds config.json, logs, cty.dat dataDir string // <exeDir>/data — holds config.json, logs, cty.dat
// shuttingDown gates beforeClose re-entry: the first user attempt to // shuttingDown gates beforeClose re-entry: the first user attempt to
@@ -1235,6 +1237,7 @@ func (a *App) startup(ctx context.Context) {
// behind telnet). // behind telnet).
a.clusterEvents = newClusterQueue() a.clusterEvents = newClusterQueue()
go a.clusterEventWorker() go a.clusterEventWorker()
go a.awardSnapshotJanitor() // give the award snapshot's memory back once it goes cold
a.cluster = cluster.NewManager( a.cluster = cluster.NewManager(
// onSpot / onLine run on the session's socket-read goroutine, so they must // onSpot / onLine run on the session's socket-read goroutine, so they must
@@ -4172,6 +4175,7 @@ func (a *App) awardSnapshot() ([]qso.QSO, error) {
a.awardSnapMu.Lock() a.awardSnapMu.Lock()
if a.awardSnap != nil && a.awardSnapRev == rev { if a.awardSnap != nil && a.awardSnapRev == rev {
qs := a.awardSnap qs := a.awardSnap
a.awardSnapUsed = time.Now()
a.awardSnapMu.Unlock() a.awardSnapMu.Unlock()
return qs, nil return qs, nil
} }
@@ -4187,18 +4191,63 @@ func (a *App) awardSnapshot() ([]qso.QSO, error) {
}); err != nil { }); err != nil {
return nil, err return nil, err
} }
applog.Printf("awardSnapshot: pulled %d qsos from logbook in %v (rev=%s)", // Heap alongside the row count: this snapshot is the single largest thing
len(all), time.Since(t0).Round(time.Millisecond), rev) // OpsLog holds, and "OpsLog is eating memory" reports are unanswerable
// without a number. A 132 000-QSO logbook was the case that prompted it.
var ms runtime.MemStats
runtime.ReadMemStats(&ms)
applog.Printf("awardSnapshot: pulled %d qsos from logbook in %v (rev=%s) — go heap now %d MB",
len(all), time.Since(t0).Round(time.Millisecond), rev, ms.HeapAlloc/(1024*1024))
if revErr == nil { if revErr == nil {
a.awardSnapMu.Lock() a.awardSnapMu.Lock()
a.awardSnap = all a.awardSnap = all
a.awardSnapRev = rev a.awardSnapRev = rev
a.awardSnapUsed = time.Now()
a.awardSnapMu.Unlock() a.awardSnapMu.Unlock()
} }
return all, nil return all, nil
} }
// awardSnapIdleTTL is how long the snapshot survives without a reader.
//
// Generous on purpose: an operator working through the Awards panel triggers a
// computation every few seconds, and re-pulling costs seconds on a big remote
// logbook. This is only meant to catch the far commoner case — awards looked at
// once, then hours of logging with several hundred megabytes still held.
const awardSnapIdleTTL = 15 * time.Minute
// awardSnapshotJanitor drops the award snapshot once nothing has read it for a
// while, and returns the memory to the OS.
//
// The snapshot is a whole logbook of QSO structs, each carrying a decoded map of
// its ADIF extras: ~1.9 KB of struct plus strings and one map allocation per
// QSO. At 30 000 QSOs that is tens of megabytes and nobody notices; at 132 000
// it is several hundred, held for the rest of the session because the cache had
// no expiry — only invalidation when the logbook changed.
func (a *App) awardSnapshotJanitor() {
for {
time.Sleep(time.Minute)
a.awardSnapMu.Lock()
n := len(a.awardSnap)
idle := !a.awardSnapUsed.IsZero() && time.Since(a.awardSnapUsed) > awardSnapIdleTTL
if a.awardSnap != nil && idle {
a.awardSnap = nil
a.awardSnapRev = ""
}
a.awardSnapMu.Unlock()
if n > 0 && idle {
// FreeOSMemory, not just GC: Go hands pages back lazily, and the whole
// point here is that the operator sees the memory come back.
debug.FreeOSMemory()
var ms runtime.MemStats
runtime.ReadMemStats(&ms)
applog.Printf("awardSnapshot: released %d cached qsos after %v idle — go heap now %d MB",
n, awardSnapIdleTTL, ms.HeapAlloc/(1024*1024))
}
}
}
// GetAwardStats computes the worked/confirmed/validated reference counts of one // GetAwardStats computes the worked/confirmed/validated reference counts of one
// award, broken down by band and by mode category (All/CW/Digital/Phone). // award, broken down by band and by mode category (All/CW/Digital/Phone).
func (a *App) GetAwardStats(code string) (AwardStatsResult, error) { func (a *App) GetAwardStats(code string) (AwardStatsResult, error) {
+18
View File
@@ -1,4 +1,22 @@
[ [
{
"version": "0.24.1",
"date": "",
"en": [
"Recent QSOs: the Max box can be lowered again. It could not be emptied — clearing it put the old number straight back — so going from a large figure down to a small one was a fight against the field, and looked like the setting refusing to stick. Type freely now and press Enter (or click away) to apply. The value was already saved and travels with your data folder; only the box was in the way.",
"Memory: the awards cache is given back once you stop using it. Opening the Awards panel loads the whole logbook into memory and kept it there for the rest of the session — a few tens of megabytes on a small log, but several hundred on a large one, and it was never released because the cache only expired when the logbook changed. It is now dropped after fifteen minutes without use, and the memory returned to Windows. Fifteen minutes on purpose: working through your awards keeps it warm, since reloading a large log takes seconds. The log also records the heap size each time the cache is built or released, so a memory report can be answered with a figure instead of a guess.",
"Performance: the DX-cluster console no longer drags the whole interface down. Every line of traffic — spots, MOTD, everything — was applied to the screen one at a time, and an RBN feed alone sends hundreds a second: that meant two copies of a 2000-line buffer and a redraw for each one, whether the console was open or not. Lines are now grouped and applied five times a second. The difference is most visible on an older PC, where this alone could make the app crawl.",
"Update: \"stage current exe: … Accès refusé\" is fixed. Two causes, both handled. The previous build was always staged under the same name, so one leftover that could not be deleted — an antivirus holding it open is the usual reason — blocked every later update, permanently, with no way out but deleting the file by hand; the staging name is now unique. And when the running program cannot be renamed at all, which some endpoint protection deliberately prevents, OpsLog no longer gives up: it leaves the new build beside the old one and swaps them after closing, when its own file is an ordinary file again. If even that fails, OpsLog restarts on the current version rather than leaving you with nothing, and the download is kept for the next attempt.",
"Band map: the width can be dragged. Both the map docked beside the tables and the per-band cards in the Band map tab were locked at a fixed width, so an operator watching a busy band could not give the map more room — nor take it back for the log. Grab the edge to resize, double-click it to go back to the default. The width is remembered and travels with your data folder, like the other layout settings. In the tab, one width applies to every card: they sit side by side, and columns of different widths read as a mistake."
],
"fr": [
"QSO récents : la case Max se laisse enfin baisser. Impossible de la vider — l'effacer y remettait aussitôt l'ancien nombre — donc passer d'un grand chiffre à un petit était un combat contre le champ, et donnait l'impression que le réglage ne tenait pas. Tape librement puis Entrée (ou clique ailleurs) pour appliquer. La valeur était déjà enregistrée et voyage avec ton dossier de données ; c'était la case qui bloquait.",
"Mémoire : le cache des diplômes est rendu quand tu ne t'en sers plus. Ouvrir le panneau Diplômes charge tout le journal en mémoire et l'y gardait jusqu'à la fermeture — quelques dizaines de Mo sur un petit journal, plusieurs centaines sur un gros, et jamais libérés puisque le cache n'expirait qu'au changement du journal. Il est désormais abandonné après quinze minutes sans usage, et la mémoire rendue à Windows. Quinze minutes volontairement : parcourir tes diplômes le garde chaud, recharger un gros journal coûtant plusieurs secondes. Le journal technique note aussi la taille du tas à chaque construction ou libération, pour qu'un signalement de mémoire se réponde avec un chiffre plutôt qu'une supposition.",
"Performance : la console du cluster DX ne plombe plus toute l'interface. Chaque ligne de trafic — spots, MOTD, tout — était appliquée à l'écran une par une, et un flux RBN en envoie à lui seul des centaines par seconde : cela faisait deux copies d'un tampon de 2000 lignes et un redessin pour chacune, que la console soit ouverte ou non. Les lignes sont désormais groupées et appliquées cinq fois par seconde. La différence se voit surtout sur un PC ancien, où cela suffisait à faire ramer l'application.",
"Mise à jour : le « stage current exe : … Accès refusé » est corrigé. Deux causes, traitées toutes les deux. L'ancienne version était toujours mise de côté sous le même nom : un seul reliquat impossible à supprimer — un antivirus qui le garde ouvert, le plus souvent — bloquait définitivement toutes les mises à jour suivantes, sans autre issue que d'effacer le fichier à la main ; ce nom est désormais unique. Et quand le programme en cours d'exécution ne peut pas être renommé du tout, ce que certaines protections empêchent volontairement, OpsLog n'abandonne plus : il laisse la nouvelle version à côté de l'ancienne et les échange après sa fermeture, quand son propre fichier redevient un fichier ordinaire. Si même cela échoue, OpsLog redémarre sur la version actuelle plutôt que de te laisser sans rien, et le téléchargement est conservé pour la prochaine tentative.",
"Band map : la largeur se règle à la souris. La carte ancrée à côté des tableaux et les cartes par bande de l'onglet Band map étaient figées à une largeur fixe : impossible de donner plus de place à la carte sur une bande chargée, ni de la reprendre pour le journal. Attrape le bord pour redimensionner, double-clic pour revenir au défaut. La largeur est mémorisée et voyage avec ton dossier de données, comme les autres réglages de disposition. Dans l'onglet, une seule largeur vaut pour toutes les cartes : elles sont côte à côte, et des colonnes de largeurs différentes se lisent comme une erreur."
]
},
{ {
"version": "0.24.0", "version": "0.24.0",
"date": "", "date": "",
+135 -14
View File
@@ -907,6 +907,49 @@ export default function App() {
return Number.isFinite(n) && n >= 15 && n <= 85 ? n : 50; return Number.isFinite(n) && n >= 15 && n <= 85 ? n : 50;
}); });
useEffect(() => { writeUiPref('opslog.mainSplit', String(Math.round(mainSplit))); }, [mainSplit]); useEffect(() => { writeUiPref('opslog.mainSplit', String(Math.round(mainSplit))); }, [mainSplit]);
// Band-map widths. Two of them, because they are two different things: the
// docked map sits beside the tables and competes with them for room, while
// the cards in the Band map tab share a scrolling row and want to be uniform.
// Both were hardcoded — 300px and 260px — so an operator watching a busy band
// could not give the map the space it needed, nor claw it back for the log.
const BANDMAP_W_DEFAULT = 300, BANDMAP_W_MIN = 200, BANDMAP_W_MAX = 900;
const BANDMAP_TAB_W_DEFAULT = 260, BANDMAP_TAB_W_MIN = 160, BANDMAP_TAB_W_MAX = 700;
const readWidth = (key: string, def: number, min: number, max: number) => {
const n = parseFloat(localStorage.getItem(key) || '');
return Number.isFinite(n) && n >= min && n <= max ? n : def;
};
const [bandMapWidth, setBandMapWidth] = useState<number>(
() => readWidth('opslog.bandMapWidth', BANDMAP_W_DEFAULT, BANDMAP_W_MIN, BANDMAP_W_MAX));
const [bandMapTabWidth, setBandMapTabWidth] = useState<number>(
() => readWidth('opslog.bandMapTabWidth', BANDMAP_TAB_W_DEFAULT, BANDMAP_TAB_W_MIN, BANDMAP_TAB_W_MAX));
useEffect(() => { writeUiPref('opslog.bandMapWidth', String(Math.round(bandMapWidth))); }, [bandMapWidth]);
useEffect(() => { writeUiPref('opslog.bandMapTabWidth', String(Math.round(bandMapTabWidth))); }, [bandMapTabWidth]);
// Drag one edge of a fixed-width column. Measures from the pointer's START
// position rather than the container, so it behaves the same whether the grip
// is on the left or the right edge — the docked map is docked on either side.
const startWidthDrag = (
e: React.PointerEvent, current: number, edge: 'left' | 'right',
min: number, max: number, apply: (w: number) => void,
) => {
e.preventDefault();
// Pointer capture, for the same reason as the main splitter: without it a
// map or a grid under the cursor swallows the moves.
(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
const x0 = e.clientX;
const onMove = (ev: PointerEvent) => {
const delta = edge === 'right' ? ev.clientX - x0 : x0 - ev.clientX;
apply(Math.min(max, Math.max(min, Math.round(current + delta))));
};
const onUp = () => {
window.removeEventListener('pointermove', onMove);
window.removeEventListener('pointerup', onUp);
};
window.addEventListener('pointermove', onMove);
window.addEventListener('pointerup', onUp);
};
const mainSplitRef = useRef<HTMLDivElement | null>(null); const mainSplitRef = useRef<HTMLDivElement | null>(null);
const startMainSplitDrag = (e: React.PointerEvent) => { const startMainSplitDrag = (e: React.PointerEvent) => {
e.preventDefault(); e.preventDefault();
@@ -957,6 +1000,19 @@ export default function App() {
return Number.isFinite(raw) && raw > 0 ? raw : 500; return Number.isFinite(raw) && raw > 0 ? raw : 500;
}); });
useEffect(() => { writeUiPref('hamlog.qsoLimit', String(qsoLimit)); }, [qsoLimit]); useEffect(() => { writeUiPref('hamlog.qsoLimit', String(qsoLimit)); }, [qsoLimit]);
// Raw text for the Max box, committed on blur/Enter — never per keystroke.
// Bound straight to the number, the field could not be EMPTIED: clearing it
// gives "", Number("") is 0, 0 fails the "> 0" test, so the state never moved
// and value={qsoLimit} snapped the old number straight back. Going from 200000
// to 100 was a fight against the input, and looked like the setting refusing
// to stick. It also wrote the preference once per keystroke (1, 10, 100).
const [qsoLimitText, setQsoLimitText] = useState(String(qsoLimit));
useEffect(() => { setQsoLimitText(String(qsoLimit)); }, [qsoLimit]);
const commitQsoLimit = () => {
const n = Math.floor(Number(qsoLimitText));
if (Number.isFinite(n) && n > 0) setQsoLimit(n);
else setQsoLimitText(String(qsoLimit)); // nonsense typed → put the live value back
};
// Contest session: load once, then persist on every change (merge + save). // Contest session: load once, then persist on every change (merge + save).
useEffect(() => { useEffect(() => {
@@ -1370,14 +1426,42 @@ export default function App() {
const [clusterLines, setClusterLines] = useState<ClusterLine[]>([]); const [clusterLines, setClusterLines] = useState<ClusterLine[]>([]);
const [clusterConsoleOpen, setClusterConsoleOpen] = useState(false); const [clusterConsoleOpen, setClusterConsoleOpen] = useState(false);
const clusterConsoleRef = useRef<HTMLDivElement | null>(null); const clusterConsoleRef = useRef<HTMLDivElement | null>(null);
// Console lines are STAGED and flushed on a timer, never applied one by one.
//
// Every line of cluster traffic reaches this handler — spots, MOTD, WHO, the
// lot — and an RBN feed alone puts out hundreds a second. Committing each one
// meant two copies of a 2000-element array (spread, then slice) plus a React
// render PER LINE: tens of megabytes of garbage per second, and the renders
// happened even with the console closed, so an operator paid for a panel they
// were not looking at. On an older machine that is enough to make the whole UI
// crawl. Batching turns hundreds of updates a second into five.
const pendingLinesRef = useRef<ClusterLine[]>([]);
const pendingLineTimer = useRef<number | undefined>(undefined);
useEffect(() => { useEffect(() => {
const off = EventsOn('cluster:line', (l: any) => { const flushLines = () => {
pendingLineTimer.current = undefined;
const batch = pendingLinesRef.current;
if (batch.length === 0) return;
pendingLinesRef.current = [];
setClusterLines((prev) => { setClusterLines((prev) => {
const next = [...prev, l as ClusterLine]; const total = prev.length + batch.length;
return next.length > CONSOLE_CAP ? next.slice(next.length - CONSOLE_CAP) : next; return total > CONSOLE_CAP ? prev.slice(total - CONSOLE_CAP).concat(batch) : prev.concat(batch);
}); });
};
const off = EventsOn('cluster:line', (l: any) => {
const buf = pendingLinesRef.current;
buf.push(l as ClusterLine);
// Bound the staging buffer too: a burst longer than the console can show
// would otherwise be carried in full just to be sliced away on commit.
if (buf.length > CONSOLE_CAP) buf.splice(0, buf.length - CONSOLE_CAP);
if (pendingLineTimer.current === undefined) {
pendingLineTimer.current = window.setTimeout(flushLines, 200);
}
}); });
return () => { off?.(); }; return () => {
off?.();
if (pendingLineTimer.current !== undefined) window.clearTimeout(pendingLineTimer.current);
};
}, []); }, []);
// Follow the tail, but ONLY when already at the bottom — otherwise scrolling up // Follow the tail, but ONLY when already at the bottom — otherwise scrolling up
// to read a SH/DX reply would yank you back down on the next spot. // to read a SH/DX reply would yank you back down on the next spot.
@@ -5948,9 +6032,15 @@ export default function App() {
{/* ===== LOWER: tabbed table / cluster / band map ===== */} {/* ===== LOWER: tabbed table / cluster / band map ===== */}
{compact ? null : <> {compact ? null : <>
<div className={cn('grid gap-2.5 p-2.5 flex-1 min-h-0 grid-rows-[minmax(0,1fr)]', {/* The band map is a fixed-width column with a draggable grip on its inner
showBandMap ? (bandMapSide === 'left' ? 'grid-cols-[300px_1fr]' : 'grid-cols-[1fr_300px]') : 'grid-cols-[1fr]')}> edge the gap between the two panes doubles as the handle, so no room
<section className="bg-card border border-border rounded-lg shadow-sm flex flex-col min-h-0 overflow-hidden"> is spent on it. Same idiom as the Main tab's splitter. */}
<div className={cn('grid gap-0 p-2.5 flex-1 min-h-0 grid-rows-[minmax(0,1fr)]', !showBandMap && 'grid-cols-[1fr]')}
style={showBandMap
? { gridTemplateColumns: bandMapSide === 'left' ? `${bandMapWidth}px 10px 1fr` : `1fr 10px ${bandMapWidth}px` }
: undefined}>
<section className={cn('bg-card border border-border rounded-lg shadow-sm flex flex-col min-h-0 overflow-hidden',
showBandMap && (bandMapSide === 'left' ? 'order-3' : 'order-1'))}>
<Tabs value={activeTab} onValueChange={setActiveTab} className="flex flex-col min-h-0 flex-1"> <Tabs value={activeTab} onValueChange={setActiveTab} className="flex flex-col min-h-0 flex-1">
<TabsList className="px-3 shrink-0"> <TabsList className="px-3 shrink-0">
<TabsTrigger value="main">{t('tab.main')}</TabsTrigger> <TabsTrigger value="main">{t('tab.main')}</TabsTrigger>
@@ -6209,11 +6299,11 @@ export default function App() {
min={1} min={1}
step={100} step={100}
className="w-24 h-7 font-mono text-xs" className="w-24 h-7 font-mono text-xs"
value={qsoLimit} value={qsoLimitText}
onChange={(e) => { onChange={(e) => setQsoLimitText(e.target.value)}
const n = Number(e.target.value); onBlur={commitQsoLimit}
if (Number.isFinite(n) && n > 0) setQsoLimit(Math.floor(n)); onKeyDown={(e) => { if (e.key === 'Enter') (e.target as HTMLInputElement).blur(); }}
}} title="Rows loaded into the list — press Enter to apply"
/> />
<Button <Button
variant="ghost" variant="ghost"
@@ -6522,7 +6612,23 @@ export default function App() {
Pick one or more bands above to show their band maps side by side. Pick one or more bands above to show their band maps side by side.
</div> </div>
) : bandMapBands.map((b) => ( ) : bandMapBands.map((b) => (
<div key={b} className="w-[260px] shrink-0 min-h-0 border border-border rounded-lg overflow-hidden flex flex-col"> <div key={b} className="relative shrink-0 min-h-0 border border-border rounded-lg overflow-hidden flex flex-col"
style={{ width: bandMapTabWidth }}>
{/* One width for every card: they sit side by side in a
scrolling row, and columns of different widths read as a
mistake rather than a choice. Grip on the right edge. */}
<div
role="separator"
aria-orientation="vertical"
title={t('bmp.widthTip')}
onPointerDown={(e) => startWidthDrag(
e, bandMapTabWidth, 'right',
BANDMAP_TAB_W_MIN, BANDMAP_TAB_W_MAX, setBandMapTabWidth)}
onDoubleClick={() => setBandMapTabWidth(BANDMAP_TAB_W_DEFAULT)}
className="group absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize flex items-center justify-center"
>
<span className="h-10 w-[3px] rounded-full bg-transparent group-hover:bg-primary transition-colors" />
</div>
<BandMap <BandMap
band={b} band={b}
spots={spots.filter((s) => s.band === b)} spots={spots.filter((s) => s.band === b)}
@@ -6541,7 +6647,22 @@ export default function App() {
</section> </section>
{showBandMap && ( {showBandMap && (
<div className={cn('bg-card border border-border rounded-lg shadow-sm flex flex-col min-h-0 overflow-hidden', bandMapSide === 'left' && 'order-first')}> <div
role="separator"
aria-orientation="vertical"
title={t('bmp.widthTip')}
onPointerDown={(e) => startWidthDrag(
e, bandMapWidth, bandMapSide === 'left' ? 'right' : 'left',
BANDMAP_W_MIN, BANDMAP_W_MAX, setBandMapWidth)}
onDoubleClick={() => setBandMapWidth(BANDMAP_W_DEFAULT)}
className="group relative order-2 cursor-col-resize flex items-center justify-center"
>
<span className="h-10 w-[3px] rounded-full bg-border group-hover:bg-primary transition-colors" />
</div>
)}
{showBandMap && (
<div className={cn('bg-card border border-border rounded-lg shadow-sm flex flex-col min-h-0 overflow-hidden',
bandMapSide === 'left' ? 'order-1' : 'order-3')}>
<BandMap <BandMap
side={bandMapSide} side={bandMapSide}
onToggleSide={toggleBandMapSide} onToggleSide={toggleBandMapSide}
+2 -2
View File
@@ -342,7 +342,7 @@ const en: Dict = {
'bmp.statusNew': 'NEW DXCC (entity never worked)', 'bmp.statusNewBand': 'NEW BAND (entity not worked on this band)', 'bmp.statusNewSlot': 'NEW SLOT (mode not worked on this band)', 'bmp.statusNew': 'NEW DXCC (entity never worked)', 'bmp.statusNewBand': 'NEW BAND (entity not worked on this band)', 'bmp.statusNewSlot': 'NEW SLOT (mode not worked on this band)',
'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.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.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.fitTitle': 'Size each band map to show the whole band edge-to-edge', '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.legendWorked': '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.legendWorked': '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.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.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',
@@ -750,7 +750,7 @@ const fr: Dict = {
'bmp.statusNew': 'NOUVEAU DXCC (entité jamais contactée)', 'bmp.statusNewBand': 'NOUVELLE BANDE (entité non contactée sur cette bande)', 'bmp.statusNewSlot': 'NOUVEAU MODE (mode non contacté sur cette bande)', 'bmp.statusNew': 'NOUVEAU DXCC (entité jamais contactée)', 'bmp.statusNewBand': 'NOUVELLE BANDE (entité non contactée sur cette bande)', 'bmp.statusNewSlot': 'NOUVEAU MODE (mode non contacté sur cette bande)',
'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.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.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.fitTitle': 'Dimensionner chaque carte pour afficher toute la 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.legendWorked': '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.legendWorked': '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.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.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',
+2
View File
@@ -39,6 +39,8 @@ const PORTABLE_KEYS = [
'opslog.clusterModeFilter', 'opslog.clusterSearch', 'opslog.clusterHideWorked', 'opslog.clusterModeFilter', 'opslog.clusterSearch', 'opslog.clusterHideWorked',
'opslog.activeTab', // last selected tab 'opslog.activeTab', // last selected tab
'opslog.mainSplit', // Main tab: width share of the left pane (percent) 'opslog.mainSplit', // Main tab: width share of the left pane (percent)
'opslog.bandMapWidth', // docked band map: column width (px)
'opslog.bandMapTabWidth', // Band map tab: shared card width (px)
// NOTE: 'hamlog.awardColsShown' and the grid column layouts are NOT listed here. // NOTE: 'hamlog.awardColsShown' and the grid column layouts are NOT listed here.
// They are handled by lib/gridPrefs, which scopes the localStorage cache PER // They are handled by lib/gridPrefs, which scopes the localStorage cache PER
// PROFILE and mirrors to the DB (already per-profile) itself — mirroring them // PROFILE and mirrors to the DB (already per-profile) itself — mirroring them
+1 -1
View File
@@ -1,6 +1,6 @@
// Single source of truth for the app version shown in the UI (header + About). // Single source of truth for the app version shown in the UI (header + About).
// Bump this on a release (the release script updates it alongside telemetry.go). // Bump this on a release (the release script updates it alongside telemetry.go).
export const APP_VERSION = '0.24.0'; export const APP_VERSION = '0.24.1';
// Author / credits, shown in Help -> About. // Author / credits, shown in Help -> About.
export const APP_AUTHOR = 'F4BPO'; export const APP_AUTHOR = 'F4BPO';
+1 -1
View File
@@ -21,7 +21,7 @@ import (
const ( const (
// appVersion is stamped on every heartbeat (and could feed the About box). // appVersion is stamped on every heartbeat (and could feed the About box).
appVersion = "0.24.0" appVersion = "0.24.1"
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change // posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
// to https://us.i.posthog.com for a US project. // to https://us.i.posthog.com for a US project.
+108 -13
View File
@@ -150,15 +150,55 @@ func (a *App) DownloadAndApplyUpdate(url string) error {
// Swap: rename the running exe out of the way (Windows allows renaming a // Swap: rename the running exe out of the way (Windows allows renaming a
// running image), move the new one into its place, then relaunch. Roll back if // running image), move the new one into its place, then relaunch. Roll back if
// the second rename fails so we never end up with no exe. // the second rename fails so we never end up with no exe.
oldExe := exe + ".old" //
_ = os.Remove(oldExe) // The staging name is UNIQUE, not a fixed ".old". With a fixed name, one
if err := os.Rename(exe, oldExe); err != nil { // leftover that could not be deleted — an antivirus holding it open is the
_ = os.Remove(newExe) // usual reason — poisoned every later update: the rename replaces its target,
return fmt.Errorf("stage current exe: %w", err) // the target was locked, and the operator got "stage current exe: … Accès
// refusé" for ever with no way out but deleting the file by hand.
oldExe := fmt.Sprintf("%s.old-%d", exe, time.Now().UnixNano())
var stageErr error
staged := false
// Retry briefly: a real-time scanner opens the file it has just seen written
// and holds it for a moment, so the first attempt lands exactly in that window.
for attempt := 0; attempt < 5; attempt++ {
if stageErr = os.Rename(exe, oldExe); stageErr == nil {
staged = true
break
}
time.Sleep(time.Duration(150*(attempt+1)) * time.Millisecond)
} }
if err := os.Rename(newExe, exe); err != nil {
_ = os.Rename(oldExe, exe) // roll back if staged {
return fmt.Errorf("install new exe: %w", err) if err := os.Rename(newExe, exe); err != nil {
_ = os.Rename(oldExe, exe) // roll back
return fmt.Errorf("install new exe: %w", err)
}
} else {
// Could not rename our own running image at all. Some endpoint protection
// (Bitdefender's ransomware remediation among them) blocks precisely that,
// and no amount of retrying gets past it.
//
// So don't fight it: leave the new build beside the old one and let the
// relaunch helper do the swap AFTER this process has exited, when the file
// is no longer a running image. Reported by several operators, all with the
// same "Accès refusé" on the staging rename.
applog.Printf("update: cannot rename the running exe (%v) — deferring the swap to after exit", stageErr)
pending := exe + ".new"
_ = os.Remove(pending)
if err := os.Rename(newExe, pending); err != nil {
_ = os.Remove(newExe)
return fmt.Errorf("stage new exe: %w (the folder %s must be writable, and an antivirus may be holding OpsLog.exe)", err, dir)
}
if err := a.scheduleDeferredSwap(exe, pending); err != nil {
return err
}
if a.ctx != nil {
wruntime.Quit(a.ctx)
} else {
os.Exit(0)
}
return nil
} }
// Clear the "downloaded from the internet" mark (NTFS Zone.Identifier stream). // Clear the "downloaded from the internet" mark (NTFS Zone.Identifier stream).
// Otherwise Windows SmartScreen wants to prompt "are you sure you want to open // Otherwise Windows SmartScreen wants to prompt "are you sure you want to open
@@ -189,6 +229,46 @@ func (a *App) DownloadAndApplyUpdate(url string) error {
return nil return nil
} }
// scheduleDeferredSwap hands the exe swap to a detached helper that runs AFTER
// this process is gone.
//
// The fallback for when the running image cannot be renamed at all. Once OpsLog
// has exited its exe is an ordinary file again, so the move that was refused a
// moment earlier succeeds — and the helper keeps trying for ten seconds, because
// an antivirus that was holding the file usually lets go a beat after the
// process dies rather than instantly.
//
// OpsLog is restarted either way. If the move failed, that starts the OLD build
// — the update simply has not applied — and the operator keeps a working logger
// instead of having it vanish mid-session, which for someone in a QSO is worse
// than an update that waits. Only a successful swap passes --post-update, so a
// failure leaves the .new file in place for the next attempt rather than having
// the cleanup delete the download.
func (a *App) scheduleDeferredSwap(exe, pending string) error {
// Clear the "downloaded from the internet" mark before it becomes the exe —
// SmartScreen silently blocks a programmatic launch of a marked file, and the
// mark follows the file across the move.
_ = os.Remove(pending + ":Zone.Identifier")
q := func(s string) string { return strings.ReplaceAll(s, "'", "''") }
ps := fmt.Sprintf(
"Wait-Process -Id %d -ErrorAction SilentlyContinue; "+
"$ok=$false; "+
"for ($i=0; $i -lt 40; $i++) { "+
"try { Move-Item -LiteralPath '%s' -Destination '%s' -Force -ErrorAction Stop; $ok=$true; break } "+
"catch { Start-Sleep -Milliseconds 250 } }; "+
"if ($ok) { Start-Process -FilePath '%s' -ArgumentList '--post-update' } "+
"else { Start-Process -FilePath '%s' }",
os.Getpid(), q(pending), q(exe), q(exe), q(exe))
cmd := exec.Command("powershell", "-NoProfile", "-WindowStyle", "Hidden", "-Command", ps)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true, CreationFlags: 0x08000000} // CREATE_NO_WINDOW
if err := cmd.Start(); err != nil {
return fmt.Errorf("schedule the update swap: %w", err)
}
applog.Printf("update: swap scheduled for after exit (%s → %s)", filepath.Base(pending), filepath.Base(exe))
return nil
}
// downloadWithProgress streams url into dest, emitting "update:progress" (0-100). // downloadWithProgress streams url into dest, emitting "update:progress" (0-100).
func (a *App) downloadWithProgress(url, dest string) error { func (a *App) downloadWithProgress(url, dest string) error {
client := &http.Client{Timeout: 10 * time.Minute} client := &http.Client{Timeout: 10 * time.Minute}
@@ -274,12 +354,27 @@ func extractExeFromZip(zipPath, dir string) (string, error) {
return "", fmt.Errorf("no .exe inside the archive") return "", fmt.Errorf("no .exe inside the archive")
} }
// cleanupOldUpdateBinary removes the previous exe left behind by a self-update // cleanupOldUpdateBinary removes what a self-update left behind. Called at
// (exe + ".old"). Called at startup after a --post-update relaunch. Best-effort: // startup after a --post-update relaunch. Best-effort throughout: a file may
// the file may still be briefly locked, in which case the next launch gets it. // still be locked by a scanner, and the next launch will get it.
//
// Sweeps a PATTERN, not one name. Staging uses a unique ".old-<nanos>" precisely
// so a locked leftover cannot block the next update, which means leftovers
// accumulate unless something collects them — and the pre-0.24.1 ".old" may be
// sitting there too, from the very update that could not delete it.
func cleanupOldUpdateBinary() { func cleanupOldUpdateBinary() {
if exe, err := os.Executable(); err == nil { exe, err := os.Executable()
_ = os.Remove(exe + ".old") if err != nil {
return
}
_ = os.Remove(exe + ".old") // the old fixed name
_ = os.Remove(exe + ".new") // a deferred swap that has been applied
matches, err := filepath.Glob(exe + ".old-*")
if err != nil {
return
}
for _, m := range matches {
_ = os.Remove(m)
} }
} }