新增启动参数-proxy-server与-proxy-bypass-list
This commit is contained in:
@@ -37,6 +37,12 @@ if (process.platform == 'linux') app.commandLine.appendSwitch('use-gl', 'desktop
|
||||
// https://github.com/electron/electron/issues/22691
|
||||
app.commandLine.appendSwitch('wm-window-animations-disabled')
|
||||
|
||||
// proxy
|
||||
if (global.envParams.cmdParams['proxy-server']) {
|
||||
app.commandLine.appendSwitch('proxy-server', global.envParams.cmdParams['proxy-server'])
|
||||
app.commandLine.appendSwitch('proxy-bypass-list', global.envParams.cmdParams['proxy-bypass-list'] ?? '<local>')
|
||||
}
|
||||
// if (global.envParams.cmdParams['proxy-pac-url']) app.commandLine.appendSwitch('proxy-pac-url', global.envParams.cmdParams['proxy-pac-url'])
|
||||
|
||||
const { navigationUrlWhiteList, themes } = require('../common/config')
|
||||
const { getWindowSizeInfo, initSetting, updateSetting } = require('./utils')
|
||||
|
||||
@@ -47,6 +47,15 @@ export default () => {
|
||||
|
||||
|
||||
getEnvParams().then(envParams => {
|
||||
const envProxy = envParams['proxy-server']
|
||||
if (envProxy && typeof envProxy == 'string') {
|
||||
const [host, port = ''] = envProxy.split(':')
|
||||
proxy.envProxy = {
|
||||
host,
|
||||
port,
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化我的列表、下载列表等数据
|
||||
initData().then(() => {
|
||||
handleEnvParams(envParams) // 处理传入的启动参数
|
||||
|
||||
@@ -387,9 +387,13 @@ export const clearCache = () => rendererInvoke(NAMES.mainWindow.clear_cache)
|
||||
export const setWindowSize = (width, height) => rendererSend(NAMES.mainWindow.set_window_size, { width, height })
|
||||
|
||||
|
||||
export const getProxyInfo = () => proxy.enable && proxy.host
|
||||
? `http://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port};`
|
||||
: undefined
|
||||
export const getProxyInfo = () => {
|
||||
return proxy.enable && proxy.host
|
||||
? `http://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port};`
|
||||
: proxy.envProxy
|
||||
? `http://${proxy.envProxy.host}:${proxy.envProxy.port};`
|
||||
: undefined
|
||||
}
|
||||
|
||||
|
||||
export const assertApiSupport = source => qualityList.value[source] != undefined
|
||||
|
||||
@@ -6,8 +6,8 @@ dd
|
||||
p
|
||||
base-checkbox(id="setting_network_proxy_enable" v-model="currentStting.network.proxy.enable" :label="$t('setting__is_enable')")
|
||||
p
|
||||
base-input.gap-left(v-model.trim="currentStting.network.proxy.host" :placeholder="$t('setting__network_proxy_host')")
|
||||
base-input.gap-left(v-model.trim="currentStting.network.proxy.port" :placeholder="$t('setting__network_proxy_port')")
|
||||
base-input.gap-left(v-model.trim="currentStting.network.proxy.host" :placeholder="proxy.envProxy ? proxy.envProxy.host : $t('setting__network_proxy_host')")
|
||||
base-input.gap-left(v-model.trim="currentStting.network.proxy.port" :placeholder="proxy.envProxy ? proxy.envProxy.port : $t('setting__network_proxy_port')")
|
||||
p
|
||||
base-input.gap-left(v-model.trim="currentStting.network.proxy.username" :placeholder="$t('setting__network_proxy_username')")
|
||||
base-input.gap-left(v-model.trim="currentStting.network.proxy.password" type="password" :placeholder="$t('setting__network_proxy_password')")
|
||||
@@ -51,6 +51,7 @@ export default {
|
||||
|
||||
return {
|
||||
currentStting,
|
||||
proxy,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user