refactor: avoid promise overhead (#8028)

This commit is contained in:
Sukka
2021-08-17 02:45:53 +08:00
committed by GitHub
parent 8053b33b03
commit 6e3b58ed1d
543 changed files with 5295 additions and 5694 deletions

View File

@@ -29,24 +29,24 @@ module.exports = async (ctx, next) => {
await next();
} else {
if (!isControlled || allowLocalhost) {
return await grant();
return grant();
}
if (config.accessKey) {
if (config.accessKey === accessKey || accessCode === md5(requestPath + config.accessKey)) {
return await grant();
return grant();
}
}
if (config.whitelist) {
if (config.whitelist.find((white) => ip.includes(white) || requestPath.includes(white) || requestUA.includes(white))) {
return await grant();
return grant();
}
}
if (config.blacklist) {
if (!config.blacklist.find((black) => ip.includes(black) || requestPath.includes(black) || requestUA.includes(black))) {
return await grant();
return grant();
}
}