Matias Alejo Garcia
8 years ago
No known key found for this signature in database
GPG Key ID: 2470DB551277AB3
1 changed files with
9 additions and
4 deletions
-
lib/expressapp.js
|
|
@ -171,16 +171,21 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var createWalletLimiter; |
|
|
|
|
|
|
|
if (Defaults.RateLimit.createWallet) { |
|
|
|
log.info('', 'Limiting wallet creation per IP: %d req/h', (Defaults.RateLimit.createWallet.max / Defaults.RateLimit.createWallet.windowMs * 60 * 60 * 1000).toFixed(2)) |
|
|
|
var createWalletLimiter = new RateLimit(Defaults.RateLimit.createWallet); |
|
|
|
router.use(/\/v\d+\/wallets\/$/, createWalletLimiter) |
|
|
|
createWalletLimiter = new RateLimit(Defaults.RateLimit.createWallet); |
|
|
|
// router.use(/\/v\d+\/wallets\/$/, createWalletLimiter)
|
|
|
|
} else { |
|
|
|
createWalletLimiter = function(req, res, next) { |
|
|
|
next() |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
// DEPRECATED
|
|
|
|
|
|
|
|
router.post('/v1/wallets/', function(req, res) { |
|
|
|
router.post('/v1/wallets/', createWalletLimiter, function(req, res) { |
|
|
|
logDeprecated(req); |
|
|
|
var server; |
|
|
|
try { |
|
|
@ -197,7 +202,7 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
router.post('/v2/wallets/', function(req, res) { |
|
|
|
router.post('/v2/wallets/', createWalletLimiter, function(req, res) { |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|