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