disconnect
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -0,1 +1,6 @@ | ||
0.4.2 / 2014-10-20 | ||
================== | ||
* Fixed `this` scoping in `about()` | ||
* Switched from `http` to the newly implemented `https` Discogs API connection for added security | ||
0.4.1 / 2014-10-16 | ||
@@ -2,0 +7,0 @@ ================== |
'use strict'; | ||
var http = require('http'), | ||
var https = require('https'), | ||
zlib = require('zlib'), | ||
@@ -31,6 +31,6 @@ url = require('url'), | ||
host: 'api.discogs.com', | ||
oauthRequestUrl: 'http://api.discogs.com/oauth/request_token', | ||
oauthAccessUrl: 'http://api.discogs.com/oauth/access_token', | ||
oauthAuthorizeUrl: 'http://www.discogs.com/oauth/authorize', | ||
port: 80, | ||
oauthRequestUrl: 'https://api.discogs.com/oauth/request_token', | ||
oauthAccessUrl: 'https://api.discogs.com/oauth/access_token', | ||
oauthAuthorizeUrl: 'https://www.discogs.com/oauth/authorize', | ||
port: 443, | ||
customHeaders: { | ||
@@ -152,4 +152,5 @@ 'Accept': 'application/json; application/octet-stream', | ||
DiscogsClient.prototype.about = function(callback){ | ||
var self = this; | ||
this.get('', function(err, data){ | ||
if(data){ data.disconnect = { version: pkg.version, userAgent: (this.userAgent||config.customHeaders['User-Agent']) }; } | ||
if(data){ data.disconnect = { version: pkg.version, userAgent: (self.userAgent||config.customHeaders['User-Agent']) }; } | ||
(typeof callback === 'function')&&callback(err, data); | ||
@@ -198,3 +199,3 @@ }); | ||
var oa = new OAuth({consumer: {public: oauth.consumerKey, secret: oauth.consumerSecret}}), | ||
fullUrl = (urlParts.protocol && urlParts.host) ? urlParts.href : 'http://'+config.host+urlParts.path, | ||
fullUrl = (urlParts.protocol && urlParts.host) ? urlParts.href : 'https://'+config.host+urlParts.path, | ||
authObj = oa.authorize({method: method, url: fullUrl}, {public: oauth.token, secret: oauth.tokenSecret}); | ||
@@ -204,3 +205,3 @@ headers['Authorization'] = oa.toHeader(authObj).Authorization; | ||
// Set the HTTP request options | ||
// Set the HTTPS request options | ||
var options = { | ||
@@ -214,4 +215,4 @@ host: urlParts.host||config.host, | ||
// Build the HTTP request | ||
var req = http.request(options, function(res){ | ||
// Build the HTTPS request | ||
var req = https.request(options, function(res){ | ||
var data = '', | ||
@@ -218,0 +219,0 @@ rateLimit = null, |
@@ -104,5 +104,5 @@ 'use strict'; | ||
/** | ||
* Search the database (requires authentication starting 2014-10-14) | ||
* Search the database | ||
* @param {String} query - The search query | ||
* @param {Object} [params] - Search parameters as defined on http://www.discogs.com/developers/resources/database/search-endpoint.html | ||
* @param {Object} [params] - Search parameters as defined on http://www.discogs.com/developers/#page:database,header:database-search | ||
* @param {Function} [callback] - Callback function | ||
@@ -109,0 +109,0 @@ */ |
{ | ||
"name": "disconnect", | ||
"description": "An easy to use client library to connect with the discogs.com API v2.0", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"keywords": ["discogs", "api", "client", "oauth"], | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/bartve/disconnect", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
45334
1101