Skip to content

Commit

Permalink
Improve logic for trackers
Browse files Browse the repository at this point in the history
  • Loading branch information
BoredLama committed Apr 12, 2020
1 parent fd32213 commit 2d4000d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ const streamFromMagnet = (tor, uri, type, cb) => {

let trackers = (parsed.announce || []).map(x => { return "tracker:"+x })

if (!config.dhtEnabled || config.dhtEnabled == 'True')
if (trackers.length && (!config.dhtEnabled || config.dhtEnabled == 'True'))
trackers = trackers.concat(["dht:"+infoHash])
cb({

const streamObj = {
name: tor.from,
type: type,
infoHash: infoHash,
sources: trackers,
title: title
})
}

if (trackers.length)
streamObj.sources = trackers

cb(streamObj)
}
if (uri.startsWith("magnet:?")) {
toStream(parseTorrent(uri))
Expand Down

0 comments on commit 2d4000d

Please sign in to comment.