Compare commits
2 Commits
e19cdf247c
...
eb41b87344
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb41b87344 | ||
|
|
df8cbcf1c9 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "1.7.54",
|
"version": "1.7.55",
|
||||||
"description": "Desktop downloader",
|
"description": "Desktop downloader",
|
||||||
"main": "build/main/main/main.js",
|
"main": "build/main/main/main.js",
|
||||||
"author": "Sucukdeluxe",
|
"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_INVALID_TOKEN_ERRORS = new Set(["badToken", "hidedToken", "expired_token"]);
|
||||||
const DEBRID_LINK_RATE_LIMIT_ERRORS = new Set(["floodDetected"]);
|
const DEBRID_LINK_RATE_LIMIT_ERRORS = new Set(["floodDetected"]);
|
||||||
const DEBRID_LINK_RETRYABLE_ERRORS = new Set(["internalError", "server_error"]);
|
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 */
|
/** Errors where the key can't handle this link — skip to next key immediately, no retries */
|
||||||
const DEBRID_LINK_SKIP_KEY_ERRORS = new Set([
|
const DEBRID_LINK_SKIP_KEY_ERRORS = new Set([
|
||||||
"notDebrid",
|
|
||||||
"disabledServerHost",
|
"disabledServerHost",
|
||||||
"notFreeHost",
|
"notFreeHost",
|
||||||
"serverNotAllowed",
|
"serverNotAllowed",
|
||||||
@ -1986,10 +1986,18 @@ class DebridLinkClient {
|
|||||||
category: "quota"
|
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)) {
|
if (DEBRID_LINK_SKIP_KEY_ERRORS.has(code)) {
|
||||||
return {
|
return {
|
||||||
fatal: false,
|
fatal: false,
|
||||||
cooldownMs: DEBRID_LINK_KEY_COOLDOWN_MS,
|
cooldownMs: 0,
|
||||||
message: `Key kann Link aktuell nicht verarbeiten (${code}: ${description})`,
|
message: `Key kann Link aktuell nicht verarbeiten (${code}: ${description})`,
|
||||||
category: "skip"
|
category: "skip"
|
||||||
};
|
};
|
||||||
|
|||||||
@ -470,6 +470,9 @@ function isTemporaryUnrestrictError(errorText: string): boolean {
|
|||||||
const text = String(errorText || "").toLowerCase();
|
const text = String(errorText || "").toLowerCase();
|
||||||
return text.includes("server error")
|
return text.includes("server error")
|
||||||
|| text.includes("internal 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("temporarily unavailable")
|
||||||
|| text.includes("temporary unavailable")
|
|| text.includes("temporary unavailable")
|
||||||
|| text.includes("temporarily disabled")
|
|| text.includes("temporarily disabled")
|
||||||
|
|||||||
@ -459,6 +459,82 @@ describe("debrid service", () => {
|
|||||||
expect(addCalls).toBe(2);
|
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 () => {
|
it("uses BestDebrid auth header without token query fallback", async () => {
|
||||||
const settings = {
|
const settings = {
|
||||||
...defaultSettings(),
|
...defaultSettings(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user