Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yellowbot

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yellowbot - npm Package Compare versions

Comparing version 1.2.2 to 1.3.1

.gitignore

88

lib/yellowbot.js

@@ -19,13 +19,2 @@ "use strict";

api.server = {
port: 80,
timeout: 15 * 1000,
headers: {
Connection: "Keep-Alive",
'User-Agent': 'node-yellowbot/' + api.PACKAGE.version
}
};
var config = {};
function encode_utf8(s) {

@@ -42,10 +31,28 @@ // borrowed from http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html

api.configure = function(params) {
api.create = function(params) {
var api2 = Object.create(this);
if (params) {
api2.configure(params);
}
return api2;
};
api.configure = function (params) {
this.server = {
port: 80,
timeout: 45 * 1000,
headers: {
Connection: "Keep-Alive",
'User-Agent': 'node-yellowbot/' + api.PACKAGE.version
}
};
// pointless to be this verbose
if (params.api_key) {
config.api_key = params.api_key;
this.server.api_key = params.api_key;
}
if (params.api_secret) {
config.api_secret = params.api_secret;
this.server.api_secret = params.api_secret;
}

@@ -56,7 +63,9 @@

}
api.server.host = params.host;
api.server.headers.Host = api.server.host;
this.server.host = params.host;
this.server.headers.Host = this.server.host;
if (params.dev && params.dev.inDev) {
api.server.headers.Authorization = 'Basic ' + new Buffer(params.dev.auth, 'utf8').toString('base64');
//params.auth = "devel:0nly";
if (params.auth) {
this.server.headers.Authorization = 'Basic ' + new Buffer(params.auth, 'utf8').toString('base64');
}

@@ -68,11 +77,11 @@ };

if (!params) { params = {}; }
_sign(params);
this._sign(params);
var path = '/signin/partner/?' + querystring.stringify(params);
return "http://" + api.server.host + path;
return "http://" + this.server.host + path;
};
function _sign(params) {
this._sign = function(params) {
params.api_ts = Math.round((new Date()).getTime() / 1000);
params.api_key = config.api_key;
params.api_key = this.server.api_key;

@@ -103,3 +112,6 @@ // remove any api_sig parameter that might have snuck in here.

params.api_sig = hmac_sha256( encode_utf8(parameters), config.api_secret );
params.api_sig = hmac_sha256(
encode_utf8(parameters),
this.server.api_secret
);

@@ -139,2 +151,5 @@ // modifies the params structure in place, so not returning anything

}
if (typeof data.error === 'undefined') {
data.error = null;
}
if (cb) { cb(data.error, data); }

@@ -150,11 +165,13 @@ }

if (!params) { params = {}; }
_sign(params);
this._sign(params);
if (api.debug) { console.log("api request:", method, params); }
var req = http.request(
_.extend({},
api.server,
this.server,
{
path: '/api/' + method + '?' + querystring.stringify(params),
method: "GET",
headers: api.server.headers
headers: this.server.headers
}

@@ -180,7 +197,7 @@ ),

params = _.clone(params);
_sign(params);
this._sign(params);
var req = http.request(
_.extend({},
api.server,
this.server,
{

@@ -190,3 +207,3 @@ method: 'POST',

headers: _.extend({},
api.server.headers,
this.server.headers,
{

@@ -214,3 +231,3 @@ 'Content-Type': 'application/json',

var url = "http://" + api.server.host + '/api/' + method;
var url = "http://" + this.server.host + '/api/' + method;

@@ -227,7 +244,7 @@ var has_files = false;

params = _.clone(params);
_sign(params);
this._sign(params);
var req = rest.post(url,
_.extend({},
api.server,
this.server,
{

@@ -239,3 +256,3 @@ method: 'POST',

headers: _.extend({},
api.server.headers,
this.server.headers,
{}

@@ -254,2 +271,5 @@ )

}
if (typeof data.error === 'undefined') {
data.error = null;
}
if (cb) { cb(data.error, data); }

@@ -260,3 +280,3 @@ });

api.log_action = function(params, data, cb) {
api.post("reputation_management/log_action", params, data, cb);
this.post("reputation_management/log_action", params, data, cb);
};

@@ -5,3 +5,3 @@ {

"description": "YellowBot API wrapper",
"version": "1.2.2",
"version": "1.3.1",
"homepage": "https://github.com/solfo/node-yellowbot",

@@ -8,0 +8,0 @@ "repository": {

@@ -12,4 +12,10 @@ # node-yellowbot.js - node.js yellowbot API

var api = require('yellowbot');
api.configure( { api_key: "abcd1234", api_secret: "def0" } );
var api2 = api.create();
api2.configure( ... );
var api3 = api.create({ api_key: "abc987", ... });
api.get("test/echo",

@@ -16,0 +22,0 @@ { "foo": "bar", "another query": "parameter" },

Sorry, the diff of this file is not supported yet

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