Fix session stats, extraction UX, and queue UI issues
This commit is contained in:
@@ -179,14 +179,19 @@ export class AppController {
|
||||
return previousSettings;
|
||||
}
|
||||
|
||||
// Preserve the live totalDownloadedAllTime from the download manager
|
||||
// Preserve the live all-time counters from the download manager
|
||||
const liveSettings = this.manager.getSettings();
|
||||
nextSettings.totalDownloadedAllTime = Math.max(nextSettings.totalDownloadedAllTime || 0, liveSettings.totalDownloadedAllTime || 0);
|
||||
nextSettings.totalCompletedFilesAllTime = Math.max(nextSettings.totalCompletedFilesAllTime || 0, liveSettings.totalCompletedFilesAllTime || 0);
|
||||
nextSettings.providerDailyUsageDay = liveSettings.providerDailyUsageDay;
|
||||
nextSettings.providerDailyUsageBytes = { ...(liveSettings.providerDailyUsageBytes || {}) };
|
||||
nextSettings.providerTotalUsageBytes = { ...(liveSettings.providerTotalUsageBytes || {}) };
|
||||
nextSettings.debridLinkApiKeyDailyUsageBytes = Object.fromEntries(
|
||||
Object.entries(liveSettings.debridLinkApiKeyDailyUsageBytes || {}).filter(([keyId]) => getDebridLinkApiKeyIds(nextSettings.debridLinkApiKeys).includes(keyId))
|
||||
);
|
||||
nextSettings.debridLinkApiKeyTotalUsageBytes = Object.fromEntries(
|
||||
Object.entries(liveSettings.debridLinkApiKeyTotalUsageBytes || {}).filter(([keyId]) => getDebridLinkApiKeyIds(nextSettings.debridLinkApiKeys).includes(keyId))
|
||||
);
|
||||
this.settings = nextSettings;
|
||||
saveSettings(this.storagePaths, this.settings);
|
||||
this.manager.setSettings(this.settings);
|
||||
@@ -379,6 +384,15 @@ export class AppController {
|
||||
return this.manager.getSessionStats();
|
||||
}
|
||||
|
||||
public resetSessionStats(): void {
|
||||
this.manager.resetSessionStats();
|
||||
}
|
||||
|
||||
public resetDownloadStats(): void {
|
||||
this.manager.resetDownloadStats();
|
||||
this.settings = this.manager.getSettings();
|
||||
}
|
||||
|
||||
public exportBackup(): Buffer {
|
||||
const settings = { ...this.settings };
|
||||
const session = this.manager.getSession();
|
||||
|
||||
Reference in New Issue
Block a user