Reset stale status texts on session load and stop
Some checks are pending
Build and Release / build (push) Waiting to run

- normalizeSessionStatuses: reset all queued items to "Wartet" instead of
  only checking a few specific patterns (missed Retry, Unrestrict-Fehler etc.)
- Reset completed items with stale extraction status to "Fertig (size)"
- stop(): reset all non-finished items to queued/"Wartet" and packages to queued

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-03 00:58:28 +01:00
parent 375b9885ee
commit 4008e20278
2 changed files with 27 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "real-debrid-downloader",
"version": "1.5.38",
"version": "1.5.39",
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
"main": "build/main/main/main.js",
"author": "Sucukdeluxe",

View File

@ -2415,6 +2415,23 @@ export class DownloadManager extends EventEmitter {
active.abortReason = "stop";
active.abortController.abort("stop");
}
// Reset all non-finished items to clean "Wartet" state
for (const item of Object.values(this.session.items)) {
if (!isFinishedStatus(item.status)) {
item.status = "queued";
item.speedBps = 0;
item.fullStatus = "Wartet";
item.updatedAt = nowMs();
}
}
for (const pkg of Object.values(this.session.packages)) {
if (pkg.status === "downloading" || pkg.status === "validating"
|| pkg.status === "extracting" || pkg.status === "integrity_check"
|| pkg.status === "paused" || pkg.status === "reconnect_wait") {
pkg.status = "queued";
pkg.updatedAt = nowMs();
}
}
this.persistSoon();
this.emitState(true);
}
@ -2564,13 +2581,18 @@ export class DownloadManager extends EventEmitter {
item.speedBps = 0;
}
// Clear stale transient status texts from previous session
if (item.status === "queued" && item.fullStatus) {
const fs = item.fullStatus.toLowerCase();
if (fs.includes("provider-cooldown") || fs.includes("warte auf daten") || fs.includes("keine daten")
|| fs.includes("link wird umgewandelt") || fs.includes("verbindungsfehler")) {
if (item.status === "queued") {
const fs = (item.fullStatus || "").trim();
if (fs !== "Wartet" && fs !== "Paket gestoppt") {
item.fullStatus = "Wartet";
}
}
if (item.status === "completed") {
const fs = (item.fullStatus || "").trim();
if (fs && !isExtractedLabel(fs) && !/^Fertig\b/i.test(fs)) {
item.fullStatus = `Fertig (${humanSize(item.downloadedBytes)})`;
}
}
}
for (const pkg of Object.values(this.session.packages)) {
if (pkg.enabled === undefined) {