Comparing version 0.5.0 to 0.5.1
# CHANGELOG | ||
## v0.5.1 | ||
* chore: Use SSL options when dealing with prebuilts. | ||
## v0.5.0 | ||
@@ -4,0 +8,0 @@ |
@@ -6,3 +6,4 @@ 'use strict'; | ||
const os = require('os'); | ||
const get = require('simple-get'); | ||
const nugget = require('nugget'); | ||
const rc = require('rc'); | ||
const pump = require('pump'); | ||
@@ -34,10 +35,35 @@ const tfs = require('tar-fs'); | ||
let reqOpts = {url: downloadUrl}; | ||
let tempFile = path.join(os.tmpdir(), 'prebuild.tar.gz'); | ||
let req = get(reqOpts, function(err, res) { | ||
if (err) { | ||
return onerror(err); | ||
} | ||
if (res.statusCode !== 200) { | ||
if (res.statusCode === 404) { | ||
let nuggetOpts = { | ||
dir: os.tmpdir(), | ||
target: 'prebuild.tar.gz', | ||
strictSSL: true | ||
}; | ||
let npmrc = {}; | ||
try { | ||
rc('npm', npmrc); | ||
} catch (error) { | ||
console.warn('Error reading npm configuration: ' + error.message); | ||
} | ||
if (npmrc && npmrc.proxy) { | ||
nuggetOpts.proxy = npmrc.proxy; | ||
} | ||
if (npmrc && npmrc['https-proxy']) { | ||
nuggetOpts.proxy = npmrc['https-proxy']; | ||
} | ||
if (npmrc && npmrc['strict-ssl'] === false) { | ||
nuggetOpts.strictSSL = false; | ||
} | ||
nugget(downloadUrl, nuggetOpts, function(errors) { | ||
if (errors) { | ||
const error = errors[0]; | ||
if (error.message.indexOf('404') === -1) { | ||
onerror(error); | ||
} else { | ||
console.error('Prebuild for current platform (' + currentPlatform + ') not found!'); | ||
@@ -48,34 +74,26 @@ console.error('Try to compile for your platform:'); | ||
console.error(''); | ||
return onerror('Prebuild for current platform (' + currentPlatform + ') not found!'); | ||
onerror('Prebuild for current platform (' + currentPlatform + ') not found!'); | ||
} | ||
return onerror('Bad response from prebuild server. Code: ' + res.statusCode); | ||
} | ||
pump(res, fs.createWriteStream(tempFile), function(err) { | ||
let options = { | ||
readable: true, | ||
writable: true, | ||
hardlinkAsFilesFallback: true | ||
}; | ||
let binaryName; | ||
let updateName = function(entry) { | ||
if (/\.node$/i.test(entry.name)) binaryName = entry.name | ||
}; | ||
let targetFile = path.join(__dirname, 'builds', essential); | ||
let extract = tfs.extract(targetFile, options) | ||
.on('entry', updateName); | ||
pump(fs.createReadStream(path.join(nuggetOpts.dir, nuggetOpts.target)), zlib.createGunzip(), extract, function(err) { | ||
if (err) { | ||
throw err; | ||
return onerror(err); | ||
} | ||
let options = { | ||
readable: true, | ||
writable: true, | ||
hardlinkAsFilesFallback: true | ||
}; | ||
let binaryName; | ||
let updateName = function(entry) { | ||
if (/\.node$/i.test(entry.name)) binaryName = entry.name | ||
}; | ||
let targetFile = path.join(__dirname, 'builds', essential); | ||
let extract = tfs.extract(targetFile, options) | ||
.on('entry', updateName); | ||
pump(fs.createReadStream(tempFile), zlib.createGunzip(), extract, function(err) { | ||
if (err) { | ||
return onerror(err); | ||
} | ||
cb() | ||
}) | ||
}) | ||
cb() | ||
}); | ||
}); | ||
req.setTimeout(30 * 1000, function() { | ||
req.abort() | ||
}) | ||
} | ||
@@ -82,0 +100,0 @@ |
{ | ||
"name": "iohook", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Node.js global keyboard and mouse hook", | ||
@@ -41,4 +41,5 @@ "main": "index.js", | ||
"node-abi": "^2.4.0", | ||
"nugget": "^2.0.1", | ||
"pump": "^1.0.3", | ||
"simple-get": "^2.8.1", | ||
"rc": "^1.2.8", | ||
"tar-fs": "^1.16.2" | ||
@@ -45,0 +46,0 @@ }, |
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
74705
970
7
+ Addednugget@^2.0.1
+ Addedrc@^1.2.8
+ Addedajv@6.12.6(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.0.0(transitive)
+ Addednugget@2.2.0(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedobject-keys@0.4.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpretty-bytes@4.0.2(transitive)
+ Addedprogress-stream@1.2.0(transitive)
+ Addedpsl@1.10.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedreadable-stream@1.1.14(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsingle-line-log@1.1.2(transitive)
+ Addedspeedometer@0.1.4(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedthrottleit@0.0.2(transitive)
+ Addedthrough2@0.2.3(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedxtend@2.1.2(transitive)
- Removedsimple-get@^2.8.1
- Removeddecompress-response@3.3.0(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removedsimple-concat@1.0.1(transitive)
- Removedsimple-get@2.8.2(transitive)