Skip to content

Commit

Permalink
fix: improve logic of strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
palfans committed May 7, 2019
1 parent 9546a63 commit 2c9d387
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const server = require('./server')
global.port = config.port
global.proxy = config.proxyUrl ? parse(config.proxyUrl) : null
global.hosts = {}, hook.target.host.forEach(host => global.hosts[host] = config.forceHost)
config.strict ? server.whitelist = ['music.163.com', 'music.126.net', 'vod.126.net'] : server.blanklist = []
config.strict ? server.whitelist = ['music.163.com', 'music.126.net', 'vod.126.net', 'localhost'] : server.blacklist = []
server.authentication = config.token || null
global.endpoint = config.endpoint

Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const proxy = {
let allow = server.whitelist.some(match)
let deny = server.blacklist.some(match)
// console.log('allow', allow, 'deny', deny)
if(!allow && deny){
if(!allow || deny){
return Promise.reject(ctx.error = 'filter')
}
}
Expand Down Expand Up @@ -171,7 +171,7 @@ const server = {
}

server.whitelist = ['.*']
server.blacklist = ['.*']
server.blacklist = []
server.authentication = null

module.exports = server

0 comments on commit 2c9d387

Please sign in to comment.