Comparing version 12.0.4 to 12.0.5
32
index.js
const WebTorrent = require('webtorrent') | ||
const fs = require('fs-extra') | ||
const path = require('path') | ||
const sha1 = require('simple-sha1') | ||
const ed = require('ed25519-supercop') | ||
@@ -14,2 +13,3 @@ const bencode = require('bencode') | ||
const { Level } = require('level') | ||
const crypto = require('crypto') | ||
@@ -155,12 +155,10 @@ // saves us from saving secret keys(saving secret keys even encrypted secret keys is something i want to avoid) | ||
const getData = await new Promise((resolve, reject) => { | ||
sha1(addressKey, (targetID) => { | ||
this.webtorrent.dht.get(targetID, (err, res) => { | ||
if (err) { | ||
reject(err) | ||
} else if (res) { | ||
resolve(res) | ||
} else if (!res) { | ||
reject(new Error('Could not resolve address')) | ||
} | ||
}) | ||
this.webtorrent.dht.get(crypto.createHash('sha1').update(addressKey).digest("hex"), (err, res) => { | ||
if (err) { | ||
reject(err) | ||
} else if (res) { | ||
resolve(res) | ||
} else if (!res) { | ||
reject(new Error('Could not resolve address')) | ||
} | ||
}) | ||
@@ -396,3 +394,3 @@ }) | ||
const extraData = JSON.parse((await fs.readFile(extraFile)).toString()) | ||
extraData.idhash = await (async () => { | ||
const testhash = await (async () => { | ||
const testhashes = await this.getAllFiles('**/*', {cwd: folderPath, strict: false, nodir: true}) | ||
@@ -405,6 +403,7 @@ let idhashes = '' | ||
})() | ||
extraData.idhash = crypto.createHash('md5').update(testhash).digest("hex") | ||
extraData.update = extraData.update + 1 | ||
await fs.writeFile(extraFile, JSON.stringify(extraData)) | ||
} else { | ||
const idhash = await (async () => { | ||
const testhash = await (async () => { | ||
const testhashes = await this.getAllFiles('**/*', {cwd: folderPath, strict: false, nodir: true}) | ||
@@ -417,2 +416,3 @@ let idhashes = '' | ||
})() | ||
const idhash = crypto.createHash('md5').update(testhash).digest("hex") | ||
await fs.writeFile(extraFile, JSON.stringify({update: 0, idhash})) | ||
@@ -463,3 +463,3 @@ } | ||
const extraData = JSON.parse((await fs.readFile(extraFile)).toString()) | ||
extraData.idhash = await (async () => { | ||
const testhash = await (async () => { | ||
const testhashes = await this.getAllFiles('**/*', {cwd: folderPath, strict: false, nodir: true}) | ||
@@ -472,6 +472,7 @@ let idhashes = '' | ||
})() | ||
extraData.idhash = crypto.createHash('md5').update(testhash).digest("hex") | ||
extraData.update = extraData.update + 1 | ||
await fs.writeFile(extraFile, JSON.stringify(extraData)) | ||
} else { | ||
const idhash = await (async () => { | ||
const testhash = await (async () => { | ||
const testhashes = await this.getAllFiles('**/*', {cwd: folderPath, strict: false, nodir: true}) | ||
@@ -484,2 +485,3 @@ let idhashes = '' | ||
})() | ||
const idhash = crypto.createHash('md5').update(testhash).digest("hex") | ||
await fs.writeFile(extraFile, JSON.stringify({update: 0, idhash})) | ||
@@ -486,0 +488,0 @@ } |
{ | ||
"name": "torrentz", | ||
"version": "12.0.4", | ||
"version": "12.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37736
770