fix failing rd retry when infohash not indexed

This commit is contained in:
TheBeastLT 2024-04-29 09:09:17 +03:00
parent 87648bbe50
commit 20187a1145

View file

@ -62,11 +62,11 @@ let ALL_RUSSIAN_TRACKERS = [];
export async function getMagnetLink(infoHash) {
const torrent = await getTorrent(infoHash).catch(() => ({ infoHash }));
const torrentTrackers = torrent?.trackers?.split(',') || [];
const animeTrackers = torrent.type === Type.ANIME ? ALL_ANIME_TRACKERS : [];
const providerTrackers = RUSSIAN_PROVIDERS.includes(torrent.provider) && ALL_RUSSIAN_TRACKERS || [];
const animeTrackers = torrent?.type === Type.ANIME ? ALL_ANIME_TRACKERS : [];
const providerTrackers = RUSSIAN_PROVIDERS.includes(torrent?.provider) && ALL_RUSSIAN_TRACKERS || [];
const trackers = unique([].concat(torrentTrackers).concat(animeTrackers).concat(providerTrackers));
return magnet.encode({ infoHash: infoHash, name: torrent.title, announce: trackers });
return magnet.encode({ infoHash: infoHash, name: torrent?.title, announce: trackers });
}
export async function initBestTrackers() {
@ -112,4 +112,4 @@ export function enrichStreamSources(stream) {
function unique(array) {
return Array.from(new Set(array));
}
}