torrent-properties
Advanced tools
Comparing version 1.1.3 to 1.1.4
24
index.js
@@ -49,3 +49,3 @@ const sodium = require('sodium-universal') | ||
// this.check[i].infoHash = res.getData.v.ih ? res.v.ih : this.check[i].infoHash | ||
// this.check[i].sequence = res.getData.seq ? res.seq : this.check[i].sequence | ||
// this.check[i].seq = res.getData.seq ? res.seq : this.check[i].seq | ||
// this.check[i].getData = res.getData | ||
@@ -75,3 +75,3 @@ // this.check[i].putData = res.putData | ||
this.check[i].infoHash = res.getData.v.ih ? res.v.ih : this.check[i].infoHash | ||
this.check[i].sequence = res.getData.seq ? res.seq : this.check[i].sequence | ||
this.check[i].seq = res.getData.seq ? res.seq : this.check[i].seq | ||
this.check[i].getData = res.getData | ||
@@ -148,3 +148,3 @@ this.check[i].putData = res.putData | ||
// lookAtProperty.infoHash = data.infoHash | ||
// lookAtProperty.sequence = data.sequence | ||
// lookAtProperty.seq = data.seq | ||
// return callback(null, lookAtProperty) | ||
@@ -184,3 +184,3 @@ // } | ||
const infoHash = res.v.ih | ||
const sequence = res.seq ? res.seq : 0 | ||
const seq = res.seq ? res.seq : 0 | ||
@@ -190,9 +190,9 @@ if(manage){ | ||
propertyData.infoHash = infoHash | ||
propertyData.sequence = sequence | ||
propertyData.seq = seq | ||
} else { | ||
this.check.push({ address, infoHash, sequence, own: false, isActive: true, getData: res }) | ||
this.check.push({ address, infoHash, seq, own: false, isActive: true, getData: res }) | ||
} | ||
} | ||
return callback(null, { address, infoHash, sequence, own: false }) | ||
return callback(null, { address, infoHash, seq, own: false }) | ||
} else if(!res){ | ||
@@ -232,4 +232,4 @@ if(manage && propertyData){ | ||
const buffSecKey = Buffer.from(keypair.secret, 'hex') | ||
const sequence = propertyData ? propertyData.sequence + 1 : 0 | ||
const getData = {k: buffAddKey, v: {ih: Buffer.from(infoHash, 'hex')}, seq: sequence, sign: (buf) => {return sign(buf, buffAddKey, buffSecKey)}} | ||
const seq = propertyData ? propertyData.seq + 1 : 0 | ||
const getData = {k: buffAddKey, v: {ih: Buffer.from(infoHash, 'hex')}, seq, sign: (buf) => {return sign(buf, buffAddKey, buffSecKey)}} | ||
@@ -246,9 +246,9 @@ this.dht.put(getData, (putErr, hash, number) => { | ||
propertyData.infoHash = infoHash | ||
propertyData.sequence = sequence | ||
propertyData.seq = seq | ||
} else { | ||
this.check.push({address: keypair.address, infoHash, sequence, own: true, isActive: true, putData: {hash, number}, getData}) | ||
this.check.push({address: keypair.address, infoHash, seq, own: true, isActive: true, putData: {hash, number}, getData}) | ||
} | ||
} | ||
callback(null, {magnetURI, infoHash, sequence, address: keypair.address, secret: keypair.secret, own: true, hash}) | ||
callback(null, {magnetURI, infoHash, seq, address: keypair.address, secret: keypair.secret, own: true, hash}) | ||
}) | ||
@@ -255,0 +255,0 @@ } |
{ | ||
"name": "torrent-properties", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "BEP 46", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13736