Skip to content

Commit

Permalink
Fix proxy settings test (#4192)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored Oct 20, 2023
1 parent e7e116a commit 046462e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,10 +724,12 @@ function runApp() {
session.defaultSession.setProxy({
proxyRules: url
})
session.defaultSession.closeAllConnections()
})

ipcMain.on(IpcChannels.DISABLE_PROXY, () => {
session.defaultSession.setProxy({})
session.defaultSession.closeAllConnections()
})

ipcMain.on(IpcChannels.OPEN_EXTERNAL_LINK, (_, url) => {
Expand Down
14 changes: 11 additions & 3 deletions src/renderer/components/proxy-settings/proxy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export default defineComponent({
return {
isLoading: false,
dataAvailable: false,
proxyTestUrl: 'https://ipwho.is/',
proxyTestUrl: 'https://ipwho.is/?output=json&fields=ip,country,city,region',
proxyIp: '',
proxyCountry: '',
proxyRegion: '',
proxyCity: '',
Expand All @@ -44,7 +45,8 @@ export default defineComponent({
'https',
'socks4',
'socks5'
]
],
debounceEnableProxy: () => { }
}
},
computed: {
Expand All @@ -64,7 +66,7 @@ export default defineComponent({
return `${this.proxyProtocol}://${this.proxyHostname}:${this.proxyPort}`
}
},
mounted: function () {
created: function () {
this.debounceEnableProxy = debounce(this.enableProxy, 200)
},
beforeDestroy: function () {
Expand Down Expand Up @@ -113,6 +115,12 @@ export default defineComponent({

disableProxy: function () {
ipcRenderer.send(IpcChannels.DISABLE_PROXY)

this.dataAvailable = false
this.proxyIp = ''
this.proxyCountry = ''
this.proxyRegion = ''
this.proxyCity = ''
},

testProxy: function () {
Expand Down

0 comments on commit 046462e

Please sign in to comment.