diff options
author | 2023-05-24 06:57:50 +0530 | |
---|---|---|
committer | 2023-05-24 16:40:43 +0530 | |
commit | e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b (patch) | |
tree | d684777b3fde5470c9f99304a9f022422ffb8045 /src/electron/ipc-api | |
parent | 6.3.0-nightly.9 [skip ci] (diff) | |
download | ferdium-app-e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b.tar.gz ferdium-app-e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b.tar.zst ferdium-app-e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b.zip |
Upgrade npm modules
Diffstat (limited to 'src/electron/ipc-api')
-rw-r--r-- | src/electron/ipc-api/autoUpdate.ts | 8 | ||||
-rw-r--r-- | src/electron/ipc-api/download.ts | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/electron/ipc-api/autoUpdate.ts b/src/electron/ipc-api/autoUpdate.ts index bf3e79c85..14214aacb 100644 --- a/src/electron/ipc-api/autoUpdate.ts +++ b/src/electron/ipc-api/autoUpdate.ts | |||
@@ -7,10 +7,7 @@ const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:autoUpdate'); | |||
7 | export default (params: { mainWindow: BrowserWindow; settings: any }) => { | 7 | export default (params: { mainWindow: BrowserWindow; settings: any }) => { |
8 | const enableUpdate = Boolean(params.settings.app.get('automaticUpdates')); | 8 | const enableUpdate = Boolean(params.settings.app.get('automaticUpdates')); |
9 | 9 | ||
10 | if (!enableUpdate) { | 10 | if (enableUpdate) { |
11 | autoUpdater.autoInstallOnAppQuit = false; | ||
12 | autoUpdater.autoDownload = false; | ||
13 | } else { | ||
14 | ipcMain.on('autoUpdate', (event, args) => { | 11 | ipcMain.on('autoUpdate', (event, args) => { |
15 | if (enableUpdate) { | 12 | if (enableUpdate) { |
16 | try { | 13 | try { |
@@ -71,5 +68,8 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
71 | debug('update-error'); | 68 | debug('update-error'); |
72 | params.mainWindow.webContents.send('autoUpdate', { error }); | 69 | params.mainWindow.webContents.send('autoUpdate', { error }); |
73 | }); | 70 | }); |
71 | } else { | ||
72 | autoUpdater.autoInstallOnAppQuit = false; | ||
73 | autoUpdater.autoDownload = false; | ||
74 | } | 74 | } |
75 | }; | 75 | }; |
diff --git a/src/electron/ipc-api/download.ts b/src/electron/ipc-api/download.ts index 21af0d045..518a7091c 100644 --- a/src/electron/ipc-api/download.ts +++ b/src/electron/ipc-api/download.ts | |||
@@ -23,12 +23,7 @@ export default (params: { mainWindow: BrowserWindow }) => { | |||
23 | const win = BrowserWindow.getFocusedWindow(); | 23 | const win = BrowserWindow.getFocusedWindow(); |
24 | 24 | ||
25 | try { | 25 | try { |
26 | if (!content) { | 26 | if (content) { |
27 | const dl = await download(win!, url, { | ||
28 | saveAs: true, | ||
29 | }); | ||
30 | debug('File saved to', dl.savePath); | ||
31 | } else { | ||
32 | const extension = mime.extension(fileOptions.mime); | 27 | const extension = mime.extension(fileOptions.mime); |
33 | const filename = `${fileOptions.name}.${extension}`; | 28 | const filename = `${fileOptions.name}.${extension}`; |
34 | 29 | ||
@@ -50,6 +45,11 @@ export default (params: { mainWindow: BrowserWindow }) => { | |||
50 | } catch (error) { | 45 | } catch (error) { |
51 | console.error(error); | 46 | console.error(error); |
52 | } | 47 | } |
48 | } else { | ||
49 | const dl = await download(win!, url, { | ||
50 | saveAs: true, | ||
51 | }); | ||
52 | debug('File saved to', dl.savePath); | ||
53 | } | 53 | } |
54 | } catch (error) { | 54 | } catch (error) { |
55 | console.error(error); | 55 | console.error(error); |