Compare commits
No commits in common. "eb41b87344122fca871e7db2bb109bb6b4b22cb1" and "e19cdf247cde65c22453f95435559c3719b29f73" have entirely different histories.
eb41b87344
...
e19cdf247c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.7.55",
|
||||
"version": "1.7.54",
|
||||
"description": "Desktop downloader",
|
||||
"main": "build/main/main/main.js",
|
||||
"author": "Sucukdeluxe",
|
||||
|
||||
@ -24,9 +24,9 @@ const DEBRID_LINK_QUOTA_ERRORS = new Set(["maxLink", "maxLinkHost", "maxData", "
|
||||
const DEBRID_LINK_INVALID_TOKEN_ERRORS = new Set(["badToken", "hidedToken", "expired_token"]);
|
||||
const DEBRID_LINK_RATE_LIMIT_ERRORS = new Set(["floodDetected"]);
|
||||
const DEBRID_LINK_RETRYABLE_ERRORS = new Set(["internalError", "server_error"]);
|
||||
const DEBRID_LINK_PROVIDER_WIDE_ERRORS = new Set(["notDebrid"]);
|
||||
/** Errors where the key can't handle this link — skip to next key immediately, no retries */
|
||||
const DEBRID_LINK_SKIP_KEY_ERRORS = new Set([
|
||||
"notDebrid",
|
||||
"disabledServerHost",
|
||||
"notFreeHost",
|
||||
"serverNotAllowed",
|
||||
@ -1986,18 +1986,10 @@ class DebridLinkClient {
|
||||
category: "quota"
|
||||
};
|
||||
}
|
||||
if (DEBRID_LINK_PROVIDER_WIDE_ERRORS.has(code)) {
|
||||
return {
|
||||
fatal: true,
|
||||
cooldownMs: 0,
|
||||
message: `Link kann aktuell nicht generiert werden (${code}: ${description})`,
|
||||
category: "skip"
|
||||
};
|
||||
}
|
||||
if (DEBRID_LINK_SKIP_KEY_ERRORS.has(code)) {
|
||||
return {
|
||||
fatal: false,
|
||||
cooldownMs: 0,
|
||||
cooldownMs: DEBRID_LINK_KEY_COOLDOWN_MS,
|
||||
message: `Key kann Link aktuell nicht verarbeiten (${code}: ${description})`,
|
||||
category: "skip"
|
||||
};
|
||||
|
||||
@ -470,9 +470,6 @@ function isTemporaryUnrestrictError(errorText: string): boolean {
|
||||
const text = String(errorText || "").toLowerCase();
|
||||
return text.includes("server error")
|
||||
|| text.includes("internal server error")
|
||||
|| text.includes("notdebrid")
|
||||
|| text.includes("unable to generate link")
|
||||
|| text.includes("kann aktuell nicht generiert werden")
|
||||
|| text.includes("temporarily unavailable")
|
||||
|| text.includes("temporary unavailable")
|
||||
|| text.includes("temporarily disabled")
|
||||
|
||||
@ -459,82 +459,6 @@ describe("debrid service", () => {
|
||||
expect(addCalls).toBe(2);
|
||||
});
|
||||
|
||||
it("fails fast on provider-wide Debrid-Link notDebrid errors without rotating through all keys", async () => {
|
||||
const settings = {
|
||||
...defaultSettings(),
|
||||
debridLinkApiKeys: "dl-key-one\ndl-key-two",
|
||||
providerOrder: ["debridlink"] as const,
|
||||
providerPrimary: "debridlink" as const,
|
||||
providerSecondary: "none" as const,
|
||||
providerTertiary: "none" as const,
|
||||
autoProviderFallback: true
|
||||
};
|
||||
|
||||
const authHeaders: string[] = [];
|
||||
|
||||
globalThis.fetch = (async (_input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
|
||||
authHeaders.push(String((init?.headers as Record<string, string> | undefined)?.Authorization || ""));
|
||||
return new Response(JSON.stringify({
|
||||
success: false,
|
||||
error: "notDebrid",
|
||||
error_description: "notDebrid"
|
||||
}), {
|
||||
status: 403,
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}) as typeof fetch;
|
||||
|
||||
const service = new DebridService(settings);
|
||||
await expect(service.unrestrictLink("https://hoster.example/not-debrid.bin")).rejects.toThrow("Link kann aktuell nicht generiert werden (notDebrid: notDebrid)");
|
||||
expect(authHeaders).toEqual(["Bearer dl-key-one"]);
|
||||
});
|
||||
|
||||
it("continues to the next Debrid-Link key for non-provider-wide skip errors without caching a cooldown", async () => {
|
||||
const settings = {
|
||||
...defaultSettings(),
|
||||
debridLinkApiKeys: "dl-key-one\ndl-key-two",
|
||||
providerOrder: ["debridlink"] as const,
|
||||
providerPrimary: "debridlink" as const,
|
||||
providerSecondary: "none" as const,
|
||||
providerTertiary: "none" as const,
|
||||
autoProviderFallback: true
|
||||
};
|
||||
|
||||
const authHeaders: string[] = [];
|
||||
|
||||
globalThis.fetch = (async (_input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
|
||||
const authHeader = String((init?.headers as Record<string, string> | undefined)?.Authorization || "");
|
||||
authHeaders.push(authHeader);
|
||||
if (authHeader === "Bearer dl-key-one") {
|
||||
return new Response(JSON.stringify({
|
||||
success: false,
|
||||
error: "noServerHost",
|
||||
error_description: "host temporarily unavailable"
|
||||
}), {
|
||||
status: 403,
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}
|
||||
return new Response(JSON.stringify({
|
||||
success: true,
|
||||
value: {
|
||||
downloadUrl: "https://debrid-link.example/second-key.bin",
|
||||
name: "second-key.bin",
|
||||
size: 4096
|
||||
}
|
||||
}), {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}) as typeof fetch;
|
||||
|
||||
const service = new DebridService(settings);
|
||||
const result = await service.unrestrictLink("https://hoster.example/skip-key.bin");
|
||||
expect(result.directUrl).toBe("https://debrid-link.example/second-key.bin");
|
||||
expect(result.sourceAccountLabel).toBe("Key 2");
|
||||
expect(authHeaders).toEqual(["Bearer dl-key-one", "Bearer dl-key-two"]);
|
||||
});
|
||||
|
||||
it("uses BestDebrid auth header without token query fallback", async () => {
|
||||
const settings = {
|
||||
...defaultSettings(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user