feat: add unified upload telemetry

Move upload activity out of the global footer into a compact eight-row sidebar panel, add vertical metric transitions, and draw a smoothed green upload-speed sparkline in the header. Localize the new surfaces, cover responsive Electron behavior, and extend the strict public source allowlist for the new bounded speed-history module and its tests.
This commit is contained in:
Sucukdeluxe
2026-08-11 04:34:12 +02:00
parent 9afe7fd418
commit 4485f6b1b2
8 changed files with 397 additions and 158 deletions
+36
View File
@@ -0,0 +1,36 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { updateSpeedHistory } = require('../lib/speed-history');
test('speed history smooths rising and falling samples independently', () => {
const state = { display: 0, history: [] };
updateSpeedHistory(state, 1000);
assert.equal(state.display, 450);
updateSpeedHistory(state, 0);
assert.equal(state.display, 396);
assert.deepEqual(state.history, [450, 396]);
});
test('speed history stays bounded and discards its oldest samples', () => {
const state = { display: 0, history: [] };
updateSpeedHistory(state, 100, 3);
updateSpeedHistory(state, 200, 3);
updateSpeedHistory(state, 300, 3);
updateSpeedHistory(state, 400, 3);
assert.equal(state.history.length, 3);
assert.equal(state.history.at(-1), state.display);
assert.ok(state.history[0] > 0);
});
test('speed history normalizes invalid and negative target values', () => {
const state = { display: 50, history: [] };
updateSpeedHistory(state, -100);
updateSpeedHistory(state, Number.NaN);
assert.deepEqual(state.history, [44, 38.72]);
});