diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-05-26 21:05:50 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 21:05:50 +0530 |
commit | 296ce5ce62bcde6888df291f97105fa912ed7d35 (patch) | |
tree | b28e7d2373f1020c1183469aa3a9feafecede569 /src/index.js | |
parent | Added new entry in context menu: 'Download image' (#1449) (diff) | |
download | ferdium-app-296ce5ce62bcde6888df291f97105fa912ed7d35.tar.gz ferdium-app-296ce5ce62bcde6888df291f97105fa912ed7d35.tar.zst ferdium-app-296ce5ce62bcde6888df291f97105fa912ed7d35.zip |
Replace 'remote' with 'electron/remote' (#1448)
* Locked new version of 'recipes' submodule with corresponding changes.
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/index.js b/src/index.js index 396d2e649..ab4187e68 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -1,3 +1,5 @@ | |||
1 | /* eslint-disable import/first */ | ||
2 | |||
1 | import { | 3 | import { |
2 | app, | 4 | app, |
3 | BrowserWindow, | 5 | BrowserWindow, |
@@ -5,13 +7,26 @@ import { | |||
5 | ipcMain, | 7 | ipcMain, |
6 | session, | 8 | session, |
7 | } from 'electron'; | 9 | } from 'electron'; |
8 | import isDevMode from 'electron-is-dev'; | 10 | |
9 | import fs from 'fs-extra'; | 11 | import fs from 'fs-extra'; |
10 | import path from 'path'; | 12 | import path from 'path'; |
11 | import windowStateKeeper from 'electron-window-state'; | 13 | import windowStateKeeper from 'electron-window-state'; |
12 | import { enforceMacOSAppLocation } from 'electron-util'; | 14 | import { enforceMacOSAppLocation } from 'electron-util'; |
13 | import ms from 'ms'; | 15 | import ms from 'ms'; |
14 | 16 | ||
17 | require('@electron/remote/main').initialize(); | ||
18 | |||
19 | import { | ||
20 | DEFAULT_APP_SETTINGS, | ||
21 | DEFAULT_WINDOW_OPTIONS, | ||
22 | } from './config'; | ||
23 | |||
24 | import { | ||
25 | isMac, | ||
26 | isWindows, | ||
27 | isLinux, | ||
28 | } from './environment'; | ||
29 | |||
15 | // TODO: This seems to be duplicated between here and 'config.js' | 30 | // TODO: This seems to be duplicated between here and 'config.js' |
16 | // Set app directory before loading user modules | 31 | // Set app directory before loading user modules |
17 | if (process.env.FERDI_APPDATA_DIR != null) { | 32 | if (process.env.FERDI_APPDATA_DIR != null) { |
@@ -25,16 +40,11 @@ if (process.env.FERDI_APPDATA_DIR != null) { | |||
25 | app.setPath('userData', path.join(app.getPath('appData'), app.name)); | 40 | app.setPath('userData', path.join(app.getPath('appData'), app.name)); |
26 | } | 41 | } |
27 | 42 | ||
43 | const isDevMode = !app.isPackaged; | ||
28 | if (isDevMode) { | 44 | if (isDevMode) { |
29 | app.setPath('userData', path.join(app.getPath('appData'), `${app.name}Dev`)); | 45 | app.setPath('userData', path.join(app.getPath('appData'), `${app.name}Dev`)); |
30 | } | 46 | } |
31 | 47 | ||
32 | /* eslint-disable import/first */ | ||
33 | import { | ||
34 | isMac, | ||
35 | isWindows, | ||
36 | isLinux, | ||
37 | } from './environment'; | ||
38 | import { mainIpcHandler as basicAuthHandler } from './features/basicAuth'; | 48 | import { mainIpcHandler as basicAuthHandler } from './features/basicAuth'; |
39 | import ipcApi from './electron/ipc-api'; | 49 | import ipcApi from './electron/ipc-api'; |
40 | import Tray from './lib/Tray'; | 50 | import Tray from './lib/Tray'; |
@@ -42,15 +52,10 @@ import DBus from './lib/DBus'; | |||
42 | import Settings from './electron/Settings'; | 52 | import Settings from './electron/Settings'; |
43 | import handleDeepLink from './electron/deepLinking'; | 53 | import handleDeepLink from './electron/deepLinking'; |
44 | import { isPositionValid } from './electron/windowUtils'; | 54 | import { isPositionValid } from './electron/windowUtils'; |
45 | import askFormacOSPermissions from './electron/macOSPermissions'; | ||
46 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved | 55 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved |
47 | import * as buildInfo from './buildInfo.json'; // eslint-disable-line import/no-unresolved | 56 | import * as buildInfo from './buildInfo.json'; // eslint-disable-line import/no-unresolved |
48 | import './electron/exception'; | 57 | import './electron/exception'; |
49 | 58 | ||
50 | import { | ||
51 | DEFAULT_APP_SETTINGS, | ||
52 | DEFAULT_WINDOW_OPTIONS, | ||
53 | } from './config'; | ||
54 | import { asarPath } from './helpers/asar-helpers'; | 59 | import { asarPath } from './helpers/asar-helpers'; |
55 | import { isValidExternalURL } from './helpers/url-helpers'; | 60 | import { isValidExternalURL } from './helpers/url-helpers'; |
56 | import userAgent, { ferdiVersion } from './helpers/userAgent-helpers'; | 61 | import userAgent, { ferdiVersion } from './helpers/userAgent-helpers'; |
@@ -329,6 +334,8 @@ const createWindow = () => { | |||
329 | }); | 334 | }); |
330 | 335 | ||
331 | if (isMac) { | 336 | if (isMac) { |
337 | // eslint-disable-next-line global-require | ||
338 | const askFormacOSPermissions = require('./electron/macOSPermissions'); | ||
332 | setTimeout(() => askFormacOSPermissions(mainWindow), ms('30s')); | 339 | setTimeout(() => askFormacOSPermissions(mainWindow), ms('30s')); |
333 | } | 340 | } |
334 | 341 | ||