From b9e5b2338fa44c48995c9f94cb057f5e0e622f1f Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Tue, 11 Jun 2019 15:55:04 +0200 Subject: fix(Proxy): Fix issue with proxy authentication --- src/index.js | 10 +++++++++- src/models/Service.js | 1 + src/webview/recipe.js | 3 +-- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/index.js b/src/index.js index 49cf07618..55592c328 100644 --- a/src/index.js +++ b/src/index.js @@ -354,18 +354,26 @@ app.on('ready', () => { // TODO: rewrite to handle multiple login calls const noop = () => null; let authCallback = noop; + app.on('login', (event, webContents, request, authInfo, callback) => { authCallback = callback; debug('browser login event', authInfo); event.preventDefault(); + if (authInfo.isProxy && authInfo.scheme === 'basic') { + debug('Sending service echo ping'); webContents.send('get-service-id'); ipcMain.once('service-id', (e, id) => { debug('Received service id', id); const ps = proxySettings.get(id); - callback(ps.user, ps.password); + if (ps) { + debug('Sending proxy auth callback for service', id); + callback(ps.user, ps.password); + } else { + debug('No proxy auth config found for', id); + } }); } else if (authInfo.scheme === 'basic') { debug('basic auth handler', authInfo); diff --git a/src/models/Service.js b/src/models/Service.js index a118c093e..88bce3360 100644 --- a/src/models/Service.js +++ b/src/models/Service.js @@ -116,6 +116,7 @@ export default class Service { @computed get shareWithWebview() { return { + id: this.id, spellcheckerLanguage: this.spellcheckerLanguage, isDarkModeEnabled: this.isDarkModeEnabled, }; diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 1e5d74b1f..c223b73de 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -127,6 +127,7 @@ class RecipeController { } serviceIdEcho(event) { + debug('Received a service echo ping'); event.sender.send('service-id', this.settings.service.id); } @@ -137,8 +138,6 @@ class RecipeController { window.addEventListener('keyup', debounce((e) => { const element = e.target; - console.log(element); - if (!element) return; let value = ''; -- cgit v1.2.3-70-g09d2