diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-08 22:57:46 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 22:57:46 +0530 |
commit | cc48de52195366408d9eb93b1d5782ee60ebcc9d (patch) | |
tree | 99049530f9e20096465a15b983a4dc22c698565b /src/models/Service.js | |
parent | chore: proxy feature is always turned on: remove 'enabled' flag (diff) | |
download | ferdium-app-cc48de52195366408d9eb93b1d5782ee60ebcc9d.tar.gz ferdium-app-cc48de52195366408d9eb93b1d5782ee60ebcc9d.tar.zst ferdium-app-cc48de52195366408d9eb93b1d5782ee60ebcc9d.zip |
Ability for service recipe to expose known certificate hosts (#1890)
Diffstat (limited to 'src/models/Service.js')
-rw-r--r-- | src/models/Service.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/models/Service.js b/src/models/Service.js index ee6fe8b6e..4ee054b2b 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -245,7 +245,7 @@ export default class Service { | |||
245 | 245 | ||
246 | this.userAgentModel.setWebviewReference(this.webview); | 246 | this.userAgentModel.setWebviewReference(this.webview); |
247 | 247 | ||
248 | // If the recipe has implemented modifyRequestHeaders, | 248 | // If the recipe has implemented 'modifyRequestHeaders', |
249 | // Send those headers to ipcMain so that it can be set in session | 249 | // Send those headers to ipcMain so that it can be set in session |
250 | if (typeof this.recipe.modifyRequestHeaders === 'function') { | 250 | if (typeof this.recipe.modifyRequestHeaders === 'function') { |
251 | const modifiedRequestHeaders = this.recipe.modifyRequestHeaders(); | 251 | const modifiedRequestHeaders = this.recipe.modifyRequestHeaders(); |
@@ -258,6 +258,18 @@ export default class Service { | |||
258 | debug(this.name, 'modifyRequestHeaders is not defined in the recipe'); | 258 | debug(this.name, 'modifyRequestHeaders is not defined in the recipe'); |
259 | } | 259 | } |
260 | 260 | ||
261 | // if the recipe has implemented 'knownCertificateHosts' | ||
262 | if (typeof this.recipe.knownCertificateHosts === 'function') { | ||
263 | const knownHosts = this.recipe.knownCertificateHosts(); | ||
264 | debug(this.name, 'knownCertificateHosts', knownHosts); | ||
265 | ipcRenderer.send('knownCertificateHosts', { | ||
266 | knownHosts, | ||
267 | serviceId: this.id, | ||
268 | }); | ||
269 | } else { | ||
270 | debug(this.name, 'knownCertificateHosts is not defined in the recipe'); | ||
271 | } | ||
272 | |||
261 | this.webview.addEventListener('ipc-message', async (e) => { | 273 | this.webview.addEventListener('ipc-message', async (e) => { |
262 | if (e.channel === 'inject-js-unsafe') { | 274 | if (e.channel === 'inject-js-unsafe') { |
263 | await Promise.all(e.args.map((script) => this.webview.executeJavaScript(`"use strict"; (() => { ${script} })();`))); | 275 | await Promise.all(e.args.map((script) => this.webview.executeJavaScript(`"use strict"; (() => { ${script} })();`))); |