mirror of
https://github.com/webtorrent/bittorrent-tracker
synced 2025-10-06 08:12:50 +02:00
fix: mangled scrape infohashes (#486)
This commit is contained in:
@@ -4,7 +4,7 @@ import clone from 'clone'
|
|||||||
import Debug from 'debug'
|
import Debug from 'debug'
|
||||||
import get from 'simple-get'
|
import get from 'simple-get'
|
||||||
import Socks from 'socks'
|
import Socks from 'socks'
|
||||||
import { bin2hex, hex2bin, arr2text } from 'uint8-util'
|
import { bin2hex, hex2bin, arr2text, text2arr, arr2hex } from 'uint8-util'
|
||||||
|
|
||||||
import common from '../common.js'
|
import common from '../common.js'
|
||||||
import Tracker from './tracker.js'
|
import Tracker from './tracker.js'
|
||||||
@@ -244,12 +244,14 @@ class HTTPTracker extends Tracker {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
keys.forEach(infoHash => {
|
keys.forEach(_infoHash => {
|
||||||
// TODO: optionally handle data.flags.min_request_interval
|
// TODO: optionally handle data.flags.min_request_interval
|
||||||
// (separate from announce interval)
|
// (separate from announce interval)
|
||||||
const response = Object.assign(data[infoHash], {
|
const infoHash = _infoHash.length !== 20 ? arr2hex(text2arr(_infoHash)) : bin2hex(_infoHash)
|
||||||
|
|
||||||
|
const response = Object.assign(data[_infoHash], {
|
||||||
announce: this.announceUrl,
|
announce: this.announceUrl,
|
||||||
infoHash: bin2hex(infoHash)
|
infoHash
|
||||||
})
|
})
|
||||||
this.client.emit('scrape', response)
|
this.client.emit('scrape', response)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user