现在如果在设置或者启动参数配置了代理服务,那么应用内的图片、音频加载,歌曲下载也将走代理
This commit is contained in:
@@ -294,3 +294,31 @@ export const setPowerSaveBlocker = (enabled: boolean) => {
|
||||
powerSaveBlockerId = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let envProxy: null | { host: string, port: number } = null
|
||||
export const getProxy = () => {
|
||||
if (global.lx.appSetting['network.proxy.enable'] && global.lx.appSetting['network.proxy.host']) {
|
||||
return {
|
||||
host: global.lx.appSetting['network.proxy.host'],
|
||||
port: parseInt(global.lx.appSetting['network.proxy.port'] || '80'),
|
||||
}
|
||||
}
|
||||
if (envProxy) {
|
||||
return {
|
||||
host: envProxy.host,
|
||||
port: envProxy.port,
|
||||
}
|
||||
} else {
|
||||
const envProxyStr = envParams.cmdParams['proxy-server']
|
||||
if (envProxyStr && typeof envProxyStr == 'string') {
|
||||
const [host, port = ''] = envProxyStr.split(':')
|
||||
return envProxy = {
|
||||
host,
|
||||
port: parseInt(port || '80'),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user