release: rebuild AllDebrid integration for v2.0.66

Replace the legacy cookie and reCAPTCHA scraper with AllDebrid's official browser PIN authorization and API-key flow. Persist verified account identity and premium status, include AllDebrid in direct and bulk checks, and migrate stale web-only configurations to reauthorization.

Remove the unconditional three-second scheduler delay while retaining provider-reported slot limits. Preserve official error codes and terminate unavailable-link, unsupported-link, authentication, IP, and server restriction failures without retries or provider cooldowns.
This commit is contained in:
Sucukdeluxe
2026-08-23 16:03:09 +02:00
parent 6f922c458d
commit c46f9a1d7a
22 changed files with 1267 additions and 964 deletions
+46 -10
View File
@@ -1007,16 +1007,23 @@ describe("settings storage", () => {
expect(normalized.debridAccountStatuses[key.id].email).toBeUndefined();
});
it("defaults AllDebrid web login to disabled and normalizes the flag", () => {
expect(defaultSettings().allDebridUseWebLogin).toBe(false);
const normalizedEnabled = normalizeSettings({
...defaultSettings(),
allDebridUseWebLogin: 1 as unknown as boolean
});
expect(normalizedEnabled.allDebridUseWebLogin).toBe(true);
const normalizedDisabled = normalizeSettings({
it("migrates legacy AllDebrid web login without a PIN-issued API key to reauthorization", () => {
expect(defaultSettings().allDebridUseWebLogin).toBe(false);
const legacyWebOnly = normalizeSettings({
...defaultSettings(),
allDebridUseWebLogin: 1 as unknown as boolean
});
expect(legacyWebOnly.allDebridUseWebLogin).toBe(false);
const authorizedWeb = normalizeSettings({
...defaultSettings(),
allDebridToken: "fixture-pin-issued-key",
allDebridUseWebLogin: 1 as unknown as boolean
});
expect(authorizedWeb.allDebridUseWebLogin).toBe(true);
const normalizedDisabled = normalizeSettings({
...defaultSettings(),
allDebridUseWebLogin: 0 as unknown as boolean
});
@@ -1034,6 +1041,35 @@ describe("settings storage", () => {
expect(normalized.historyRetentionMode).toBe("permanent");
});
it("keeps the AllDebrid service status only while AllDebrid is configured", () => {
const status = {
accountId: "svc-alldebrid",
provider: "alldebrid" as const,
label: "AllDebrid",
maskedLogin: "Geschützter API-Key",
valid: true,
isPremium: true,
premiumUntilMs: Date.now() + 1000,
username: "all-user",
email: "all@example.test",
message: "Premium aktiv",
checkedAt: Date.now()
};
const configured = normalizeSettings({
...defaultSettings(),
allDebridToken: "all-api-key",
debridAccountStatuses: { "svc-alldebrid": status }
});
const removed = normalizeSettings({
...defaultSettings(),
debridAccountStatuses: { "svc-alldebrid": status }
});
expect(configured.debridAccountStatuses["svc-alldebrid"]).toEqual(status);
expect(removed.debridAccountStatuses["svc-alldebrid"]).toBeUndefined();
});
it("loads legacy history without inventing structured durations", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rd-store-"));
tempDirs.push(dir);