Skip to content

Commit

Permalink
added nodeIntegration: true to the bowser instances
Browse files Browse the repository at this point in the history
other electron optimizations
  • Loading branch information
ganeshrvel committed Jan 7, 2019
1 parent 46364b9 commit 30ee3e6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
5 changes: 4 additions & 1 deletion app/classes/AppUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const createChildWindow = () => {
minimizable: false,
maximizable: false,
fullscreenable: false,
movable: false
movable: false,
webPreferences: {
nodeIntegration: true
}
});
} catch (e) {
log.error(e, `AppUpdate -> createChildWindow`);
Expand Down
5 changes: 4 additions & 1 deletion app/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ if (!isDeviceBootable) {
show: false,
minWidth: 854,
minHeight: 640,
titleBarStyle: 'hidden'
titleBarStyle: 'hidden',
webPreferences: {
nodeIntegration: true
}
});

mainWindow.loadURL(`${PATHS.loadUrlPath}`);
Expand Down
17 changes: 13 additions & 4 deletions app/utils/createWindows.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const nonBootableDeviceCreateWindow = () => {
minimizable: false,
width: 480,
height: 320,
resizable: false
resizable: false,
webPreferences: {
nodeIntegration: true
}
});
};

Expand Down Expand Up @@ -64,7 +67,10 @@ const reportBugsCreateWindow = () => {
resizable: false,
title: `${APP_TITLE}`,
minimizable: false,
fullscreenable: false
fullscreenable: false,
webPreferences: {
nodeIntegration: true
}
});
};

Expand Down Expand Up @@ -99,7 +105,7 @@ export const reportBugsWindow = () => {
};

/**
* Privacy POlicy Window
* Privacy Policy Window
*/

const privacyPolicyCreateWindow = isRenderedPage => {
Expand All @@ -112,7 +118,10 @@ const privacyPolicyCreateWindow = isRenderedPage => {
resizable: true,
title: `${APP_TITLE}`,
minimizable: true,
fullscreenable: true
fullscreenable: true,
webPreferences: {
nodeIntegration: true
}
};
if (isRenderedPage) {
return new remote.BrowserWindow(config);
Expand Down
11 changes: 8 additions & 3 deletions app/utils/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { homedir as homedirOs } from 'os';
import { IS_DEV, IS_PROD } from '../constants/env';
import { yearMonthNow } from './date';
import { APP_IDENTIFIER, APP_NAME } from '../constants/meta';
import url from 'url';

const root = process.cwd();
const appPath = join(root, `./app`);
Expand Down Expand Up @@ -38,9 +39,13 @@ export const PATHS = {
logFile: resolve(logFile),
settingsFile: resolve(settingsFile),
appUpdateFile: resolve(appUpdateFile),
loadUrlPath: !isPackaged
? `file://${appPath}/app.html`
: `file://${__dirname}/app.html`
loadUrlPath: url.format({
protocol: 'file',
slashes: true,
pathname: !isPackaged
? join(appPath, './app.html')
: join(__dirname, './app.html')
})
};

export const pathUp = filePath => {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openmtp",
"productName": "OpenMTP",
"version": "1.0.5",
"version": "1.0.10",
"description": "OpenMTP | Android File Transfer for macOS",
"scripts": {
"build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",
Expand All @@ -22,7 +22,6 @@
"publish-mac": "yarn build && build --mac --publish always"
},
"browserslist": "electron 4.0",
"main": "./app/main.prod.js",
"build": {
"productName": "OpenMTP",
"appId": "io.ganeshrvel.openmtp",
Expand Down
1 change: 1 addition & 0 deletions webpack/config.main.prod.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default merge.smart(baseConfig, {
new CleanWebpackPlugin([`${PATHS.dist}/*`], {
root: PATHS.root
}),

new BundleAnalyzerPlugin({
analyzerMode:
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
Expand Down

0 comments on commit 30ee3e6

Please sign in to comment.