mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
update: 增加对带用户名密码的代理支持
This commit is contained in:
parent
e1c4ed4268
commit
8c70630d2d
@ -147,10 +147,11 @@ const createRequest = (method, url, data = {}, options) => {
|
|||||||
} else {
|
} else {
|
||||||
const purl = new URL(options.proxy)
|
const purl = new URL(options.proxy)
|
||||||
if (purl.hostname) {
|
if (purl.hostname) {
|
||||||
const agent = tunnel.httpsOverHttp({
|
const agent = tunnel[purl.protocol === 'https' ? 'httpsOverHttp' : 'httpOverHttp']({
|
||||||
proxy: {
|
proxy: {
|
||||||
host: purl.hostname,
|
host: purl.hostname,
|
||||||
port: purl.port || 80,
|
port: purl.port || 80,
|
||||||
|
proxyAuth: purl.username && purl.password ? (purl.username + ':' + purl.password) : ''
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
settings.httpsAgent = agent
|
settings.httpsAgent = agent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user