aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorChristoph Settgast <csett86@web.de>2022-10-14 08:38:08 +0200
committerGitHub <noreply@github.com>2022-10-14 08:38:08 +0200
commit15092d799f4c71a2ba26b73530a39e5fdc148bfa (patch)
tree26a517ca19f0e0ab27527270b18d39f118625752 /main.js
parentf7022501e2f92cb3f48924f556d0cb5218ac51d8 (diff)
feat: support Jitsi instances that set x-frame-options and frame-ancestors CSP (#798)
While in browser environments the headers are sensible, the only purpose of the electron app is load jitsi in the iframe api. This also is how the mobile apps behave (they also ignore the framing headers) Fixes: #285
Diffstat (limited to 'main.js')
-rw-r--r--main.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.js b/main.js
index 29440ad..f97350b 100644
--- a/main.js
+++ b/main.js
@@ -228,6 +228,25 @@ function createJitsiMeetWindow() {
mainWindow.webContents.setWindowOpenHandler(windowOpenHandler);
+ // Filter out x-frame-options and frame-ancestors CSP to allow loading jitsi via the iframe API
+ // Resolves https://github.com/jitsi/jitsi-meet-electron/issues/285
+ mainWindow.webContents.session.webRequest.onHeadersReceived((details, callback) => {
+ delete details.responseHeaders['x-frame-options'];
+
+ if (details.responseHeaders['content-security-policy']) {
+ const cspFiltered = details.responseHeaders['content-security-policy'][0]
+ .split(';')
+ .filter(x => x.indexOf('frame-ancestors') === -1)
+ .join(';');
+
+ details.responseHeaders['content-security-policy'] = [ cspFiltered ];
+ }
+
+ callback({
+ responseHeaders: details.responseHeaders
+ });
+ });
+
initPopupsConfigurationMain(mainWindow);
setupAlwaysOnTopMain(mainWindow, null, windowOpenHandler);
setupPowerMonitorMain(mainWindow);