diff options
Diffstat (limited to 'src/models/Service.js')
-rw-r--r-- | src/models/Service.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/models/Service.js b/src/models/Service.js index 2f2b4572d..5b3ad7bd8 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -1,4 +1,5 @@ | |||
1 | import { autorun, computed, observable } from 'mobx'; | 1 | import { autorun, computed, observable } from 'mobx'; |
2 | import { ipcRenderer } from 'electron'; | ||
2 | import normalizeUrl from 'normalize-url'; | 3 | import normalizeUrl from 'normalize-url'; |
3 | import path from 'path'; | 4 | import path from 'path'; |
4 | 5 | ||
@@ -224,9 +225,23 @@ export default class Service { | |||
224 | return ua; | 225 | return ua; |
225 | } | 226 | } |
226 | 227 | ||
228 | |||
227 | initializeWebViewEvents({ handleIPCMessage, openWindow, stores }) { | 229 | initializeWebViewEvents({ handleIPCMessage, openWindow, stores }) { |
228 | const webContents = this.webview.getWebContents(); | 230 | const webContents = this.webview.getWebContents(); |
229 | 231 | ||
232 | // If the recipe has implemented modifyRequestHeaders, | ||
233 | // Send those headers to ipcMain so that it can be set in session | ||
234 | if (typeof this.recipe.modifyRequestHeaders === 'function') { | ||
235 | const modifiedRequestHeaders = this.recipe.modifyRequestHeaders(); | ||
236 | debug(this.name, 'modifiedRequestHeaders', modifiedRequestHeaders); | ||
237 | ipcRenderer.send('modifyRequestHeaders', { | ||
238 | modifiedRequestHeaders, | ||
239 | serviceId: this.id, | ||
240 | }); | ||
241 | } else { | ||
242 | debug(this.name, 'modifyRequestHeaders is not defined in the recipe'); | ||
243 | } | ||
244 | |||
230 | const handleUserAgent = (url, forwardingHack = false) => { | 245 | const handleUserAgent = (url, forwardingHack = false) => { |
231 | if (url.startsWith('https://accounts.google.com')) { | 246 | if (url.startsWith('https://accounts.google.com')) { |
232 | if (!this.chromelessUserAgent) { | 247 | if (!this.chromelessUserAgent) { |