preventing navigation in the main window

This commit is contained in:
antelle 2020-04-03 18:06:14 +02:00
parent c5298242f6
commit 05b2b395ad
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
2 changed files with 7 additions and 0 deletions

View File

@ -297,6 +297,7 @@ Events.on('launcher-exit-request', () => {
Events.on('launcher-minimize', () => setTimeout(() => Events.emit('app-minimized'), 0));
Events.on('launcher-started-minimized', () => setTimeout(() => Launcher.minimizeApp(), 0));
Events.on('start-profile', data => StartProfiler.reportAppProfile(data));
Events.on('log', e => new Logger(e.category || 'remote-app')[e.method || 'info'](e.message));
window.launcherOpen = file => Launcher.openFile(file);
if (window.launcherOpenedFile) {

View File

@ -236,6 +236,12 @@ function createMainWindow() {
mainWindow.on('session-end', () => {
emitRemoteEvent('os-lock');
});
mainWindow.webContents.on('will-navigate', (e, url) => {
if (!url.startsWith('https://beta.keeweb.info/')) {
emitRemoteEvent('log', { message: `Prevented navigation: ${url}` });
e.preventDefault();
}
});
perfTimestamps &&
perfTimestamps.push({ name: 'configuring main window', ts: process.hrtime() });