Update: version 1.2.0, new version UI features, CSP hash auto-update, bug fixes

This commit is contained in:
Krystie
2026-05-14 21:04:35 -07:00
parent a216dd882d
commit 947007438f
12 changed files with 385 additions and 44 deletions
+15 -3
View File
@@ -311,13 +311,25 @@ class SelfUpdater extends EventEmitter {
// Delete the result file so we don't process it again
await fsp.unlink(resultPath).catch(() => {});
// Update history
// Update the matching history entry, preferring the newest pending item
// for the same target version. Fall back to the newest pending item if
// older result files lack enough metadata to match more precisely.
const history = this.getUpdateHistory();
const pending = history.find(h => h.status === 'pending');
if (pending) {
const pendingIndex = history.findIndex(
h => h.status === 'pending' && (!result.version || h.version === result.version)
);
const fallbackIndex = pendingIndex === -1
? history.findIndex(h => h.status === 'pending')
: -1;
const historyIndex = pendingIndex !== -1 ? pendingIndex : fallbackIndex;
if (historyIndex !== -1) {
const pending = history[historyIndex];
pending.status = result.success ? 'success' : 'rolled-back';
pending.duration = result.duration;
if (result.error) pending.error = result.error;
if (result.version) pending.version = result.version;
if (result.timestamp) pending.completedAt = result.timestamp;
this._saveHistory(history);
}