Context isolation for About, ScreenShare, Preferences

This commit is contained in:
Josh Perez 2021-09-16 11:52:56 -04:00 committed by GitHub
parent 59ca63cd2e
commit 43685d15c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 234 additions and 321 deletions

22
main.js
View file

@ -824,8 +824,14 @@ function showScreenShareWindow(sourceName) {
...defaultWebPrefs,
nodeIntegration: false,
nodeIntegrationInWorker: false,
contextIsolation: false,
preload: path.join(__dirname, 'screenShare_preload.js'),
contextIsolation: true,
preload: path.join(
__dirname,
'ts',
'windows',
'screenShare',
'preload.js'
),
},
x: Math.floor(display.size.width / 2) - width / 2,
y: 24,
@ -847,6 +853,9 @@ function showScreenShareWindow(sourceName) {
'render-screen-sharing-controller',
sourceName
);
if (config.get('openDevTools')) {
screenShareWindow.webContents.openDevTools();
}
});
}
@ -869,8 +878,8 @@ function showAbout() {
...defaultWebPrefs,
nodeIntegration: false,
nodeIntegrationInWorker: false,
contextIsolation: false,
preload: path.join(__dirname, 'about_preload.js'),
contextIsolation: true,
preload: path.join(__dirname, 'ts', 'windows', 'about', 'preload.js'),
nativeWindowOpen: true,
},
};
@ -887,6 +896,9 @@ function showAbout() {
aboutWindow.once('ready-to-show', () => {
aboutWindow.show();
if (config.get('openDevTools')) {
aboutWindow.webContents.openDevTools();
}
});
}
@ -911,7 +923,7 @@ function showSettingsWindow() {
...defaultWebPrefs,
nodeIntegration: false,
nodeIntegrationInWorker: false,
contextIsolation: false,
contextIsolation: true,
enableRemoteModule: true,
preload: path.join(__dirname, 'ts', 'windows', 'settings', 'preload.js'),
nativeWindowOpen: true,