Skip to content

Commit

Permalink
fix: revert old proxy types (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsluph committed May 24, 2023
1 parent 906ebdf commit f3694e9
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 19 deletions.
11 changes: 10 additions & 1 deletion src/components/Settings/Tabs/BitTorrent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,16 @@
<v-checkbox v-model="settings.max_seeding_time_enabled" hide-details class="ma-0 pa-0" :label="$t('modals.settings.bittorrent.seedLimits.whenSeedingTimeReaches')" />
</v-col>
<v-col>
<v-text-field v-model="settings.max_seeding_time" class="mb-2" outlined dense persistent-hint :hint="$t('modals.settings.bittorrent.seedLimits.whenSeedingTimeReachesHint')" type="number" :disabled="!settings.max_seeding_time_enabled" />
<v-text-field
v-model="settings.max_seeding_time"
class="mb-2"
outlined
dense
persistent-hint
:hint="$t('modals.settings.bittorrent.seedLimits.whenSeedingTimeReachesHint')"
type="number"
:disabled="!settings.max_seeding_time_enabled"
/>
</v-col>
</v-row>
</v-list-item>
Expand Down
66 changes: 54 additions & 12 deletions src/components/Settings/Tabs/Connection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<v-list-item>
<v-row class="mx-1 pb-4">
<v-col cols="5" class="pa-0 pr-2">
<v-select v-model="settings.proxy_type" height="1" outlined dense hide-details :items="proxyTypes" />
<v-select v-model="proxyType" height="1" outlined dense hide-details :items="proxyTypes" />
</v-col>
<v-col cols="4" class="pa-0">
<v-text-field
Expand Down Expand Up @@ -156,7 +156,7 @@
<v-list-item class="mb-5">
<v-checkbox
:disabled="settings.proxy_type === ProxyType.DISABLED || settings.proxy_type === ProxyType.SOCKS4"
v-model="settings.proxy_auth_enabled"
v-model="proxyAuth"
hide-details
class="ma-0 pa-0"
:label="$t('modals.settings.connection.proxy.auth.subtitle')"
Expand Down Expand Up @@ -221,29 +221,24 @@ import { mdiEye, mdiEyeOff } from '@mdi/js'
export default defineComponent({
name: 'Connection',
computed: {
ProxyType() {
return ProxyType
}
},
mixins: [SettingsTab, FullScreenModal],
data() {
return {
proxyTypes: [
{
value: ProxyType.DISABLED,
value: 'none',
text: '(None)'
},
{
value: ProxyType.SOCKS4,
value: 'socks4',
text: 'SOCKS4'
},
{
value: ProxyType.SOCKS5,
value: 'socks5',
text: 'SOCKS5'
},
{
value: ProxyType.HTTP,
value: 'http',
text: 'HTTP'
}
],
Expand All @@ -257,15 +252,35 @@ export default defineComponent({
max_uploads_enabled: false,
max_uploads_per_torrent_enabled: false,
showPassword: false,
proxyType: 'none',
proxyAuth: false,
mdiEye,
mdiEyeOff
mdiEyeOff,
ProxyType
}
},
mounted() {
this.max_conn_enabled = this.settings.max_connec > 0
this.max_conn_per_torrent_enabled = this.settings.max_connec_per_torrent > 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) {
Expand All @@ -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: {
Expand All @@ -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
}
}
}
})
Expand Down
7 changes: 1 addition & 6 deletions src/components/Settings/Tabs/WebUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions src/enums/qbit/AppPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export enum ProxyType {
DISABLED = 0,
HTTP = 1,
SOCKS5 = 2,
HTTP_PW = 3,
SOCKS5_PW = 4,
SOCKS4 = 5
}

Expand Down

0 comments on commit f3694e9

Please sign in to comment.