q-koa 8.1.1 → 8.1.3
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
CHANGED
|
@@ -133,10 +133,11 @@ 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
|
+
|
|
137
|
+
if (ctx.request.header['user-agent'].startsWith('Tencent Security')) {
|
|
138
|
+
return ctx.ERROR('error')
|
|
139
|
+
}
|
|
136
140
|
if (this.config.blackList.includes(ip)) {
|
|
137
|
-
if (this.config.log.request) {
|
|
138
|
-
console.log('IP==>', ip)
|
|
139
|
-
}
|
|
140
141
|
return ctx.ERROR('error')
|
|
141
142
|
}
|
|
142
143
|
const appName = url.split('/')[1]
|
|
@@ -1021,7 +1022,7 @@ class APP {
|
|
|
1021
1022
|
continue
|
|
1022
1023
|
}
|
|
1023
1024
|
const model = myInclude[j].model
|
|
1024
|
-
const modelName = model.getName()
|
|
1025
|
+
const modelName = myInclude[j].as || model.getName()
|
|
1025
1026
|
|
|
1026
1027
|
if (app[appName].attributes[controller][modelName + '_id']) {
|
|
1027
1028
|
const idList = rows
|
|
@@ -1085,7 +1086,7 @@ class APP {
|
|
|
1085
1086
|
continue
|
|
1086
1087
|
}
|
|
1087
1088
|
const model = myInclude[j].model
|
|
1088
|
-
const modelName = model.getName()
|
|
1089
|
+
const modelName = myInclude[j].as || model.getName()
|
|
1089
1090
|
if (
|
|
1090
1091
|
app[appName].attributes[controller][modelName + '_id']
|
|
1091
1092
|
) {
|
|
@@ -223,7 +223,7 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
|
|
|
223
223
|
setting: obj.setting.map((i) => {
|
|
224
224
|
if (i.code === 'is_check' && i.value === false) {
|
|
225
225
|
return {
|
|
226
|
-
...i.toJSON(),
|
|
226
|
+
...(i.toJSON ? i.toJSON() : i),
|
|
227
227
|
value: apiVersion === cacheVersion,
|
|
228
228
|
}
|
|
229
229
|
}
|