diff options
author | 2019-10-02 21:38:26 +0200 | |
---|---|---|
committer | 2019-10-02 21:38:26 +0200 | |
commit | e2126a60ad287e76a24c44242b80699e49e8fb0e (patch) | |
tree | e58b8d367ff7f218ba1a3bd2ae59e52e16ac778c /src/models/Service.js | |
parent | Revert "feat(App): Update to electron 6.0.11" (diff) | |
download | ferdium-app-e2126a60ad287e76a24c44242b80699e49e8fb0e.tar.gz ferdium-app-e2126a60ad287e76a24c44242b80699e49e8fb0e.tar.zst ferdium-app-e2126a60ad287e76a24c44242b80699e49e8fb0e.zip |
fix(Service Proxies): Fix proxy setting rehydration
Diffstat (limited to 'src/models/Service.js')
-rw-r--r-- | src/models/Service.js | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/models/Service.js b/src/models/Service.js index 023103048..e45c39564 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -188,19 +188,24 @@ export default class Service { | |||
188 | return userAgent; | 188 | return userAgent; |
189 | } | 189 | } |
190 | 190 | ||
191 | initializeWebViewEvents({ handleIPCMessage, openWindow }) { | 191 | initializeWebViewEvents({ handleIPCMessage, openWindow, stores }) { |
192 | const webContents = this.webview.getWebContents(); | ||
193 | |||
192 | this.webview.addEventListener('ipc-message', e => handleIPCMessage({ | 194 | this.webview.addEventListener('ipc-message', e => handleIPCMessage({ |
193 | serviceId: this.id, | 195 | serviceId: this.id, |
194 | channel: e.channel, | 196 | channel: e.channel, |
195 | args: e.args, | 197 | args: e.args, |
196 | })); | 198 | })); |
197 | 199 | ||
198 | this.webview.addEventListener('new-window', (event, url, frameName, options) => openWindow({ | 200 | this.webview.addEventListener('new-window', (event, url, frameName, options) => { |
199 | event, | 201 | console.log('open window', event, url, frameName, options); |
200 | url, | 202 | openWindow({ |
201 | frameName, | 203 | event, |
202 | options, | 204 | url, |
203 | })); | 205 | frameName, |
206 | options, | ||
207 | }); | ||
208 | }); | ||
204 | 209 | ||
205 | this.webview.addEventListener('did-start-loading', (event) => { | 210 | this.webview.addEventListener('did-start-loading', (event) => { |
206 | debug('Did start load', this.name, event); | 211 | debug('Did start load', this.name, event); |
@@ -234,6 +239,28 @@ export default class Service { | |||
234 | debug('Service crashed', this.name); | 239 | debug('Service crashed', this.name); |
235 | this.hasCrashed = true; | 240 | this.hasCrashed = true; |
236 | }); | 241 | }); |
242 | |||
243 | webContents.on('login', (event, request, authInfo, callback) => { | ||
244 | // const authCallback = callback; | ||
245 | debug('browser login event', authInfo); | ||
246 | event.preventDefault(); | ||
247 | |||
248 | if (authInfo.isProxy && authInfo.scheme === 'basic') { | ||
249 | debug('Sending service echo ping'); | ||
250 | webContents.send('get-service-id'); | ||
251 | |||
252 | debug('Received service id', this.id); | ||
253 | |||
254 | const ps = stores.settings.proxy[this.id]; | ||
255 | |||
256 | if (ps) { | ||
257 | debug('Sending proxy auth callback for service', this.id); | ||
258 | callback(ps.user, ps.password); | ||
259 | } else { | ||
260 | debug('No proxy auth config found for', this.id); | ||
261 | } | ||
262 | } | ||
263 | }); | ||
237 | } | 264 | } |
238 | 265 | ||
239 | initializeWebViewListener() { | 266 | initializeWebViewListener() { |