diff --git a/.gitignore b/.gitignore index 5902a10..584df56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +banned_numbers.js +mixpanel_config.js +keys.json + *.swp *.swo *~ diff --git a/app.js b/app.js index 6dfc123..7d8f484 100644 --- a/app.js +++ b/app.js @@ -7,6 +7,7 @@ var express = require('express') , spawn = require('child_process').spawn , Stream = require('stream') , providers = require('./providers.js') + , banned_numbers = require('./banned_numbers.js') , mixpanel_config = require('./mixpanel_config.js') 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.'}); 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 message = req.body.message; diff --git a/banned_numbers_example.js b/banned_numbers_example.js new file mode 100644 index 0000000..fad14b0 --- /dev/null +++ b/banned_numbers_example.js @@ -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, + } +}