From 2cde87c859ee4c8d9b50357605e8dbd3ff99b2b3 Mon Sep 17 00:00:00 2001 From: Eric Baer Date: Thu, 18 Sep 2014 16:53:05 -0700 Subject: [PATCH] Correct IP filtering to accomodate local development --- lib/gith.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/gith.js b/lib/gith.js index ef864e6..b57f7d8 100644 --- a/lib/gith.js +++ b/lib/gith.js @@ -241,8 +241,8 @@ var listen = function( eventaur, port ) { } req.on( "end", function() { - if ( _.indexOf( gith.ips, req.connection.remoteAddress ) >= 0 || - _.indexOf( gith.ips, "*" ) >= 0 ) { + if ( _.contains( gith.ips, req.connection.remoteAddress ) || + req.connection.remoteAddress === '127.0.0.1' ) { if ( /^payload=/.test( data ) ) { var payload = JSON.parse( querystring.unescape(data.slice(8)) ); eventaur.emit( "payload", payload ); @@ -250,7 +250,7 @@ var listen = function( eventaur, port ) { 'Content-type': 'text/html' }); } - } + } res.end(); }); @@ -281,11 +281,11 @@ module.exports.create = function( port ) { }; // https://github.com/danheberden/gith/issues/13 - ret.ips = [ - '207.97.227.253', - '50.57.128.197', - '108.171.174.178', - '50.57.231.61' + ret.ips = [ + '207.97.227.253', + '50.57.128.197', + '108.171.174.178', + '50.57.231.61' ]; // add the listen method to the function - bind to ret