Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-05-12 12:38:04 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-12 12:38:04 +0300
commit02c3235e71e121326e517fdd9e43a55c753ab99f (patch)
treea1d15f2cf4b6a326c12b5a0d3a7ddc36a4a3a97d
parente9bbf47660c9122a28417c7d391c45739d4b40fc (diff)
fixes for parse-torrent@5
Fixes https://github.com/feross/parse-torrent/issues/9
-rw-r--r--lib/torrent.js10
-rw-r--r--test/basic-node.js4
-rw-r--r--test/basic.js2
-rw-r--r--test/blocklist-dht.js1
-rw-r--r--test/blocklist-tracker.js1
-rw-r--r--test/blocklist.js1
-rw-r--r--test/cmd.js2
-rw-r--r--test/download-dht-magnet.js1
-rw-r--r--test/download-dht-torrent.js1
-rw-r--r--test/download-tracker-magnet.js1
-rw-r--r--test/download-tracker-torrent.js1
11 files changed, 8 insertions, 17 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index 2461286..8dd33d4 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -122,16 +122,14 @@ function Torrent (torrentId, opts) {
// When no trackers specified, use some reasonable defaults
if (self.parsedTorrent.announce.length === 0) {
- self.parsedTorrent.announceList = createTorrent.announceList
- self.parsedTorrent.announce = [].concat.apply([], createTorrent.announceList)
+ self.parsedTorrent.announce = [].concat.apply([], createTorrent.announce)
}
// So `webtorrent-hybrid` can force specific trackers to be used
if (global.WEBTORRENT_ANNOUNCE) {
- self.parsedTorrent.announce.push.apply(
- self.parsedTorrent.announce,
- global.WEBTORRENT_ANNOUNCE
- )
+ global.WEBTORRENT_ANNOUNCE.forEach(function (url) {
+ self.parsedTorrent.announce.push(url)
+ })
}
// create swarm
diff --git a/test/basic-node.js b/test/basic-node.js
index 5f0eab4..c374715 100644
--- a/test/basic-node.js
+++ b/test/basic-node.js
@@ -9,7 +9,7 @@ var leaves = fs.readFileSync(leavesPath)
var leavesTorrent = parseTorrent(leaves)
var leavesBookPath = __dirname + '/content/Leaves of Grass by Walt Whitman.epub'
var numbersPath = __dirname + '/content/numbers'
-var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce'
+var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80'
test('client.add: http url to a torrent file, string', function (t) {
t.plan(3)
@@ -80,7 +80,7 @@ test('client.seed: filesystem path to folder, string', function (t) {
var client = new WebTorrent({ dht: false, tracker: false })
client.seed(numbersPath, opts, function (torrent) {
t.equal(torrent.infoHash, '80562f38656b385ea78959010e51a2cc9db41ea0')
- t.equal(torrent.magnetURI, 'magnet:?xt=urn:btih:80562f38656b385ea78959010e51a2cc9db41ea0&dn=numbers&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80&tr=wss%3A%2F%2Ftracker.webtorrent.io')
+ t.equal(torrent.magnetURI, 'magnet:?xt=urn:btih:80562f38656b385ea78959010e51a2cc9db41ea0&dn=numbers&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80&tr=wss%3A%2F%2Ftracker.webtorrent.io')
client.destroy()
})
})
diff --git a/test/basic.js b/test/basic.js
index d9d44c2..5d8bd7b 100644
--- a/test/basic.js
+++ b/test/basic.js
@@ -7,7 +7,7 @@ var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent')
var leavesTorrent = parseTorrent(leaves)
var leavesBook = fs.readFileSync(__dirname + '/content/Leaves of Grass by Walt Whitman.epub')
-var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce'
+var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80'
test('client.add/remove: magnet uri, utf-8 string', function (t) {
var client = new WebTorrent({ dht: false, tracker: false })
diff --git a/test/blocklist-dht.js b/test/blocklist-dht.js
index bcbf03e..9b4cb47 100644
--- a/test/blocklist-dht.js
+++ b/test/blocklist-dht.js
@@ -11,7 +11,6 @@ var leavesParsed = parseTorrent(leavesTorrent)
// remove trackers from .torrent file
leavesParsed.announce = []
-leavesParsed.announceList = []
test('blocklist blocks peers discovered via DHT', function (t) {
t.plan(7)
diff --git a/test/blocklist-tracker.js b/test/blocklist-tracker.js
index e60d02d..30d22a9 100644
--- a/test/blocklist-tracker.js
+++ b/test/blocklist-tracker.js
@@ -21,7 +21,6 @@ test('blocklist blocks peers discovered via tracker', function (t) {
// Overwrite announce with our local tracker
leavesParsed.announce = [ announceUrl ]
- leavesParsed.announceList = [[ announceUrl ]]
cb(null, tracker)
})
diff --git a/test/blocklist.js b/test/blocklist.js
index b86f828..ab36bc3 100644
--- a/test/blocklist.js
+++ b/test/blocklist.js
@@ -13,7 +13,6 @@ var leavesParsed = parseTorrent(leavesTorrent)
// remove trackers from .torrent file
leavesParsed.announce = []
-leavesParsed.announceList = []
function assertBlocked (t, torrent, addr) {
torrent.once('blockedPeer', function (_addr) {
diff --git a/test/cmd.js b/test/cmd.js
index 498eec3..60944bf 100644
--- a/test/cmd.js
+++ b/test/cmd.js
@@ -67,7 +67,7 @@ test('Command line: webtorrent info /path/to/file.torrent', function (t) {
test('Command line: webtorrent info magnet_uri', function (t) {
t.plan(2)
- var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce'
+ var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80'
cp.exec(CMD + ' info "' + leavesMagnetURI + '"', function (err, data) {
t.error(err)
diff --git a/test/download-dht-magnet.js b/test/download-dht-magnet.js
index 0378fbb..6e0591f 100644
--- a/test/download-dht-magnet.js
+++ b/test/download-dht-magnet.js
@@ -12,7 +12,6 @@ var leavesParsed = parseTorrent(leavesTorrent)
// remove trackers from .torrent file
leavesParsed.announce = []
-leavesParsed.announceList = []
test('Download using DHT (via magnet uri)', function (t) {
t.plan(8)
diff --git a/test/download-dht-torrent.js b/test/download-dht-torrent.js
index 42279c5..ed76d65 100644
--- a/test/download-dht-torrent.js
+++ b/test/download-dht-torrent.js
@@ -12,7 +12,6 @@ var leavesParsed = parseTorrent(leavesTorrent)
// remove trackers from .torrent file
leavesParsed.announce = []
-leavesParsed.announceList = []
test('Download using DHT (via .torrent file)', function (t) {
t.plan(8)
diff --git a/test/download-tracker-magnet.js b/test/download-tracker-magnet.js
index 2a47792..843a3d6 100644
--- a/test/download-tracker-magnet.js
+++ b/test/download-tracker-magnet.js
@@ -45,7 +45,6 @@ function magnetDownloadTest (t, serverType) {
: 'udp://127.0.0.1:' + port
leavesParsed.announce = [ announceUrl ]
- leavesParsed.announceList = [[ announceUrl ]]
magnetUri = 'magnet:?xt=urn:btih:' + leavesParsed.infoHash + '&tr=' + encodeURIComponent(announceUrl)
cb(null, tracker)
})
diff --git a/test/download-tracker-torrent.js b/test/download-tracker-torrent.js
index ba3c371..415c112 100644
--- a/test/download-tracker-torrent.js
+++ b/test/download-tracker-torrent.js
@@ -45,7 +45,6 @@ function torrentDownloadTest (t, serverType) {
// Overwrite announce with our local tracker
leavesParsed.announce = [ announceUrl ]
- leavesParsed.announceList = [[ announceUrl ]]
cb(null, tracker)
})