mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-23 01:32:03 -07:00
fix(rate limits): Testing recursive rate limits
This commit is contained in:
@@ -129,9 +129,17 @@ class RateLimits {
|
||||
const resource = _this.getResource(req.url)
|
||||
wlogger.debug(`resource: ${resource}`)
|
||||
|
||||
// Key will be the JWT ID if it exists, otherwise the IP address of the caller.
|
||||
let key = userId || req.ip
|
||||
res.locals.key = key // Feedback for tests.
|
||||
|
||||
// For internal calls that make a lot of internal calls, like
|
||||
// hydrateUtxoDetails(), the origin of the caller will be passed in
|
||||
// via the POST body.
|
||||
if (req.body && req.body.ip) {
|
||||
key = req.body.ip
|
||||
}
|
||||
|
||||
// const pointsToConsume = userId ? 1 : 30
|
||||
decoded.resource = resource
|
||||
let pointsToConsume = _this.calcPoints(decoded)
|
||||
@@ -147,11 +155,6 @@ class RateLimits {
|
||||
|
||||
wlogger.info(`origin: ${origin}`)
|
||||
|
||||
const bodyOrigin = req.body.origin
|
||||
if (bodyOrigin) {
|
||||
console.log(`bodyOrigin: ${bodyOrigin}`)
|
||||
}
|
||||
|
||||
// If the request originates from one of the approved wallet apps, then
|
||||
// apply paid-access rate limits.
|
||||
// console.log(`origin: ${JSON.stringify(origin, null, 2)}`)
|
||||
|
||||
Reference in New Issue
Block a user