mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: showing multiple download options
This commit is contained in:
parent
c218070463
commit
42ea35441c
17 changed files with 118 additions and 98 deletions
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue