diff --git a/src/components/Settings/Tabs/BitTorrent.vue b/src/components/Settings/Tabs/BitTorrent.vue index 7e7c81b0..2abfd0d8 100644 --- a/src/components/Settings/Tabs/BitTorrent.vue +++ b/src/components/Settings/Tabs/BitTorrent.vue @@ -153,7 +153,16 @@ - + diff --git a/src/components/Settings/Tabs/Connection.vue b/src/components/Settings/Tabs/Connection.vue index 485d8f2b..aec780d7 100644 --- a/src/components/Settings/Tabs/Connection.vue +++ b/src/components/Settings/Tabs/Connection.vue @@ -97,7 +97,7 @@ - + 0 this.max_uploads_enabled = this.settings.max_uploads > 0 this.max_uploads_per_torrent_enabled = this.settings.max_uploads_per_torrent > 0 + + switch (this.settings.proxy_type) { + case ProxyType.SOCKS4: + this.proxyType = 'socks4' + break + case ProxyType.SOCKS5: + case ProxyType.SOCKS5_PW: + this.proxyType = 'socks5' + break + case ProxyType.HTTP: + case ProxyType.HTTP_PW: + this.proxyType = 'http' + break + default: + this.proxyType = 'none' + } + this.proxyAuth = this.settings.proxy_auth_enabled }, watch: { max_conn_enabled(newValue) { @@ -279,6 +294,12 @@ export default defineComponent({ }, max_uploads_per_torrent_enabled(newValue) { this.settings.max_uploads_per_torrent = newValue ? this.settings.max_uploads_per_torrent : -1 + }, + proxyType() { + this.updateProxyType() + }, + proxyAuth() { + this.updateProxyType() } }, methods: { @@ -287,6 +308,27 @@ export default defineComponent({ const min = 1024 const max = 65535 this.settings.listen_port = Math.floor(Math.random() * (max - min + 1) + min) + }, + updateProxyType() { + switch (this.proxyType) { + case 'socks5': + this.settings.proxy_type = this.proxyAuth ? ProxyType.SOCKS5_PW : ProxyType.SOCKS5 + this.settings.proxy_auth_enabled = this.proxyAuth + break + case 'http': + this.settings.proxy_type = this.proxyAuth ? ProxyType.HTTP_PW : ProxyType.HTTP + this.settings.proxy_auth_enabled = this.proxyAuth + break + case 'socks4': + this.settings.proxy_type = ProxyType.SOCKS4 + this.settings.proxy_auth_enabled = false + break + case 'none': + default: + this.settings.proxy_type = ProxyType.DISABLED + this.settings.proxy_auth_enabled = false + break + } } } }) diff --git a/src/components/Settings/Tabs/WebUI.vue b/src/components/Settings/Tabs/WebUI.vue index 6caf974d..f8dd4e88 100644 --- a/src/components/Settings/Tabs/WebUI.vue +++ b/src/components/Settings/Tabs/WebUI.vue @@ -290,12 +290,7 @@ export default defineComponent({ }, watch: { webUiPassword(newValue: string) { - if (newValue === '') { - this.settings.web_ui_password = undefined - } - else { - this.settings.web_ui_password = newValue - } + this.settings.web_ui_password = newValue === '' ? undefined : newValue } }, methods: { diff --git a/src/enums/qbit/AppPreferences.ts b/src/enums/qbit/AppPreferences.ts index 91da08a6..c209a424 100644 --- a/src/enums/qbit/AppPreferences.ts +++ b/src/enums/qbit/AppPreferences.ts @@ -32,6 +32,8 @@ export enum ProxyType { DISABLED = 0, HTTP = 1, SOCKS5 = 2, + HTTP_PW = 3, + SOCKS5_PW = 4, SOCKS4 = 5 }