From fcc340a869a9b5c1c77438eae5e5e8ffe263a4f4 Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Sat, 16 May 2020 12:47:21 +0700 Subject: [PATCH] Fix switching account in Google apps opens pop up window (#260) --- public/libs/views.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/libs/views.js b/public/libs/views.js index 5780cfc1..438fa98e 100644 --- a/public/libs/views.js +++ b/public/libs/views.js @@ -425,8 +425,17 @@ const addView = (browserWindow, workspace) => { // load in same window if ( - // Google: Switch account + // Google: Add account nextDomain === 'accounts.google.com' + // Google: Switch account + || ( + isInternalUrl(nextUrl, [appUrl, currentUrl]) + && nextDomain.indexOf('google.com') > 0 + && ( + (nextUrl.indexOf('authuser=')) // https://drive.google.com/drive/u/1/priority?authuser=2 (has authuser query) + || (/\/u\/[0-9]+\/{0,1}$/.test(nextUrl)) // https://mail.google.com/mail/u/1/ (ends with /u/1/) + ) + ) // https://github.com/atomery/webcatalog/issues/315 || ((appDomain.includes('asana.com') || currentDomain.includes('asana.com')) && nextDomain.includes('asana.com')) ) {