aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/index.ts b/src/index.ts
index 999d84348..a602c994e 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -245,6 +245,18 @@ const createWindow = () => {
245 openExternalUrl(url); 245 openExternalUrl(url);
246 return { action: 'deny' }; 246 return { action: 'deny' };
247 }); 247 });
248
249 // Handle will download event from main process (prevent download dialog)
250 contents.session.on('will-download', (_e, item) => {
251 const downloadFolderPath = retrieveSettingValue(
252 'downloadFolderPath',
253 DEFAULT_APP_SETTINGS.downloadFolderPath,
254 ) as string;
255
256 if (downloadFolderPath !== '') {
257 item.setSavePath(join(downloadFolderPath, item.getFilename()));
258 }
259 });
248 } 260 }
249 }); 261 });
250 262
@@ -393,7 +405,8 @@ const createWindow = () => {
393 }); 405 });
394 406
395 if (isMac) { 407 if (isMac) {
396 import('./electron/macOSPermissions').then(macOSPermissions => { 408 // Note: Do not remove the extension. See https://github.com/ferdium/ferdium-app/issues/1755 for explanation
409 import('./electron/macOSPermissions.js').then(macOSPermissions => {
397 const { askFormacOSPermissions } = macOSPermissions; 410 const { askFormacOSPermissions } = macOSPermissions;
398 411
399 setTimeout(() => askFormacOSPermissions(mainWindow!), ms('30s')); 412 setTimeout(() => askFormacOSPermissions(mainWindow!), ms('30s'));
@@ -610,6 +623,11 @@ ipcMain.on('feature-basic-auth-cancel', () => {
610 authCallback = noop; 623 authCallback = noop;
611}); 624});
612 625
626ipcMain.on('load-available-displays', (_e, data) => {
627 debug('MAIN PROCESS: Received load-desktop-capturer-sources');
628 mainWindow?.webContents.send(`select-capture-device:${data.serviceId}`, data);
629});
630
613// Handle synchronous messages from service webviews. 631// Handle synchronous messages from service webviews.
614 632
615ipcMain.on('find-in-page', (e, text, options) => { 633ipcMain.on('find-in-page', (e, text, options) => {
@@ -777,3 +795,15 @@ app.on(
777 callback(checkIfCertIsPresent(certificate.data)); 795 callback(checkIfCertIsPresent(certificate.data));
778 }, 796 },
779); 797);
798
799ipcMain.on('relaunch-app', async (_, options) => {
800 // Ask user to confirm
801 const result = await dialog.showMessageBox(mainWindow!, options);
802
803 if (result.response === options.cancelId) {
804 return;
805 }
806
807 app.relaunch();
808 app.quit();
809});