mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 04:01:35 +00:00
chore(deps): update webtorrent (#445)
* chore(deps): update webtorrent * fix: dependencies (#446) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Cas <6506529+ThaUnknown@users.noreply.github.com>
This commit is contained in:
parent
138c6e7327
commit
b72d226ed8
@ -159,13 +159,13 @@ class HTTPTracker extends Tracker {
|
||||
} catch (err) {
|
||||
return cb(new Error(`Error decoding tracker response: ${err.message}`))
|
||||
}
|
||||
const failure = data['failure reason']
|
||||
const failure = data['failure reason'] && Buffer.from(data['failure reason']).toString()
|
||||
if (failure) {
|
||||
debug(`failure from ${requestUrl} (${failure})`)
|
||||
return cb(new Error(failure))
|
||||
}
|
||||
|
||||
const warning = data['warning message']
|
||||
const warning = data['warning message'] && Buffer.from(data['warning message']).toString()
|
||||
if (warning) {
|
||||
debug(`warning from ${requestUrl} (${warning})`)
|
||||
self.client.emit('warning', new Error(warning))
|
||||
@ -194,10 +194,10 @@ class HTTPTracker extends Tracker {
|
||||
this.client.emit('update', response)
|
||||
|
||||
let addrs
|
||||
if (Buffer.isBuffer(data.peers)) {
|
||||
if (ArrayBuffer.isView(data.peers)) {
|
||||
// tracker returned compact response
|
||||
try {
|
||||
addrs = compact2string.multi(data.peers)
|
||||
addrs = compact2string.multi(Buffer.from(data.peers))
|
||||
} catch (err) {
|
||||
return this.client.emit('warning', err)
|
||||
}
|
||||
@ -211,10 +211,10 @@ class HTTPTracker extends Tracker {
|
||||
})
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(data.peers6)) {
|
||||
if (ArrayBuffer.isView(data.peers6)) {
|
||||
// tracker returned compact response
|
||||
try {
|
||||
addrs = compact2string.multi6(data.peers6)
|
||||
addrs = compact2string.multi6(Buffer.from(data.peers6))
|
||||
} catch (err) {
|
||||
return this.client.emit('warning', err)
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"bencode": "^3.0.0",
|
||||
"bencode": "^3.0.3",
|
||||
"bittorrent-peerid": "^1.3.3",
|
||||
"bn.js": "^5.2.0",
|
||||
"chrome-dgram": "^3.0.6",
|
||||
@ -54,11 +54,11 @@
|
||||
"devDependencies": {
|
||||
"@mapbox/node-pre-gyp": "1.0.10",
|
||||
"@webtorrent/semantic-release-config": "1.0.8",
|
||||
"magnet-uri": "7.0.1",
|
||||
"magnet-uri": "7.0.2",
|
||||
"semantic-release": "20.1.0",
|
||||
"standard": "*",
|
||||
"tape": "5.6.3",
|
||||
"webtorrent-fixtures": "2.0.0",
|
||||
"webtorrent-fixtures": "2.0.2",
|
||||
"wrtc": "0.4.7"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -351,7 +351,7 @@ class Server extends EventEmitter {
|
||||
}
|
||||
|
||||
createSwarm (infoHash, cb) {
|
||||
if (Buffer.isBuffer(infoHash)) infoHash = infoHash.toString('hex')
|
||||
if (ArrayBuffer.isView(infoHash)) infoHash = infoHash.toString('hex')
|
||||
|
||||
process.nextTick(() => {
|
||||
const swarm = this.torrents[infoHash] = new Server.Swarm(infoHash, this)
|
||||
@ -360,7 +360,7 @@ class Server extends EventEmitter {
|
||||
}
|
||||
|
||||
getSwarm (infoHash, cb) {
|
||||
if (Buffer.isBuffer(infoHash)) infoHash = infoHash.toString('hex')
|
||||
if (ArrayBuffer.isView(infoHash)) infoHash = infoHash.toString('hex')
|
||||
|
||||
process.nextTick(() => {
|
||||
cb(null, this.torrents[infoHash])
|
||||
|
@ -47,7 +47,7 @@ function testRequestHandler (t, serverType) {
|
||||
|
||||
client1.once('update', data => {
|
||||
t.equal(data.complete, 246)
|
||||
t.equal(data.extraData.toString(), 'hi')
|
||||
t.equal(Buffer.from(data.extraData).toString(), 'hi')
|
||||
|
||||
client1.destroy(() => {
|
||||
t.pass('client1 destroyed')
|
||||
|
Loading…
Reference in New Issue
Block a user