add numbers blacklist
This commit is contained in:
parent
f16ca7d7ed
commit
e4385527b7
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,7 @@
|
|||||||
|
banned_numbers.js
|
||||||
|
mixpanel_config.js
|
||||||
|
keys.json
|
||||||
|
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
*~
|
*~
|
||||||
|
6
app.js
6
app.js
@ -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;
|
||||||
|
8
banned_numbers_example.js
Normal file
8
banned_numbers_example.js
Normal 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,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user