q-koa 8.1.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/app.js +6 -0
- package/core/config.js +1 -0
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -133,6 +133,12 @@ class APP {
|
|
|
133
133
|
this.app.use(async (ctx, next) => {
|
|
134
134
|
const verify = util.promisify(jwt.verify)
|
|
135
135
|
const { url, host, ip, method } = ctx.request
|
|
136
|
+
if (this.config.blackList.includes(ip)) {
|
|
137
|
+
if (this.config.log.request) {
|
|
138
|
+
console.log('IP==>', ip)
|
|
139
|
+
}
|
|
140
|
+
return ctx.ERROR('error')
|
|
141
|
+
}
|
|
136
142
|
const appName = url.split('/')[1]
|
|
137
143
|
const { secret, whiteList, _whiteList, tokenKey, expiresIn } =
|
|
138
144
|
ctx.app[appName] && ctx.app[appName].appConfig
|
package/core/config.js
CHANGED