Socket
Socket
Sign inDemoInstall

socializr

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socializr - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

11

lib/auth/pubsub.js

@@ -16,6 +16,9 @@ var util = require('util')

PubSubConnection.prototype.validateSignature = function(data){
var decipher = crypto.createDecipher('AES-128-CBC-HMAC-SHA1', this.appSecret);
decipher.update('sha1='+data, 'hex');
return decipher.final('utf8');
PubSubConnection.prototype.isSignatureValid = function(data, signature){
var hmac = crypto.createHmac('sha1', this.appSecret);
hmac.update(
typeof data == 'string' ? data : JSON.stringify(data),
'utf8'
);
return signature == hmac.digest('hex');
};

@@ -22,0 +25,0 @@

@@ -12,8 +12,15 @@ var stream = require('stream')

, IG_DEFAULT_SUBSRIPTION_TYPE = 'user'
, IG_OBJECT_USER = 'user'
, IG_OBJECT_TAG = 'tag'
, IG_OBJECT_LOCATION = 'location'
, IG_OBJECT_GEOGRAPHY = 'geography'
, IG_DEFAULT_SUBSRIPTION_TYPE = IG_OBJECT_USER
;
function Instagram(opts){

@@ -51,5 +58,4 @@

//object: 'user | tag | location | geography'
switch( sub.type){
case 'tag':
case IG_OBJECT_TAG:
data = _.extend(data,{

@@ -60,3 +66,3 @@ object_id: sub.tag

case 'location':
case IG_OBJECT_LOCATION:
data = _.extend(data,{

@@ -67,3 +73,3 @@ object_id: sub.location

case 'geography':
case IG_OBJECT_GEOGRAPHY:
data = _.extend(data,{

@@ -84,7 +90,7 @@ lat: sub.lat,

Instagram.prototype.unsubscribe = function(){
Instagram.prototype.unsubscribe = function(type){
this._apiRequest( 'subscriptions', 'DELETE', {
client_id: this.clientId,
client_id: this.clientId,
client_secret: this.clientSecret,
object: 'user | tag | location'
object: type
}, function(){

@@ -117,6 +123,17 @@

var conn = new PubSubConnection( this.appSecret)
, signature = req.get('X-Hub-Signature')
;
console.log(req.get('X-Hub-Signature'));
console.log(conn.isSignatureValid( req.text, req.get('X-Hub-Signature')));
console.log(req.body);
_this.write(req.body);
res.send(true);
if( conn.isSignatureValid( req.text, signature)){
_this.write(req.body);
res.send(200);
}else{
res.send(401);
}
};

@@ -135,28 +152,9 @@ };

console.log(chunk[i]);
this.getMediaByTag({
tag: chunk.object_id,
//var auth = this.oauthConnections.get( chunk.entry[i].id);
//console.log(chunk.entry[i].changes[j]);
/*expected++;
this._graphRequest( chunk.entry[i].changes[j].value.post_id, 'GET', {
access_token: auth.accessToken
}, function(res){
expected--;
console.log("post:",res.text, res.body);
});
if( res.error){
console.log(res.error);
}else {
fb.push(JSON.parse(res.text));
}
if( !expected){
done();
}
})
*/
}

@@ -169,13 +167,15 @@

Instagram.prototype.getMediaByTag = function(tag){
this._apiRequest( 'tags/' + tag + '/media/recent', 'GET', {
}, function(){
Instagram.prototype.getMediaByTag = function(tag, cb){
this._apiRequest( 'tags/' + tag.tag + '/media/recent', 'GET', {
access_token: tag.accessToken
}, function(res){
cb&&cb(res.error || res.body);
});
};
Instagram.prototype.getFeed = function(token){
Instagram.prototype.getFeed = function(token, cb){
this._apiRequest( 'users/self/feed', 'GET', {
}, function(){
access_token: token
}, function(res){
cb&&cb(res.error || res.body);
});

@@ -182,0 +182,0 @@ };

{
"name": "socializr",
"version": "0.0.24",
"version": "0.0.25",
"description": "Read data streams from several social networks.",

@@ -36,4 +36,5 @@ "main": "index.js",

"underscore": "^1.6.0",
"superagent": "0.17.x"
"superagent": "0.17.x",
"async": "^0.6.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc