feat!: allowlist & denylist (#13681)
* feat!: allowlist & denylist * Update website/i18n/zh/docusaurus-plugin-content-docs/current/install/README.md * Update website/i18n/zh/docusaurus-plugin-content-docs/current/install/README.md * Update website/i18n/zh/docusaurus-plugin-content-docs/current/install/README.md * Update website/docs/install/README.md * Update website/docs/install/README.md * Update website/docs/install/README.md * Update website/docs/install/README.md * Update website/docs/install/README.md * chore: revert ---------
This commit is contained in:
@@ -15,7 +15,7 @@ module.exports = async (ctx, next) => {
|
||||
const accessKey = ctx.query.key;
|
||||
const accessCode = ctx.query.code;
|
||||
|
||||
const isControlled = config.accessKey || config.whitelist || config.blacklist;
|
||||
const isControlled = config.accessKey || config.allowlist || config.denylist;
|
||||
|
||||
const allowLocalhost = config.allowLocalhost && (await isLocalhost(ip));
|
||||
|
||||
@@ -38,14 +38,14 @@ module.exports = async (ctx, next) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.whitelist) {
|
||||
if (config.whitelist.find((white) => ip.includes(white) || requestPath.includes(white) || requestUA.includes(white))) {
|
||||
if (config.allowlist) {
|
||||
if (config.allowlist.find((item) => ip.includes(item) || requestPath.includes(item) || requestUA.includes(item))) {
|
||||
return grant();
|
||||
}
|
||||
}
|
||||
|
||||
if (config.blacklist) {
|
||||
if (!config.blacklist.find((black) => ip.includes(black) || requestPath.includes(black) || requestUA.includes(black))) {
|
||||
if (config.denylist) {
|
||||
if (!config.denylist.find((item) => ip.includes(item) || requestPath.includes(item) || requestUA.includes(item))) {
|
||||
return grant();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user