Fix rg.to filename scanning and release v1.3.3
This commit is contained in:
parent
447dd7feff
commit
6fe7b7e7ee
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
|
||||
"main": "build/main/main/main.js",
|
||||
"author": "Sucukdeluxe",
|
||||
|
||||
@ -126,7 +126,11 @@ function toProviderOrder(primary: DebridProvider, secondary: DebridFallbackProvi
|
||||
|
||||
function isRapidgatorLink(link: string): boolean {
|
||||
try {
|
||||
return new URL(link).hostname.toLowerCase().includes("rapidgator.net");
|
||||
const hostname = new URL(link).hostname.toLowerCase();
|
||||
return hostname === "rapidgator.net"
|
||||
|| hostname.endsWith(".rapidgator.net")
|
||||
|| hostname === "rg.to"
|
||||
|| hostname.endsWith(".rg.to");
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -287,4 +287,27 @@ describe("debrid service", () => {
|
||||
expect(result.provider).toBe("realdebrid");
|
||||
expect(result.fileName).toBe("Banshee.S04E01.German.DL.720p.part01.rar");
|
||||
});
|
||||
|
||||
it("resolves filenames for rg.to links", async () => {
|
||||
const settings = {
|
||||
...defaultSettings(),
|
||||
allDebridToken: ""
|
||||
};
|
||||
|
||||
const link = "https://rg.to/file/685cec6dcc1837dc725755fc9c726dd9";
|
||||
globalThis.fetch = (async (input: RequestInfo | URL): Promise<Response> => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
||||
if (url === link) {
|
||||
return new Response("<html><head><title>Download file Bulletproof.S01E01.German.DL.DD20.Synced.720p.AmazonHD.h264-GDR.part01.rar</title></head></html>", {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "text/html" }
|
||||
});
|
||||
}
|
||||
return new Response("not-found", { status: 404 });
|
||||
}) as typeof fetch;
|
||||
|
||||
const service = new DebridService(settings);
|
||||
const resolved = await service.resolveFilenames([link]);
|
||||
expect(resolved.get(link)).toBe("Bulletproof.S01E01.German.DL.DD20.Synced.720p.AmazonHD.h264-GDR.part01.rar");
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user