@@ -18,17 +18,23 @@ module.exports = async (ctx, next) => {
|
||||
const ip = ctx.ips[0] || ctx.ip;
|
||||
const requestPath = ctx.request.path;
|
||||
|
||||
if (whitelist) {
|
||||
if (!(whitelist.indexOf(ip) !== -1 || whitelist.indexOf(requestPath) !== -1)) {
|
||||
reject(ctx);
|
||||
}
|
||||
if (requestPath === '/') {
|
||||
await next();
|
||||
} else {
|
||||
if (blacklist) {
|
||||
if (blacklist.indexOf(ip) !== -1 || blacklist.indexOf(requestPath) !== -1) {
|
||||
if (whitelist) {
|
||||
if (!(whitelist.indexOf(ip) !== -1 || whitelist.indexOf(requestPath) !== -1)) {
|
||||
reject(ctx);
|
||||
}
|
||||
} else {
|
||||
if (blacklist) {
|
||||
if (blacklist.indexOf(ip) !== -1 || blacklist.indexOf(requestPath) !== -1) {
|
||||
reject(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.response.status !== 403) {
|
||||
await next();
|
||||
}
|
||||
}
|
||||
|
||||
await next();
|
||||
};
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
||||
channel = channel.split('-').join('/');
|
||||
|
||||
if (channel === 'chinese') {
|
||||
feed = await parser.parseURL('https//feeds.bbci.co.uk/zhongwen/simp/rss.xml');
|
||||
feed = await parser.parseURL('https://feeds.bbci.co.uk/zhongwen/simp/rss.xml');
|
||||
title = 'BBC News 中文网';
|
||||
link = 'https://www.bbc.com/zhongwen/simp';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user