mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-25 18:30:18 -06:00
SDA-3577 - Remove isNodeEnv usage (#1341)
This commit is contained in:
parent
f01312cea7
commit
2c3a7c21d5
@ -1,7 +1,7 @@
|
||||
import { app, crashReporter } from 'electron';
|
||||
import * as path from 'path';
|
||||
|
||||
import { isDevEnv, isNodeEnv } from '../common/env';
|
||||
import { isDevEnv } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import { getCommandLineArgs } from '../common/utils';
|
||||
import { appStats } from './stats';
|
||||
@ -18,10 +18,8 @@ const userDataPath =
|
||||
|
||||
// If we are running in production, sandbox the entire app
|
||||
// and set the app user model id for windows native notifications
|
||||
if (!isNodeEnv) {
|
||||
app.enableSandbox();
|
||||
app.setAppUserModelId('symphony_exe');
|
||||
}
|
||||
app.enableSandbox();
|
||||
app.setAppUserModelId('symphony_exe');
|
||||
|
||||
// need to set this explicitly if using Squirrel
|
||||
// https://www.electron.build/configuration/configuration#Configuration-squirrelWindows
|
||||
|
@ -20,13 +20,7 @@ import * as path from 'path';
|
||||
import { format, parse } from 'url';
|
||||
|
||||
import { apiName, Themes, WindowTypes } from '../common/api-interface';
|
||||
import {
|
||||
isDevEnv,
|
||||
isLinux,
|
||||
isMac,
|
||||
isNodeEnv,
|
||||
isWindowsOS,
|
||||
} from '../common/env';
|
||||
import { isDevEnv, isLinux, isMac, isWindowsOS } from '../common/env';
|
||||
import { i18n, LocaleType } from '../common/i18n';
|
||||
import { logger } from '../common/logger';
|
||||
import {
|
||||
@ -112,6 +106,8 @@ export const DEFAULT_HEIGHT: number = 900;
|
||||
export const DEFAULT_WELCOME_SCREEN_WIDTH: number = 542;
|
||||
export const DEFAULT_WELCOME_SCREEN_HEIGHT: number = 333;
|
||||
export const TITLE_BAR_HEIGHT: number = 32;
|
||||
export const IS_SAND_BOXED: boolean = true;
|
||||
export const IS_NODE_INTEGRATION_ENABLED: boolean = false;
|
||||
|
||||
// Timeout on restarting SDA in case it's stuck
|
||||
const LISTEN_TIMEOUT: number = 25 * 1000;
|
||||
@ -263,7 +259,6 @@ export class WindowHandler {
|
||||
|
||||
logger.info(`window handler: env details`, {
|
||||
contextIsolation: this.contextIsolation,
|
||||
isNodeEnv,
|
||||
isDevEnv,
|
||||
isMac,
|
||||
isWindowsOS,
|
||||
@ -736,8 +731,8 @@ export class WindowHandler {
|
||||
) {
|
||||
const titleBarView = new BrowserView({
|
||||
webPreferences: {
|
||||
sandbox: !isNodeEnv,
|
||||
nodeIntegration: isNodeEnv,
|
||||
sandbox: IS_SAND_BOXED,
|
||||
nodeIntegration: IS_NODE_INTEGRATION_ENABLED,
|
||||
preload: path.join(__dirname, '../renderer/_preload-component.js'),
|
||||
devTools: isDevEnv,
|
||||
},
|
||||
@ -2189,9 +2184,9 @@ export class WindowHandler {
|
||||
): ICustomBrowserWindowConstructorOpts {
|
||||
const defaultPreferencesOpts = {
|
||||
...{
|
||||
sandbox: !isNodeEnv,
|
||||
nodeIntegration: isNodeEnv,
|
||||
contextIsolation: isNodeEnv ? false : this.contextIsolation,
|
||||
sandbox: IS_SAND_BOXED,
|
||||
nodeIntegration: IS_NODE_INTEGRATION_ENABLED,
|
||||
contextIsolation: this.contextIsolation,
|
||||
backgroundThrottling: this.backgroundThrottling,
|
||||
enableRemoteModule: true,
|
||||
},
|
||||
|
@ -16,13 +16,7 @@ import * as path from 'path';
|
||||
import { format, parse } from 'url';
|
||||
import { apiName } from '../common/api-interface';
|
||||
|
||||
import {
|
||||
isDevEnv,
|
||||
isLinux,
|
||||
isMac,
|
||||
isNodeEnv,
|
||||
isWindowsOS,
|
||||
} from '../common/env';
|
||||
import { isDevEnv, isLinux, isMac, isWindowsOS } from '../common/env';
|
||||
import { i18n, LocaleType } from '../common/i18n';
|
||||
import { logger } from '../common/logger';
|
||||
import { getGuid } from '../common/utils';
|
||||
@ -43,6 +37,8 @@ import {
|
||||
DEFAULT_WIDTH,
|
||||
ICustomBrowserView,
|
||||
ICustomBrowserWindow,
|
||||
IS_NODE_INTEGRATION_ENABLED,
|
||||
IS_SAND_BOXED,
|
||||
TITLE_BAR_HEIGHT,
|
||||
windowHandler,
|
||||
} from './window-handler';
|
||||
@ -187,8 +183,8 @@ export const createComponentWindow = (
|
||||
width: 300,
|
||||
...opts,
|
||||
webPreferences: {
|
||||
sandbox: !isNodeEnv,
|
||||
nodeIntegration: isNodeEnv,
|
||||
sandbox: IS_SAND_BOXED,
|
||||
nodeIntegration: IS_NODE_INTEGRATION_ENABLED,
|
||||
preload: path.join(__dirname, '../renderer/_preload-component.js'),
|
||||
devTools: isDevEnv,
|
||||
},
|
||||
@ -1046,8 +1042,8 @@ export const loadBrowserViews = async (
|
||||
|
||||
const titleBarView = new BrowserView({
|
||||
webPreferences: {
|
||||
sandbox: !isNodeEnv,
|
||||
nodeIntegration: isNodeEnv,
|
||||
sandbox: IS_SAND_BOXED,
|
||||
nodeIntegration: IS_NODE_INTEGRATION_ENABLED,
|
||||
preload: path.join(__dirname, '../renderer/_preload-component.js'),
|
||||
devTools: isDevEnv,
|
||||
},
|
||||
|
@ -6,5 +6,3 @@ export const isElectronQA = !!process.env.ELECTRON_QA;
|
||||
export const isMac = process.platform === 'darwin';
|
||||
export const isWindowsOS = process.platform === 'win32';
|
||||
export const isLinux = process.platform === 'linux';
|
||||
|
||||
export const isNodeEnv = !!process.env.NODE_ENV;
|
||||
|
@ -6,6 +6,10 @@ import {
|
||||
ToastNotificationActionTypes,
|
||||
} from '../app/analytics-handler';
|
||||
import { config } from '../app/config-handler';
|
||||
import {
|
||||
IS_NODE_INTEGRATION_ENABLED,
|
||||
IS_SAND_BOXED,
|
||||
} from '../app/window-handler';
|
||||
import { createComponentWindow, windowExists } from '../app/window-utils';
|
||||
import { AnimationQueue } from '../common/animation-queue';
|
||||
import {
|
||||
@ -14,7 +18,6 @@ import {
|
||||
NOTIFICATION_WINDOW_TITLE,
|
||||
NotificationActions,
|
||||
} from '../common/api-interface';
|
||||
import { isNodeEnv } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import NotificationHandler from './notification-handler';
|
||||
|
||||
@ -618,8 +621,8 @@ class Notification extends NotificationHandler {
|
||||
acceptFirstMouse: true,
|
||||
title: NOTIFICATION_WINDOW_TITLE,
|
||||
webPreferences: {
|
||||
sandbox: !isNodeEnv,
|
||||
nodeIntegration: isNodeEnv,
|
||||
sandbox: IS_SAND_BOXED,
|
||||
nodeIntegration: IS_NODE_INTEGRATION_ENABLED,
|
||||
devTools: true,
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user