diff options
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/index.ts b/src/index.ts index cccf0ef66..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')); |
@@ -782,3 +795,15 @@ app.on( | |||
782 | callback(checkIfCertIsPresent(certificate.data)); | 795 | callback(checkIfCertIsPresent(certificate.data)); |
783 | }, | 796 | }, |
784 | ); | 797 | ); |
798 | |||
799 | ipcMain.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 | }); | ||