q-koa 8.2.1 → 8.2.2
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 +5 -2
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -18,6 +18,7 @@ const chalk = require('chalk')
|
|
|
18
18
|
const { Random } = require('mockjs')
|
|
19
19
|
const util = require('util')
|
|
20
20
|
const jwt = require('jsonwebtoken')
|
|
21
|
+
const verify = util.promisify(jwt.verify)
|
|
21
22
|
const fsExtra = require('fs-extra')
|
|
22
23
|
const { getObject } = require('./file/utils')
|
|
23
24
|
const restc = require('./restc')
|
|
@@ -131,10 +132,12 @@ class APP {
|
|
|
131
132
|
* jwt中间件
|
|
132
133
|
*/
|
|
133
134
|
this.app.use(async (ctx, next) => {
|
|
134
|
-
const verify = util.promisify(jwt.verify)
|
|
135
135
|
const { url, host, ip, method } = ctx.request
|
|
136
136
|
|
|
137
|
-
if (
|
|
137
|
+
if (
|
|
138
|
+
ctx.request.header['user-agent'] &&
|
|
139
|
+
ctx.request.header['user-agent'].startsWith('Tencent Security')
|
|
140
|
+
) {
|
|
138
141
|
return ctx.ERROR('error')
|
|
139
142
|
}
|
|
140
143
|
if (this.config.blackList.includes(ip)) {
|