refs #982 Add authentication information in proxy form
This commit is contained in:
parent
bd49921e09
commit
7138ab3df2
|
@ -8166,9 +8166,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"element-ui": {
|
||||
"version": "2.4.11",
|
||||
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.4.11.tgz",
|
||||
"integrity": "sha512-RtgK0t840NAFTajGMWvylzZRSX1EkZ7V4YgAoBxhv4TtkeMscLuk/IdYOzPdlQq6IN0byx1YVBxCX+u4yYkGvw==",
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.12.0.tgz",
|
||||
"integrity": "sha512-DapyT0PW4i/1ETPHk8K8Qbe8B6hj10+dXsRTrOTFryV9wAs6e9mCxbV65awokyR2/v/KuIHJmqX+mH3wUa4rOQ==",
|
||||
"requires": {
|
||||
"async-validator": "~1.8.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.0",
|
||||
|
@ -17679,9 +17679,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"resize-observer-polyfill": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.0.tgz",
|
||||
"integrity": "sha512-M2AelyJDVR/oLnToJLtuDJRBBWUGUvvGigj1411hXhAdyFWqMaqHp7TixW3FpiLuVaikIcR1QL+zqoJoZlOgpg=="
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
|
||||
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.8.1",
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
"electron-json-storage": "^4.1.5",
|
||||
"electron-log": "^2.2.17",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"element-ui": "^2.4.11",
|
||||
"element-ui": "^2.12.0",
|
||||
"emoji-mart-vue": "^2.6.6",
|
||||
"emojilib": "^2.4.0",
|
||||
"hawk": "^7.0.10",
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -205,6 +205,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -205,6 +205,8 @@
|
|||
"protocol": "プロトコル",
|
||||
"host": "ホスト",
|
||||
"port": "ポート",
|
||||
"username": "ユーザー名",
|
||||
"password": "パスワード",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -86,6 +86,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
|
|
|
@ -70,7 +70,9 @@ const proxy: Proxy = {
|
|||
manualProxyConfig: {
|
||||
protocol: '',
|
||||
host: '',
|
||||
port: ''
|
||||
port: '',
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
<el-form-item for="proxyPort" :label="$t('preferences.network.proxy.port')">
|
||||
<el-input v-model="proxyPort" :disabled="!manualProxyConfiguration" placeholder="8080"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="proxyUsername" :label="$t('preferences.network.proxy.username')">
|
||||
<el-input v-model="proxyUsername" :disabled="!manualProxyConfiguration" placeholder="username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="proxyPassword" :label="$t('preferences.network.proxy.password')">
|
||||
<el-input v-model="proxyPassword" :disabled="!manualProxyConfiguration" placeholder="password" show-password></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSave">{{ $t('preferences.network.save') }}</el-button>
|
||||
</el-form-item>
|
||||
|
@ -72,6 +78,22 @@ export default {
|
|||
set(value) {
|
||||
this.$store.dispatch('Preferences/Network/updatePort', value)
|
||||
}
|
||||
},
|
||||
proxyUsername: {
|
||||
get() {
|
||||
return this.$store.state.Preferences.Network.proxy.username
|
||||
},
|
||||
set(value) {
|
||||
this.$store.dispatch('Preferences/Network/updateUsername', value)
|
||||
}
|
||||
},
|
||||
proxyPassword: {
|
||||
get() {
|
||||
return this.$store.state.Preferences.Network.proxy.password
|
||||
},
|
||||
set(value) {
|
||||
this.$store.dispatch('Preferences/Network/updatePassword', value)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
|
@ -2,15 +2,11 @@ import { ipcRenderer } from 'electron'
|
|||
import { Module, MutationTree, ActionTree, GetterTree } from 'vuex'
|
||||
import { RootState } from '@/store'
|
||||
import { BaseConfig } from '~/src/types/preference'
|
||||
import { Proxy, ProxySource, ProxyProtocol } from '~/src/types/proxy'
|
||||
import { Proxy, ProxySource, ProxyProtocol, ManualProxy } from '~/src/types/proxy'
|
||||
|
||||
export type NetworkState = {
|
||||
source: ProxySource
|
||||
proxy: {
|
||||
protocol: '' | ProxyProtocol
|
||||
host: string
|
||||
port: string
|
||||
}
|
||||
proxy: ManualProxy
|
||||
}
|
||||
|
||||
const state = (): NetworkState => {
|
||||
|
@ -19,7 +15,9 @@ const state = (): NetworkState => {
|
|||
proxy: {
|
||||
protocol: '',
|
||||
host: '',
|
||||
port: ''
|
||||
port: '',
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +27,9 @@ export const MUTATION_TYPES = {
|
|||
CHANGE_SOURCE: 'changeSource',
|
||||
UPDATE_PROTOCOL: 'updateProtocol',
|
||||
UPDATE_HOST: 'updateHost',
|
||||
UPDATE_PORT: 'updatePort'
|
||||
UPDATE_PORT: 'updatePort',
|
||||
UPDATE_USERNAME: 'updateUsername',
|
||||
UPDATE_PASSWORD: 'updatePassword'
|
||||
}
|
||||
|
||||
const mutations: MutationTree<NetworkState> = {
|
||||
|
@ -80,6 +80,12 @@ const mutations: MutationTree<NetworkState> = {
|
|||
},
|
||||
[MUTATION_TYPES.UPDATE_PORT]: (state, port: string) => {
|
||||
state.proxy.port = port
|
||||
},
|
||||
[MUTATION_TYPES.UPDATE_USERNAME]: (state, username: string) => {
|
||||
state.proxy.username = username
|
||||
},
|
||||
[MUTATION_TYPES.UPDATE_PASSWORD]: (state, password: string) => {
|
||||
state.proxy.password = password
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,8 +116,18 @@ const actions: ActionTree<NetworkState, RootState> = {
|
|||
updatePort: ({ commit }, port: string) => {
|
||||
commit(MUTATION_TYPES.UPDATE_PORT, port)
|
||||
},
|
||||
updateUsername: ({ commit }, username: string) => {
|
||||
commit(MUTATION_TYPES.UPDATE_USERNAME, username)
|
||||
},
|
||||
updatePassword: ({ commit }, password: string) => {
|
||||
commit(MUTATION_TYPES.UPDATE_PASSWORD, password)
|
||||
},
|
||||
saveProxyConfig: ({ state }) => {
|
||||
ipcRenderer.send('update-proxy-config', state)
|
||||
const proxy: Proxy = {
|
||||
source: state.source,
|
||||
manualProxyConfig: state.proxy
|
||||
}
|
||||
ipcRenderer.send('update-proxy-config', proxy)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,15 @@ export enum ProxyProtocol {
|
|||
socks5h = 'socks5h'
|
||||
}
|
||||
|
||||
export type ManualProxy = {
|
||||
protocol: '' | ProxyProtocol
|
||||
host: string
|
||||
port: string
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export type Proxy = {
|
||||
source: ProxySource
|
||||
manualProxyConfig: {
|
||||
protocol: '' | ProxyProtocol
|
||||
host: string
|
||||
port: string
|
||||
}
|
||||
manualProxyConfig: ManualProxy
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue