aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar stnkl <stnkl@users.noreply.github.com>2021-06-03 00:05:30 +0200
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-06-03 07:00:12 +0530
commit4cacab45ba849aed44a46cc797d6599ce530739b (patch)
tree4f2688803b65bef1680248e4ef4ef0a01ee49e6f
parentAllow nightlies as pre-releases (possible fix for broken updater in nightlies). (diff)
downloadferdi-4cacab45ba849aed44a46cc797d6599ce530739b.tar.gz
ferdi-4cacab45ba849aed44a46cc797d6599ce530739b.tar.zst
ferdi-4cacab45ba849aed44a46cc797d6599ce530739b.zip
Adjust link opening behavior
-rw-r--r--src/index.js14
-rw-r--r--src/models/Service.js14
2 files changed, 12 insertions, 16 deletions
diff --git a/src/index.js b/src/index.js
index 018bdc05..21cf61c0 100644
--- a/src/index.js
+++ b/src/index.js
@@ -438,14 +438,12 @@ ipcMain.on('feature-basic-auth-credentials', (e, { user, password }) => {
438 authCallback = noop; 438 authCallback = noop;
439}); 439});
440 440
441ipcMain.on('open-browser-window', (e, { disposition, url, serviceId }) => { 441ipcMain.on('open-browser-window', (e, { url, serviceId }) => {
442 if (disposition === 'foreground-tab') { 442 const serviceSession = session.fromPartition(`persist:service-${serviceId}`);
443 const serviceSession = session.fromPartition(`persist:service-${serviceId}`); 443 const child = new BrowserWindow({ parent: mainWindow, webPreferences: { session: serviceSession } });
444 const child = new BrowserWindow({ parent: mainWindow, webPreferences: { session: serviceSession } }); 444 child.show();
445 child.show(); 445 child.loadURL(url);
446 child.loadURL(url); 446 debug('Received open-browser-window', url);
447 }
448 debug('Received open-browser-window', disposition, url);
449}); 447});
450 448
451ipcMain.on('modifyRequestHeaders', (e, { modifiedRequestHeaders, serviceId }) => { 449ipcMain.on('modifyRequestHeaders', (e, { modifiedRequestHeaders, serviceId }) => {
diff --git a/src/models/Service.js b/src/models/Service.js
index e7efbe30..b01881be 100644
--- a/src/models/Service.js
+++ b/src/models/Service.js
@@ -291,23 +291,21 @@ export default class Service {
291 if (!isValidExternalURL(event.url)) { 291 if (!isValidExternalURL(event.url)) {
292 return; 292 return;
293 } 293 }
294 if (event.disposition === 'foreground-tab') { 294 if (event.disposition === 'foreground-tab' || event.disposition === 'background-tab') {
295 ipcRenderer.send('open-browser-window', {
296 disposition: event.disposition,
297 url: event.url,
298 serviceId: this.id,
299 });
300 } else {
301 openWindow({ 295 openWindow({
302 event, 296 event,
303 url, 297 url,
304 frameName, 298 frameName,
305 options, 299 options,
306 }); 300 });
301 } else {
302 ipcRenderer.send('open-browser-window', {
303 url: event.url,
304 serviceId: this.id,
305 });
307 } 306 }
308 }); 307 });
309 308
310
311 this.webview.addEventListener('will-navigate', event => handleUserAgent(event.url, true)); 309 this.webview.addEventListener('will-navigate', event => handleUserAgent(event.url, true));
312 310
313 this.webview.addEventListener('did-start-loading', (event) => { 311 this.webview.addEventListener('did-start-loading', (event) => {