From b0e6a5d72550c14ee6a2cb72d01ff0bf8273f4a4 Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Tue, 25 Aug 2020 22:47:15 -0300 Subject: [PATCH] :sparkles: Fix #185 --- main.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 326c30e06..93263e43e 100644 --- a/main.js +++ b/main.js @@ -217,9 +217,24 @@ function createWindow() { } mainWindow = new BrowserWindow(browserWindowConfig) - mainWindow.webContents.session.setUserAgent( - `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${process.versions.chrome} Safari/537.36` + + mainWindow.webContents.session.webRequest.onBeforeSendHeaders( + { + urls: ['https://accounts.google.com/*'], + }, + (details, callback) => { + const newRequestHeaders = Object.assign( + {}, + details.requestHeaders || {}, + { + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0', + } + ) + callback({ requestHeaders: newRequestHeaders }) + } ) + view = new BrowserView({ webPreferences: { nodeIntegration: true,