mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 02:21:36 +00:00
removed xtend
This commit is contained in:
parent
a141baa279
commit
65b2bdc804
@ -3,7 +3,6 @@ module.exports = Client
|
|||||||
var Buffer = require('safe-buffer').Buffer
|
var Buffer = require('safe-buffer').Buffer
|
||||||
var debug = require('debug')('bittorrent-tracker:client')
|
var debug = require('debug')('bittorrent-tracker:client')
|
||||||
var EventEmitter = require('events').EventEmitter
|
var EventEmitter = require('events').EventEmitter
|
||||||
var extend = require('xtend')
|
|
||||||
var inherits = require('inherits')
|
var inherits = require('inherits')
|
||||||
var once = require('once')
|
var once = require('once')
|
||||||
var parallel = require('run-parallel')
|
var parallel = require('run-parallel')
|
||||||
@ -130,7 +129,7 @@ Client.scrape = function (opts, cb) {
|
|||||||
if (!opts.infoHash) throw new Error('Option `infoHash` is required')
|
if (!opts.infoHash) throw new Error('Option `infoHash` is required')
|
||||||
if (!opts.announce) throw new Error('Option `announce` 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,
|
infoHash: Array.isArray(opts.infoHash) ? opts.infoHash[0] : opts.infoHash,
|
||||||
peerId: Buffer.from('01234567890123456789'), // dummy value
|
peerId: Buffer.from('01234567890123456789'), // dummy value
|
||||||
port: 6881 // dummy value
|
port: 6881 // dummy value
|
||||||
@ -291,6 +290,6 @@ Client.prototype._defaultAnnounceOpts = function (opts) {
|
|||||||
if (opts.uploaded == null) opts.uploaded = 0
|
if (opts.uploaded == null) opts.uploaded = 0
|
||||||
if (opts.downloaded == null) opts.downloaded = 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
|
return opts
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ var arrayRemove = require('unordered-array-remove')
|
|||||||
var bencode = require('bencode')
|
var bencode = require('bencode')
|
||||||
var compact2string = require('compact2string')
|
var compact2string = require('compact2string')
|
||||||
var debug = require('debug')('bittorrent-tracker:http-tracker')
|
var debug = require('debug')('bittorrent-tracker:http-tracker')
|
||||||
var extend = require('xtend')
|
|
||||||
var get = require('simple-get')
|
var get = require('simple-get')
|
||||||
var inherits = require('inherits')
|
var inherits = require('inherits')
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ HTTPTracker.prototype.announce = function (opts) {
|
|||||||
var self = this
|
var self = this
|
||||||
if (self.destroyed) return
|
if (self.destroyed) return
|
||||||
|
|
||||||
var params = extend(opts, {
|
var params = Object.assign({}, opts, {
|
||||||
compact: (opts.compact == null) ? 1 : opts.compact,
|
compact: (opts.compact == null) ? 1 : opts.compact,
|
||||||
info_hash: self.client._infoHashBinary,
|
info_hash: self.client._infoHashBinary,
|
||||||
peer_id: self.client._peerIdBinary,
|
peer_id: self.client._peerIdBinary,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
module.exports = WebSocketTracker
|
module.exports = WebSocketTracker
|
||||||
|
|
||||||
var debug = require('debug')('bittorrent-tracker:websocket-tracker')
|
var debug = require('debug')('bittorrent-tracker:websocket-tracker')
|
||||||
var extend = require('xtend')
|
|
||||||
var inherits = require('inherits')
|
var inherits = require('inherits')
|
||||||
var Peer = require('simple-peer')
|
var Peer = require('simple-peer')
|
||||||
var randombytes = require('randombytes')
|
var randombytes = require('randombytes')
|
||||||
@ -55,7 +54,7 @@ WebSocketTracker.prototype.announce = function (opts) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var params = extend(opts, {
|
var params = Object.assign({}, opts, {
|
||||||
action: 'announce',
|
action: 'announce',
|
||||||
info_hash: self.client._infoHashBinary,
|
info_hash: self.client._infoHashBinary,
|
||||||
peer_id: self.client._peerIdBinary
|
peer_id: self.client._peerIdBinary
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
var Buffer = require('safe-buffer').Buffer
|
||||||
var extend = require('xtend/mutable')
|
|
||||||
|
|
||||||
exports.DEFAULT_ANNOUNCE_PEERS = 50
|
exports.DEFAULT_ANNOUNCE_PEERS = 50
|
||||||
exports.MAX_ANNOUNCE_PEERS = 82
|
exports.MAX_ANNOUNCE_PEERS = 82
|
||||||
@ -23,4 +22,4 @@ exports.hexToBinary = function (str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var config = require('./common-node')
|
var config = require('./common-node')
|
||||||
extend(exports, config)
|
Object.assign(exports, config)
|
||||||
|
@ -41,8 +41,7 @@
|
|||||||
"string2compact": "^1.1.1",
|
"string2compact": "^1.1.1",
|
||||||
"uniq": "^1.0.1",
|
"uniq": "^1.0.1",
|
||||||
"unordered-array-remove": "^1.0.2",
|
"unordered-array-remove": "^1.0.2",
|
||||||
"ws": "^6.0.0",
|
"ws": "^6.0.0"
|
||||||
"xtend": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron-webrtc": "^0.3.0",
|
"electron-webrtc": "^0.3.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user