Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve logic of strict mode #83

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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){
nondanee marked this conversation as resolved.
Show resolved Hide resolved
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