From edcb237a03c83d2837813abef2fcd62295e052a0 Mon Sep 17 00:00:00 2001 From: ZunSThy Date: Sat, 29 Oct 2016 01:42:19 +0800 Subject: [PATCH 1/3] add 'use-agent' option --- index.js | 6 ++++++ lib/torrent.js | 1 + package.json | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 708571d7..6537c610 100644 --- a/index.js +++ b/index.js @@ -78,6 +78,12 @@ function WebTorrent (opts) { } self.nodeIdBuffer = Buffer.from(self.nodeId, 'hex') + if (typeof opts.userAgent === 'string') { + self.userAgent = opts.userAgent + } else { + self.userAgent = 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' + } + self.destroyed = false self.listening = false self.torrentPort = opts.torrentPort || 0 diff --git a/lib/torrent.js b/lib/torrent.js index 579f3daa..95b26ad5 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -330,6 +330,7 @@ Torrent.prototype._onListening = function () { infoHash: self.infoHash, announce: self.announce, peerId: self.client.peerId, + userAgent: self.client.userAgent, dht: !self.private && self.client.dht, tracker: trackerOpts, port: self.client.torrentPort diff --git a/package.json b/package.json index 00dab424..478c9720 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webtorrent", "description": "Streaming torrent client", - "version": "0.97.2", + "version": "0.97.3", "author": { "name": "WebTorrent, LLC", "email": "feross@webtorrent.io", From 89a614fb09ade114c446faf7aee820188e36695d Mon Sep 17 00:00:00 2001 From: ZunSThy Date: Sun, 6 Nov 2016 15:47:52 +0800 Subject: [PATCH 2/3] Revert "add 'use-agent' option" This reverts commit edcb237a03c83d2837813abef2fcd62295e052a0. --- index.js | 6 ------ lib/torrent.js | 1 - package.json | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/index.js b/index.js index 6537c610..708571d7 100644 --- a/index.js +++ b/index.js @@ -78,12 +78,6 @@ function WebTorrent (opts) { } self.nodeIdBuffer = Buffer.from(self.nodeId, 'hex') - if (typeof opts.userAgent === 'string') { - self.userAgent = opts.userAgent - } else { - self.userAgent = 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' - } - self.destroyed = false self.listening = false self.torrentPort = opts.torrentPort || 0 diff --git a/lib/torrent.js b/lib/torrent.js index 95b26ad5..579f3daa 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -330,7 +330,6 @@ Torrent.prototype._onListening = function () { infoHash: self.infoHash, announce: self.announce, peerId: self.client.peerId, - userAgent: self.client.userAgent, dht: !self.private && self.client.dht, tracker: trackerOpts, port: self.client.torrentPort diff --git a/package.json b/package.json index 478c9720..00dab424 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webtorrent", "description": "Streaming torrent client", - "version": "0.97.3", + "version": "0.97.2", "author": { "name": "WebTorrent, LLC", "email": "feross@webtorrent.io", From 8b1bb129f7fb16560c03b9b2c8bbea9fffa00649 Mon Sep 17 00:00:00 2001 From: ZunSThy Date: Sun, 6 Nov 2016 15:49:13 +0800 Subject: [PATCH 3/3] add 'use-agent' option --- index.js | 6 ++++++ lib/torrent.js | 1 + 2 files changed, 7 insertions(+) diff --git a/index.js b/index.js index 708571d7..6537c610 100644 --- a/index.js +++ b/index.js @@ -78,6 +78,12 @@ function WebTorrent (opts) { } self.nodeIdBuffer = Buffer.from(self.nodeId, 'hex') + if (typeof opts.userAgent === 'string') { + self.userAgent = opts.userAgent + } else { + self.userAgent = 'WebTorrent/' + VERSION + ' (https://webtorrent.io)' + } + self.destroyed = false self.listening = false self.torrentPort = opts.torrentPort || 0 diff --git a/lib/torrent.js b/lib/torrent.js index 579f3daa..95b26ad5 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -330,6 +330,7 @@ Torrent.prototype._onListening = function () { infoHash: self.infoHash, announce: self.announce, peerId: self.client.peerId, + userAgent: self.client.userAgent, dht: !self.private && self.client.dht, tracker: trackerOpts, port: self.client.torrentPort