Comparing version 1.4.2 to 1.5.0
58
index.js
var crypto = require('crypto'); | ||
var http = require('https'); | ||
var http_tls = require('https'); | ||
var http_request = require('http'); | ||
var request = require('sync-request'); | ||
@@ -51,3 +52,2 @@ var LINKHUB_API_VERSION = "1.0"; | ||
var hostURL = UseStaticIP ? 'ga-auth.linkhub.co.kr' : 'auth.linkhub.co.kr'; | ||
var options = { | ||
@@ -74,3 +74,2 @@ host : hostURL, | ||
var hostURL = UseStaticIP ? 'ga-auth.linkhub.co.kr' : 'auth.linkhub.co.kr'; | ||
Token(function(token) { | ||
@@ -100,3 +99,2 @@ var options = { | ||
var hostURL = UseStaticIP ? 'ga-auth.linkhub.co.kr' : 'auth.linkhub.co.kr'; | ||
Token(function(token) { | ||
@@ -127,3 +125,2 @@ var options = { | ||
var hostURL = UseStaticIP ? 'ga-auth.linkhub.co.kr' : 'auth.linkhub.co.kr'; | ||
Token(function(token) { | ||
@@ -155,14 +152,38 @@ var options = { | ||
exports.httpRequest = function(data,options) { | ||
return function(success,error) { | ||
http.request(options,function(response) { | ||
var res = ''; | ||
response.on('data',function(chunk) { | ||
res += chunk; | ||
}); | ||
response.on('end',function(){ | ||
if(this.statusCode == '200') success(JSON.parse(res)); | ||
else if(error) error(JSON.parse(res)); | ||
}); | ||
}).end(data); | ||
if (this._options.AuthURL == undefined || this._options.AuthURL.includes("https")) { | ||
return function(success,error) { | ||
http_tls.request(options,function(response) { | ||
var res = ''; | ||
response.on('data',function(chunk) { | ||
res += chunk; | ||
}); | ||
response.on('end',function(){ | ||
if(this.statusCode == '200') success(JSON.parse(res)); | ||
else if(error) error(JSON.parse(res)); | ||
}); | ||
}).end(data); | ||
} | ||
} else { | ||
options.host = this._options.AuthURL.substring(7, this._options.AuthURL.lastIndexOf(":")); | ||
options.port = Number(this._options.AuthURL.substring(this._options.AuthURL.lastIndexOf(":")+1)); | ||
return function(success,error) { | ||
http_request.request(options,function(response) { | ||
var res = ''; | ||
response.on('data',function(chunk) { | ||
res += chunk; | ||
}); | ||
response.on('end',function(){ | ||
if(this.statusCode == '200') success(JSON.parse(res)); | ||
else if(error) error(JSON.parse(res)); | ||
}); | ||
}).end(data); | ||
} | ||
} | ||
} | ||
@@ -175,3 +196,6 @@ | ||
if(_this._options.AuthURL != undefined) hostURL = _this._options.AuthURL; | ||
if(_this._options.UseLocalTimeYN == undefined) _this._options.UseLocalTimeYN = true; | ||
if(_this._options.UseLocalTimeYN){ | ||
@@ -182,3 +206,3 @@ return new Date().toISOString(); | ||
'GET', | ||
hostURL | ||
hostURL +"/Time" | ||
); | ||
@@ -185,0 +209,0 @@ return response.body.toString('utf8'); |
{ | ||
"name": "linkhub", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "linkhub auth modules for www.linkhub.co.kr", | ||
@@ -5,0 +5,0 @@ "author": "Kim Seongjun <pallet027@gmail.com>", |
# node-linkhub | ||
ë§íŦíë¸ node.js SDK v1.4.2 | ||
ë§íŦíë¸ node.js SDK v1.5.0 | ||
@@ -4,0 +4,0 @@ ## Install |
@@ -6,2 +6,4 @@ var linkhub = require('./'); | ||
SecretKey : 'SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=', | ||
UseLocalTimeYN : false, | ||
//AuthURL : 'http://192.168.0.228:9080', | ||
defaultErrorHandler : function(linkhubException) { | ||
@@ -8,0 +10,0 @@ console.log('Exception Occur : [' + linkhubException.code + '] ' + linkhubException.message); |
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
Network access
Supply chain riskThis module accesses the network.
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
8854
195
2