Compare commits
No commits in common. "734c4e9968be962647e7cb7de6191bed67b504e8" and "356b8c3080f222484475426bd0a4c4185f1ab2aa" have entirely different histories.
734c4e9968
...
356b8c3080
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "1.7.96",
|
"version": "1.7.95",
|
||||||
"description": "Desktop downloader",
|
"description": "Desktop downloader",
|
||||||
"main": "build/main/main/main.js",
|
"main": "build/main/main/main.js",
|
||||||
"author": "Sucukdeluxe",
|
"author": "Sucukdeluxe",
|
||||||
|
|||||||
@ -7778,12 +7778,6 @@ export class DownloadManager extends EventEmitter {
|
|||||||
const directLinkRetryMatch = errorText.match(/^(?:Error:\s*)?direct_link_retry_exhausted:(.+)$/);
|
const directLinkRetryMatch = errorText.match(/^(?:Error:\s*)?direct_link_retry_exhausted:(.+)$/);
|
||||||
if (directLinkRetryMatch) {
|
if (directLinkRetryMatch) {
|
||||||
const exhaustedReason = compactErrorText(directLinkRetryMatch[1] || errorText).replace(/^Error:\s*/i, "");
|
const exhaustedReason = compactErrorText(directLinkRetryMatch[1] || errorText).replace(/^Error:\s*/i, "");
|
||||||
if (item.provider === "debridlink") {
|
|
||||||
await sleep(450);
|
|
||||||
if (this.tryFinalizeItemFromDisk(pkg, item, "DebridLink-Settle-Recovery", exhaustedReason)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isHttp416Text(exhaustedReason) && active.genericErrorRetries < maxHttp416Retries) {
|
if (isHttp416Text(exhaustedReason) && active.genericErrorRetries < maxHttp416Retries) {
|
||||||
this.scheduleHttp416Retry(item, active, retryDisplayLimit, exhaustedReason, claimedTargetPath);
|
this.scheduleHttp416Retry(item, active, retryDisplayLimit, exhaustedReason, claimedTargetPath);
|
||||||
this.persistSoon();
|
this.persistSoon();
|
||||||
|
|||||||
@ -1564,73 +1564,6 @@ describe("download manager", () => {
|
|||||||
expect(fs.statSync(item.targetPath).size).toBe(binary.length);
|
expect(fs.statSync(item.targetPath).size).toBe(binary.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("finalizes Debrid-Link items in-session when the file is already complete on disk", async () => {
|
|
||||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-dm-"));
|
|
||||||
tempDirs.push(root);
|
|
||||||
const binary = Buffer.alloc(60 * 1024, 57);
|
|
||||||
let unrestrictCalls = 0;
|
|
||||||
let downloadCalls = 0;
|
|
||||||
|
|
||||||
globalThis.fetch = async (input: RequestInfo | URL): Promise<Response> => {
|
|
||||||
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
||||||
if (url.includes("debrid-link.com/api/v2/downloader/add")) {
|
|
||||||
unrestrictCalls += 1;
|
|
||||||
return new Response(
|
|
||||||
JSON.stringify({
|
|
||||||
success: true,
|
|
||||||
value: {
|
|
||||||
downloadUrl: `https://dummy/debridlink-direct-complete-${unrestrictCalls}`,
|
|
||||||
name: "debridlink-complete.part10.rar",
|
|
||||||
size: binary.length
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
status: 200,
|
|
||||||
headers: { "Content-Type": "application/json" }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
throw new Error(`unexpected fetch ${url}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const manager = new DownloadManager(
|
|
||||||
{
|
|
||||||
...defaultSettings(),
|
|
||||||
debridLinkApiKeys: "dl-test-key",
|
|
||||||
providerOrder: ["debridlink"],
|
|
||||||
providerPrimary: "debridlink",
|
|
||||||
providerSecondary: "none",
|
|
||||||
providerTertiary: "none",
|
|
||||||
outputDir: path.join(root, "downloads"),
|
|
||||||
extractDir: path.join(root, "extract"),
|
|
||||||
retryLimit: 2,
|
|
||||||
autoExtract: false
|
|
||||||
},
|
|
||||||
emptySession(),
|
|
||||||
createStoragePaths(path.join(root, "state"))
|
|
||||||
);
|
|
||||||
|
|
||||||
(manager as any).downloadToFile = async (_active: unknown, _directUrl: string, targetPath: string) => {
|
|
||||||
downloadCalls += 1;
|
|
||||||
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
||||||
fs.writeFileSync(targetPath, binary);
|
|
||||||
throw new Error("direct_link_retry_exhausted:download_underflow:61440/61440");
|
|
||||||
};
|
|
||||||
|
|
||||||
manager.addPackages([{ name: "debridlink-complete", links: ["https://dummy/debridlink-complete"] }]);
|
|
||||||
await manager.start();
|
|
||||||
await waitFor(() => !manager.getSnapshot().session.running, 12000);
|
|
||||||
|
|
||||||
const item = Object.values(manager.getSnapshot().session.items)[0];
|
|
||||||
expect(item?.status).toBe("completed");
|
|
||||||
expect(item?.progressPercent).toBe(100);
|
|
||||||
expect(item?.downloadedBytes).toBe(binary.length);
|
|
||||||
expect(unrestrictCalls).toBe(1);
|
|
||||||
expect(downloadCalls).toBe(1);
|
|
||||||
expect(fs.existsSync(item.targetPath)).toBe(true);
|
|
||||||
expect(fs.statSync(item.targetPath).size).toBe(binary.length);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("queues Debrid-Link cooldown retries when wrapped unrestrict errors carry the cooldown marker", async () => {
|
it("queues Debrid-Link cooldown retries when wrapped unrestrict errors carry the cooldown marker", async () => {
|
||||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-dm-"));
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-dm-"));
|
||||||
tempDirs.push(root);
|
tempDirs.push(root);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user