Comparing version 3.2.9 to 3.3.0-1
var crypto = require('crypto'); | ||
var file = require('fs'); | ||
var urlUtility = require('url'); | ||
var http = require('http'); | ||
@@ -79,2 +80,3 @@ var https = require('https'); | ||
PARAMETER_INVALID_PROXY: 173, | ||
PARAMETER_INVALID_NO_NOTIFY: 174, | ||
NETWORK_SERVER_OFFLINE: 200, | ||
@@ -93,2 +95,3 @@ NETWORK_GENERAL_ERROR: 201, | ||
this.port = 80; | ||
this.proxy = null; | ||
this.applicationKey = applicationKey; | ||
@@ -273,2 +276,19 @@ this.applicationSecret = applicationSecret; | ||
if (this.proxy != null) | ||
{ | ||
protocol = 'http'; | ||
if (this.port == 433) | ||
{ | ||
protocol = 'https'; | ||
} | ||
options.path = protocol + '://' + options.host + options.path | ||
options.host = this.proxy.host; | ||
options.port = this.proxy.port; | ||
if (this.proxy.username != null && this.proxy.password != null) | ||
{ | ||
options.headers = {'proxy-authorization':'Basic ' + new Buffer(this.proxy.username + ':' + this.proxy.password).toString('base64')}; | ||
} | ||
} | ||
var request = _getNet().request(options, function (res) { | ||
@@ -303,3 +323,3 @@ if (type == 'binary') { | ||
function _getNet(self){ | ||
if (this.port == 433){ | ||
if (this.port == 433 && this.proxy == null){ | ||
return https; | ||
@@ -396,3 +416,5 @@ } | ||
'proxy': '', | ||
'mergeId': '' | ||
'mergeId': '', | ||
'noCookieNotifications':false, | ||
'address': '' | ||
}; | ||
@@ -450,3 +472,5 @@ | ||
'proxy': context['proxy'], | ||
'mergeid': context['mergeId'] | ||
'mergeid': context['mergeId'], | ||
'nonotify': _toInt(context['noCookieNotifications']), | ||
'address': context['address'] | ||
}; | ||
@@ -462,3 +486,4 @@ | ||
+ '|' + context['postData'] + '|' + context['targetElement'] + '|' + context['templateId'] + '|' + context['templateVariables'] | ||
+ '|' + context['pageHeight'] + '|' + context['pageWidth'] + '|' + context['browserWidth'] + '|' + context['proxy'] + '|' + context['mergeId']; | ||
+ '|' + context['pageHeight'] + '|' + context['pageWidth'] + '|' + context['browserWidth'] + '|' + context['proxy'] + '|' + context['mergeId'] | ||
+ '|' + context['address'] + '|' + _toInt(context['noCookieNotifications']); | ||
@@ -500,3 +525,5 @@ return new Request(url, requestParams, _createFirstSignature(applicationSecret, target, isPost), signaturePartTwo, isPost, startDelay, target); | ||
'proxy': '', | ||
'mergeId': '' | ||
'mergeId': '', | ||
'noCookieNotifications':false, | ||
'address': '' | ||
}; | ||
@@ -556,3 +583,5 @@ | ||
'proxy': context['proxy'], | ||
'mergeid': context['mergeId'] | ||
'mergeid': context['mergeId'], | ||
'nonotify': _toInt(context['noCookieNotifications']), | ||
'address': context['address'] | ||
}; | ||
@@ -568,3 +597,3 @@ | ||
+ '|' + context['exportUrl'] + '|' + context['waitForElement'] + '|' + context['encryptionKey'] + '|' + _toInt(context['noAds']) | ||
+ '|' + context['postData']+ '|' + context['browserWidth']+ '|' + context['pageHeight']+ '|' + context['pageWidth']+ '|' + context['templateVariables'] + '|' + context['proxy'] + '|' + context['mergeId']; | ||
+ '|' + context['postData']+ '|' + context['browserWidth']+ '|' + context['pageHeight']+ '|' + context['pageWidth']+ '|' + context['templateVariables'] + '|' + context['proxy'] + '|' + context['mergeId'] + '|' + context['address'] + '|' + _toInt(context['noCookieNotifications']); | ||
@@ -587,3 +616,4 @@ return new Request(url, requestParams, _createFirstSignature(applicationSecret, target, isPost), signaturePartTwo, isPost, startDelay, target); | ||
'postData':'', | ||
'proxy': '' | ||
'proxy': '', | ||
'address': '' | ||
}; | ||
@@ -608,3 +638,4 @@ | ||
'post': context['postData'], | ||
'proxy': context['proxy'] | ||
'proxy': context['proxy'], | ||
'address': context['address'] | ||
}; | ||
@@ -617,3 +648,4 @@ | ||
+ '|' + _toInt(context['includeHeaderNames']) + '|' + context['targetElement'] + '|' + context['format'] + '|' + parseInt(context['requestAs']) | ||
+ '|' + context['country'] + '|' + context['exportUrl'] + '|' + context['encryptionKey'] + '|' + context['postData'] + '|' + context['proxy']; | ||
+ '|' + context['country'] + '|' + context['exportUrl'] + '|' + context['encryptionKey'] + '|' + context['postData'] + '|' + context['proxy'] | ||
+ '|' + context['address']; | ||
@@ -694,3 +726,5 @@ return new Request(url, requestParams, _createFirstSignature(applicationSecret, target, isPost), signaturePartTwo, isPost, startDelay, target); | ||
'postData':'', | ||
'proxy': '' | ||
'proxy': '', | ||
'noCookieNotifications':false, | ||
'address': '' | ||
}; | ||
@@ -727,3 +761,5 @@ | ||
'post': context['postData'], | ||
'proxy': context['proxy'] | ||
'proxy': context['proxy'], | ||
'nonotify': _toInt(context['noCookieNotifications']), | ||
'address': context['address'] | ||
}; | ||
@@ -737,3 +773,4 @@ | ||
+ '|' + context['hideElement'] + '|' + context['exportUrl'] + '|' + context['waitForElement'] + '|' + _toInt(context['transparent']) | ||
+ '|' + context['encryptionKey'] + '|' + _toInt(context['noAds']) + '|' + context['postData'] + '|' + context['proxy']; | ||
+ '|' + context['encryptionKey'] + '|' + _toInt(context['noAds']) + '|' + context['postData'] + '|' + context['proxy'] + '|' + context['address'] | ||
+ '|' + _toInt(context['noCookieNotifications']); | ||
@@ -772,3 +809,3 @@ return new Request(url, requestParams, _createFirstSignature(applicationSecret, target, isPost), signaturePartTwo, isPost, startDelay, target); | ||
error.message = 'File: ' + filePath + ' does not exist'; | ||
error.code = self.FILE_NON_EXISTANT_PATH; | ||
error.code = this.FILE_NON_EXISTANT_PATH; | ||
throw error; | ||
@@ -1245,2 +1282,17 @@ }; | ||
/* | ||
* This method enables a local proxy server to be used for all requests | ||
* | ||
* For more detailed documentation please visit: http://grabz.it/api/nodejs/grabzitclient.aspx#localproxy | ||
*/ | ||
GrabzItClient.prototype.set_local_proxy = function (proxyUrl) { | ||
const pUrl = urlUtility.parse(proxyUrl); | ||
this.proxy = { | ||
'host':pUrl.hostname, | ||
'port':pUrl.port, | ||
'username':decodeURIComponent(pUrl.username), | ||
'password':decodeURIComponent(pUrl.password) | ||
} | ||
} | ||
/* | ||
* This method creates a cryptographically secure encryption key to pass to the encryption key parameter. | ||
@@ -1247,0 +1299,0 @@ * |
{ | ||
"name": "grabzit", | ||
"description": "Automatically convert HTML or URL's into images, DOCX or PDF documents. Additionally convert online videos into animated GIF's or convert HTML tables to CSV.", | ||
"version": "3.2.9", | ||
"version": "3.3.0-1", | ||
"main": "./lib/grabzit", | ||
@@ -26,9 +26,4 @@ "keywords": [ | ||
], | ||
"licenses": [ | ||
{ | ||
"name": "MIT", | ||
"url": "http://opensource.org/licenses/MIT" | ||
} | ||
], | ||
"license": "MIT", | ||
"homepage": "https://grabz.it" | ||
} |
@@ -1,2 +0,2 @@ | ||
GrabzIt 3.2 | ||
GrabzIt 3.3 | ||
=========== | ||
@@ -3,0 +3,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
50133
0
1156
1