Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = Client
var Buffer = require('safe-buffer').Buffer
var debug = require('debug')('bittorrent-tracker:client')
var EventEmitter = require('events').EventEmitter
var extend = require('xtend')
var inherits = require('inherits')
var once = require('once')
var parallel = require('run-parallel')
Expand Down Expand Up @@ -130,7 +129,7 @@ Client.scrape = function (opts, cb) {
if (!opts.infoHash) throw new Error('Option `infoHash` is required')
if (!opts.announce) throw new Error('Option `announce` is required')

var clientOpts = extend(opts, {
var clientOpts = Object.assign({}, opts, {
infoHash: Array.isArray(opts.infoHash) ? opts.infoHash[0] : opts.infoHash,
peerId: Buffer.from('01234567890123456789'), // dummy value
port: 6881 // dummy value
Expand Down Expand Up @@ -291,6 +290,6 @@ Client.prototype._defaultAnnounceOpts = function (opts) {
if (opts.uploaded == null) opts.uploaded = 0
if (opts.downloaded == null) opts.downloaded = 0

if (self._getAnnounceOpts) opts = extend(opts, self._getAnnounceOpts())
if (self._getAnnounceOpts) opts = Object.assign({}, opts, self._getAnnounceOpts())
return opts
}
3 changes: 1 addition & 2 deletions lib/client/http-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var arrayRemove = require('unordered-array-remove')
var bencode = require('bencode')
var compact2string = require('compact2string')
var debug = require('debug')('bittorrent-tracker:http-tracker')
var extend = require('xtend')
var get = require('simple-get')
var inherits = require('inherits')

Expand Down Expand Up @@ -47,7 +46,7 @@ HTTPTracker.prototype.announce = function (opts) {
var self = this
if (self.destroyed) return

var params = extend(opts, {
var params = Object.assign({}, opts, {
compact: (opts.compact == null) ? 1 : opts.compact,
info_hash: self.client._infoHashBinary,
peer_id: self.client._peerIdBinary,
Expand Down
3 changes: 1 addition & 2 deletions lib/client/websocket-tracker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = WebSocketTracker

var debug = require('debug')('bittorrent-tracker:websocket-tracker')
var extend = require('xtend')
var inherits = require('inherits')
var Peer = require('simple-peer')
var randombytes = require('randombytes')
Expand Down Expand Up @@ -55,7 +54,7 @@ WebSocketTracker.prototype.announce = function (opts) {
return
}

var params = extend(opts, {
var params = Object.assign({}, opts, {
action: 'announce',
info_hash: self.client._infoHashBinary,
peer_id: self.client._peerIdBinary
Expand Down
3 changes: 1 addition & 2 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

var Buffer = require('safe-buffer').Buffer
var extend = require('xtend/mutable')

exports.DEFAULT_ANNOUNCE_PEERS = 50
exports.MAX_ANNOUNCE_PEERS = 82
Expand All @@ -23,4 +22,4 @@ exports.hexToBinary = function (str) {
}

var config = require('./common-node')
extend(exports, config)
Object.assign(exports, config)
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"string2compact": "^1.1.1",
"uniq": "^1.0.1",
"unordered-array-remove": "^1.0.2",
"ws": "^6.0.0",
"xtend": "^4.0.0"
"ws": "^6.0.0"
},
"devDependencies": {
"electron-webrtc": "^0.3.0",
Expand Down