fix: showing multiple download options

This commit is contained in:
Chubby Granny Chaser 2024-08-18 01:39:50 +01:00
parent c218070463
commit 42ea35441c
No known key found for this signature in database
17 changed files with 118 additions and 98 deletions

View file

@ -73,13 +73,26 @@ const realDebridHosts = ["https://1fichier.com", "https://mediafire.com"];
export const getDownloadersForUri = (uri: string) => {
if (uri.startsWith("https://gofile.io")) return [Downloader.Gofile];
if (uri.startsWith("https://pixeldrain.com")) return [Downloader.PixelDrain];
if (realDebridHosts.some((host) => uri.startsWith(host)))
return [Downloader.RealDebrid];
if (uri.startsWith("magnet:"))
if (uri.startsWith("magnet:")) {
return [Downloader.Torrent, Downloader.RealDebrid];
}
return [];
};
export const getDownloadersForUris = (uris: string[]) => {
const downloadersSet = uris.reduce<Set<Downloader>>((prev, next) => {
const downloaders = getDownloadersForUri(next);
downloaders.forEach((downloader) => prev.add(downloader));
return prev;
}, new Set());
return Array.from(downloadersSet);
};