add numbers blacklist

This commit is contained in:
Ian Webster 2014-06-30 22:25:31 -07:00
parent f16ca7d7ed
commit e4385527b7
3 changed files with 18 additions and 0 deletions

4
.gitignore vendored
View File

@ -1,3 +1,7 @@
banned_numbers.js
mixpanel_config.js
keys.json
*.swp *.swp
*.swo *.swo
*~ *~

6
app.js
View File

@ -7,6 +7,7 @@ var express = require('express')
, spawn = require('child_process').spawn , spawn = require('child_process').spawn
, Stream = require('stream') , Stream = require('stream')
, providers = require('./providers.js') , providers = require('./providers.js')
, banned_numbers = require('./banned_numbers.js')
, mixpanel_config = require('./mixpanel_config.js') , mixpanel_config = require('./mixpanel_config.js')
var access_keys; var access_keys;
@ -68,6 +69,11 @@ function textRequestHandler(req, res, number, region, key) {
res.send({success:false,message:'Number and message parameters are required.'}); res.send({success:false,message:'Number and message parameters are required.'});
return; return;
} }
if (banned_numbers.BLACKLIST[number]) {
mpq.track('banned number');
res.send({success:false,message:'Sorry, texts to this number are disabled.'});
return;
}
var ip = req.header('X-Real-IP');// || req.connection.remoteAddress; var ip = req.header('X-Real-IP');// || req.connection.remoteAddress;
var message = req.body.message; var message = req.body.message;

View File

@ -0,0 +1,8 @@
// People are added to this list if they contact Textbelt when someone is
// abusing the service.
exports = module.exports = {
BLACKLIST: {
"9145555555": true,
}
}