koa-simple-ratelimit
Advanced tools
Comparing version 1.2.0 to 2.0.0
13
index.js
@@ -52,4 +52,15 @@ 'use strict'; | ||
if (id === false) return next(); | ||
if (id === false) { | ||
return next(); | ||
} | ||
// whitelist | ||
if (opts.whitelist && opts.whitelist.indexOf(id) !== -1) { | ||
return next(); | ||
} | ||
// blacklist | ||
if (opts.blacklist && opts.blacklist.indexOf(id) !== -1) { | ||
return ctx.throw(403); | ||
} | ||
const name = `limit:${id}:count`; | ||
@@ -56,0 +67,0 @@ return find(opts.db, name).then((cur) => { |
@@ -5,3 +5,3 @@ { | ||
"repository": "scttcper/koa-simple-ratelimit", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"keywords": [ | ||
@@ -22,10 +22,10 @@ "koa", | ||
"devDependencies": { | ||
"koa": "2.0.0", | ||
"mocha": "^2.5.3", | ||
"koa": "^2.0.0-beta.4", | ||
"mocha": "^3.0.1", | ||
"redis": "^2.6.2", | ||
"should": "^9.0.2", | ||
"eslint": "~3.0.0", | ||
"eslint-config-airbnb-base": "~3.0.1", | ||
"eslint-plugin-import": "~1.10.0", | ||
"supertest": "^1.2.0" | ||
"should": "^10.0.0", | ||
"eslint": "~3.2.2", | ||
"eslint-config-airbnb-base": "~5.0.1", | ||
"eslint-plugin-import": "~1.12.0", | ||
"supertest": "^2.0.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
@@ -36,3 +36,5 @@ | ||
return ctx.ip; | ||
} | ||
}, | ||
blacklist: [], | ||
whitelist: [] | ||
})); | ||
@@ -39,0 +41,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6990
101
96