aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/index.js b/src/index.js
index 1b982c77e..4d7215d5e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -10,12 +10,13 @@ import path from 'path';
10import windowStateKeeper from 'electron-window-state'; 10import windowStateKeeper from 'electron-window-state';
11 11
12// Set app directory before loading user modules 12// Set app directory before loading user modules
13if (process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR) {
14 const appDataPath = process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR;
15 app.setPath('appData', appDataPath);
16 app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
17}
13if (isDevMode) { 18if (isDevMode) {
14 app.setPath('userData', path.join(app.getPath('appData'), app.getName() + 'Dev')); 19 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`));
15} else if (process.env.FERDI_USERDATA_DIR != null) {
16 app.setPath('userData', process.env.FERDI_USERDATA_DIR)
17} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
18 app.setPath('userData', path.join(process.env.PORTABLE_EXECUTABLE_DIR, app.getName()));
19} 20}
20 21
21/* eslint-disable import/first */ 22/* eslint-disable import/first */
@@ -143,6 +144,13 @@ const createWindow = () => {
143 } 144 }
144 145
145 // Create the browser window. 146 // Create the browser window.
147 let backgroundColor = '#7367F0';
148 if (settings.get('accentColor') !== '#7367f0') {
149 backgroundColor = settings.get('accentColor');
150 } else if (settings.get('darkMode')) {
151 backgroundColor = '#1E1E1E';
152 }
153
146 mainWindow = new BrowserWindow({ 154 mainWindow = new BrowserWindow({
147 x: posX, 155 x: posX,
148 y: posY, 156 y: posY,
@@ -152,7 +160,7 @@ const createWindow = () => {
152 minHeight: 500, 160 minHeight: 500,
153 titleBarStyle: isMac ? 'hidden' : '', 161 titleBarStyle: isMac ? 'hidden' : '',
154 frame: isLinux, 162 frame: isLinux,
155 backgroundColor: !settings.get('darkMode') ? '#7367F0' : '#1E1E1E', 163 backgroundColor,
156 webPreferences: { 164 webPreferences: {
157 nodeIntegration: true, 165 nodeIntegration: true,
158 webviewTag: true, 166 webviewTag: true,
@@ -335,22 +343,7 @@ app.on('login', (event, webContents, request, authInfo, callback) => {
335 debug('browser login event', authInfo); 343 debug('browser login event', authInfo);
336 event.preventDefault(); 344 event.preventDefault();
337 345
338 if (authInfo.isProxy && authInfo.scheme === 'basic') { 346 if (!authInfo.isProxy && authInfo.scheme === 'basic') {
339 debug('Sending service echo ping');
340 webContents.send('get-service-id');
341
342 ipcMain.once('service-id', (e, id) => {
343 debug('Received service id', id);
344
345 const ps = proxySettings.get(id);
346 if (ps) {
347 debug('Sending proxy auth callback for service', id);
348 callback(ps.user, ps.password);
349 } else {
350 debug('No proxy auth config found for', id);
351 }
352 });
353 } else if (authInfo.scheme === 'basic') {
354 debug('basic auth handler', authInfo); 347 debug('basic auth handler', authInfo);
355 basicAuthHandler(mainWindow, authInfo); 348 basicAuthHandler(mainWindow, authInfo);
356 } 349 }