Skip to content

Commit

Permalink
update whitelist & blacklist (127.0.0.1:2017)
Browse files Browse the repository at this point in the history
  • Loading branch information
nondanee committed Mar 7, 2020
1 parent 9f1c940 commit 91e631d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ if (config.token && !/\S+:\S+/.test(config.token)) {
const parse = require('url').parse
const hook = require('./hook')
const server = require('./server')
const escape = string => string.replace(/\./g, '\\.')
const random = array => array[Math.floor(Math.random() * array.length)]
const target = Array.from(hook.target.host)

global.port = config.port
global.proxy = config.proxyUrl ? parse(config.proxyUrl) : null
global.hosts = target.reduce((result, host) => Object.assign(result, {[host]: config.forceHost}), {})
server.whitelist = ['music.126.net', 'vod.126.net'].map(escape)
server.whitelist = ['://[\\w.]*music\\.126\\.net', '://[\\w.]*vod\\.126\\.net']
if (config.strict) server.blacklist.push('.*')
server.authentication = config.token || null
global.endpoint = config.endpoint
Expand Down
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const server = {
}

server.whitelist = []
server.blacklist = ['//127\\.\\d+\\.\\d+\\.\\d+', '//localhost']
server.blacklist = ['://127\\.\\d+\\.\\d+\\.\\d+', '://localhost']
server.authentication = null

module.exports = server

0 comments on commit 91e631d

Please sign in to comment.