Skip to content

Commit fdd83d0

Browse files
committed
merge: Add in changes for Electron updates
2 parents 10141c6 + a6e646d commit fdd83d0

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

main.js

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// https://github.com/electron/electron/issues/10257
22
// Code fix to support NODE_EXTRA_CA_CERTS env. There is currently no other fixes to the NODE_TLS_REJECT_UNAUTHORIZED at the moment.
33

4-
(function(){
5-
if(!process.env.NODE_EXTRA_CA_CERTS) return;
6-
try{
7-
const extraca = require("fs").readFileSync(process.env.NODE_EXTRA_CA_CERTS);
8-
}catch(e){
9-
return;
10-
}
11-
12-
const NativeSecureContext = process.binding('crypto').SecureContext;
13-
const oldaddRootCerts = NativeSecureContext.prototype.addRootCerts;
14-
NativeSecureContext.prototype.addRootCerts = function(){
15-
const ret = oldaddRootCerts.apply(this, ...args);
16-
this.addCACert(extraca);
17-
return ret;
18-
};
4+
(function () {
5+
if (!process.env.NODE_EXTRA_CA_CERTS) return;
6+
try {
7+
const extraca = require('fs').readFileSync(process.env.NODE_EXTRA_CA_CERTS);
8+
} catch (e) {
9+
return;
10+
}
11+
12+
const NativeSecureContext = process.binding('crypto').SecureContext;
13+
const oldaddRootCerts = NativeSecureContext.prototype.addRootCerts;
14+
NativeSecureContext.prototype.addRootCerts = function () {
15+
const ret = oldaddRootCerts.apply(this, ...args);
16+
this.addCACert(extraca);
17+
return ret;
18+
};
1919
})();
2020

2121
// Allow self-signing HTTPS over TLS
@@ -85,7 +85,6 @@ if (process.argv.includes('--dev')) {
8585
isDev = true;
8686
}
8787

88-
8988
/** ***********************
9089
******* MODE DISPLAY ****
9190
************************ */
@@ -144,7 +143,7 @@ function createWindow() {
144143
});
145144

146145
// Dev mode title
147-
mainWindow.setTitle("Swell (devMode)")
146+
mainWindow.setTitle('Swell (devMode)');
148147

149148
// If we are in developer mode Add React & Redux DevTools to Electron App
150149
installExtension(REACT_DEVELOPER_TOOLS)
@@ -161,7 +160,6 @@ function createWindow() {
161160
pathname: path.join(__dirname, 'dist', 'index.html'),
162161
slashes: true,
163162
});
164-
165163
}
166164

167165
// our new app window will load content depending on the boolean value of the dev variable
@@ -226,10 +224,9 @@ const sendStatusToWindow = (text) => {
226224
};
227225

228226
ipcMain.on('login-via-github', async () => {
229-
const url = `http://github.com/login/oauth/authorize?scope=repo&redirect_uri=http://localhost:3000/signup/github/callback/&client_id=6e9d37a09ab8bda68d50` // ${process.env.GITHUB_CLIENT_ID};
227+
const url = `http://github.com/login/oauth/authorize?scope=repo&redirect_uri=http://localhost:3000/signup/github/callback/&client_id=6e9d37a09ab8bda68d50`; // ${process.env.GITHUB_CLIENT_ID};
230228
await shell.openExternal(url, { activate: true });
231-
232-
})
229+
});
233230

234231
ipcMain.on('check-for-update', () => {
235232
// listens to ipcRenderer in UpdatePopUpContainer.jsx
@@ -324,8 +321,8 @@ ipcMain.on('import-from-github', async (event, args) => {
324321
// requiring typescript type Workspace makes sanitation uncessesary
325322
const ids = {};
326323
let index = 0;
327-
const newCollectionArr = []
328-
for(let collection of args) {
324+
const newCollectionArr = [];
325+
for (let collection of args) {
329326
// console.log('main.js workspace\n', workspace)
330327
if (ids[collection.id]) {
331328
const result = await popOverwrite(collection);
@@ -336,9 +333,8 @@ ipcMain.on('import-from-github', async (event, args) => {
336333
}
337334
ids[collection.id] = index;
338335
index++;
339-
newCollectionArr.push(collection)
340-
341-
};
336+
newCollectionArr.push(collection);
337+
}
342338
// send full array of workspaces to chromium for state update
343339
event.sender.send('add-collections', newCollectionArr);
344340
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"cross-env": "^7.0.3",
218218
"csp-html-webpack-plugin": "^5.1.0",
219219
"css-loader": "^6.7.1",
220-
"electron": "^18.1.0",
220+
"electron": "^18.3.5",
221221
"electron-builder": "^23.0.3",
222222
"electron-react-devtools": "^0.5.3",
223223
"eslint": "^8.14.0",

0 commit comments

Comments
 (0)