mirror of
https://github.com/webtorrent/bittorrent-tracker
synced 2025-10-06 00:02:49 +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 get from 'simple-get'
|
||||
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 Tracker from './tracker.js'
|
||||
@@ -244,12 +244,14 @@ class HTTPTracker extends Tracker {
|
||||
return
|
||||
}
|
||||
|
||||
keys.forEach(infoHash => {
|
||||
keys.forEach(_infoHash => {
|
||||
// TODO: optionally handle data.flags.min_request_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,
|
||||
infoHash: bin2hex(infoHash)
|
||||
infoHash
|
||||
})
|
||||
this.client.emit('scrape', response)
|
||||
})
|
||||
|
Reference in New Issue
Block a user