release: harden provider rotation and download recovery

Apply account and provider changes to active conversions without restarting, isolate API and Web state, and abort the exact fallback attempt when settings change.

Bound resume recovery, make disk reservations abortable, preserve cleanup totals and history, stabilize compact UI state, and canonicalize RapidGator host aliases.

Expand bounded support diagnostics while redacting account identities, local paths, package names, and file names from current and rotated logs.

Add regression coverage for rotation, live settings, HTTP 416 recovery, disk waits, cleanup, context menus, history failures, and support bundle privacy.
This commit is contained in:
Sucukdeluxe
2026-08-13 20:44:43 +02:00
parent d287056a2a
commit 4972858c9d
34 changed files with 2103 additions and 317 deletions
+39 -8
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, afterEach } from "vitest";
import { checkMegaDebridAccount, checkDebridLinkKey, checkAllDebridAccounts } from "../src/main/account-check";
import type { MegaDebridAccountEntry } from "../src/shared/mega-debrid-accounts";
import { describe, it, expect, vi, afterEach } from "vitest";
import { checkMegaDebridAccount, checkDebridLinkKey, checkAllDebridAccounts } from "../src/main/account-check";
import { getMegaDebridAccountId, type MegaDebridAccountEntry } from "../src/shared/mega-debrid-accounts";
import type { DebridLinkApiKeyEntry } from "../src/shared/debrid-link-keys";
import type { AppSettings } from "../src/shared/types";
@@ -117,7 +117,7 @@ describe("checkAllDebridAccounts", () => {
expect(result).toEqual([]);
});
it("checks every configured mega account + debrid-link key", async () => {
it("checks every configured mega account + debrid-link key", async () => {
const futureSec = Math.floor(Date.now() / 1000) + 1000;
vi.stubGlobal("fetch", vi.fn(async (url: string) => {
if (String(url).includes("mega-debrid")) {
@@ -136,10 +136,41 @@ describe("checkAllDebridAccounts", () => {
expect(result).toHaveLength(5);
expect(result.filter((r) => r.provider === "megadebrid")).toHaveLength(2);
expect(result.filter((r) => r.provider === "debridlink")).toHaveLength(3);
expect(result.every((r) => r.valid)).toBe(true);
});
it("caps concurrency (never more than 4 in flight) and preserves result order", async () => {
expect(result.every((r) => r.valid)).toBe(true);
});
it("keeps API and Web status identities separate when both modes use the same login", async () => {
const futureSec = Math.floor(Date.now() / 1000) + 1000;
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
const url = new URL(String(input));
const password = url.searchParams.get("password");
if (password === "api-pass") {
return { ok: true, status: 200, text: async () => JSON.stringify({ response_code: "ok", token: "api-token", vip_end: String(futureSec) }) };
}
return { ok: true, status: 200, text: async () => JSON.stringify({ response_code: "error", response_text: "web credentials rejected" }) };
}) as unknown as typeof fetch);
const settings = {
megaCredentials: "shared@example.test:api-pass",
megaPassword: "",
megaDebridApiCredentials: "shared@example.test:api-pass",
megaDebridWebCredentials: "shared@example.test:web-pass",
megaDebridApiEnabled: true,
megaDebridWebEnabled: true,
megaDebridPreferApi: true,
debridLinkApiKeys: ""
} as unknown as AppSettings;
const result = await checkAllDebridAccounts(settings);
const baseId = getMegaDebridAccountId("shared@example.test");
expect(result).toHaveLength(2);
expect(result.map((status) => status.accountId)).toEqual([`${baseId}:api`, `${baseId}:web`]);
expect(result[0]).toMatchObject({ valid: true, isPremium: true });
expect(result[1]).toMatchObject({ valid: false, isPremium: false });
});
it("caps concurrency (never more than 4 in flight) and preserves result order", async () => {
let inFlight = 0;
let maxInFlight = 0;
vi.stubGlobal("fetch", vi.fn(async () => {