diff --git a/middleware/access-control.js b/middleware/access-control.js index 412ebc347..9cae1ce55 100644 --- a/middleware/access-control.js +++ b/middleware/access-control.js @@ -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(); }; diff --git a/routes/bbc/index.js b/routes/bbc/index.js index b948d0556..59e7d0b7f 100644 --- a/routes/bbc/index.js +++ b/routes/bbc/index.js @@ -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 {