From adaeea208236c66abfd7ac311a4855fa060871d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Vay=C3=A1?= Date: Thu, 2 Apr 2020 17:39:29 +0200 Subject: [PATCH] [MM-23057] add different useragent for popup windows (#1247) --- src/main.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 387fb062..72d66c3a 100644 --- a/src/main.js +++ b/src/main.js @@ -86,6 +86,18 @@ const customLoginRegexPaths = [ // tracking in progress custom logins const customLogins = {}; +const nixUA = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome Safari/537.36'; + +const popupUserAgent = { + darwin: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome Safari/537.36', + win32: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome Safari/537.36', + aix: nixUA, + freebsd: nixUA, + linux: nixUA, + openbsd: nixUA, + sunos: nixUA, +}; + /** * Main entry point for the application, ensures that everything initializes in the proper order */ @@ -525,7 +537,12 @@ function handleAppWebContentsCreated(dc, contents) { popupWindow = null; }); } - popupWindow.loadURL(url); + + // currently changing the userAgent for popup windows to allow plugins to go through google's oAuth + // should be removed once a proper oAuth2 implementation is setup. + popupWindow.loadURL(url, { + userAgent: popupUserAgent[process.platform], + }); } });