Add persistent all-time download counter, session vs total stats

- Track totalDownloadedAllTime in settings (persists across restarts)
- Track sessionDownloadedBytes for current app session
- Status bar shows both: Session + Gesamt
- Statistics section shows Heruntergeladen (Session) + (Gesamt)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe
2026-03-02 19:00:17 +01:00
co-authored by Claude Opus 4.6
parent 4ea3a75dc0
commit 3c510fc265
6 changed files with 18 additions and 3 deletions
+5
View File
@@ -728,6 +728,8 @@ export class DownloadManager extends EventEmitter {
private speedBytesLastWindow = 0;
private sessionDownloadedBytes = 0;
private statsCache: DownloadStats | null = null;
private statsCacheAt = 0;
@@ -911,6 +913,7 @@ export class DownloadManager extends EventEmitter {
const stats = {
totalDownloaded,
totalDownloadedAllTime: this.settings.totalDownloadedAllTime,
totalFiles,
totalPackages: this.session.packageOrder.length,
sessionStartedAt: this.session.runStartedAt
@@ -4264,6 +4267,8 @@ export class DownloadManager extends EventEmitter {
written += buffer.length;
windowBytes += buffer.length;
this.session.totalDownloadedBytes += buffer.length;
this.sessionDownloadedBytes += buffer.length;
this.settings.totalDownloadedAllTime += buffer.length;
this.itemContributedBytes.set(active.itemId, (this.itemContributedBytes.get(active.itemId) || 0) + buffer.length);
this.recordSpeed(buffer.length, item.packageId);
throughputWindowBytes += buffer.length;