diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-10-03 15:37:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-03 15:37:01 +0200 |
commit | a9bce3812a5d1a2cd562f9a39cda56b1584bf81a (patch) | |
tree | 3f5a35798a91d0a72e2e0034ab637d0ce59e22e2 | |
parent | check if recipe exists (diff) | |
parent | Merge branch 'release/5.4.0' into fix/skype-links (diff) | |
download | ferdium-app-a9bce3812a5d1a2cd562f9a39cda56b1584bf81a.tar.gz ferdium-app-a9bce3812a5d1a2cd562f9a39cda56b1584bf81a.tar.zst ferdium-app-a9bce3812a5d1a2cd562f9a39cda56b1584bf81a.zip |
fix(Service): Fix external link handling
Fixes #1609 by adding special handling for skype links
-rw-r--r-- | src/webview/recipe.js | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 353eb31fd..e3e13b726 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -33,7 +33,7 @@ class RecipeController { | |||
33 | 'settings-update': 'updateAppSettings', | 33 | 'settings-update': 'updateAppSettings', |
34 | 'service-settings-update': 'updateServiceSettings', | 34 | 'service-settings-update': 'updateServiceSettings', |
35 | 'get-service-id': 'serviceIdEcho', | 35 | 'get-service-id': 'serviceIdEcho', |
36 | } | 36 | }; |
37 | 37 | ||
38 | constructor() { | 38 | constructor() { |
39 | this.initialize(); | 39 | this.initialize(); |
@@ -176,7 +176,32 @@ const originalWindowOpen = window.open; | |||
176 | 176 | ||
177 | 177 | ||
178 | window.open = (url, frameName, features) => { | 178 | window.open = (url, frameName, features) => { |
179 | debug('window.open', url, frameName, features); | 179 | if (!url && !frameName && !features) { |
180 | // The service hasn't yet supplied a URL (as used in Skype). | ||
181 | // Return a new dummy window object and wait for the service to change the properties | ||
182 | const newWindow = { | ||
183 | location: { | ||
184 | href: '', | ||
185 | }, | ||
186 | }; | ||
187 | |||
188 | const checkInterval = setInterval(() => { | ||
189 | // Has the service changed the URL yet? | ||
190 | if (newWindow.location.href !== '') { | ||
191 | // Open the new URL | ||
192 | ipcRenderer.sendToHost('new-window', newWindow.location.href); | ||
193 | clearInterval(checkInterval); | ||
194 | } | ||
195 | }, 0); | ||
196 | |||
197 | setTimeout(() => { | ||
198 | // Stop checking for location changes after 1 second | ||
199 | clearInterval(checkInterval); | ||
200 | }, 1000); | ||
201 | |||
202 | return newWindow; | ||
203 | } | ||
204 | |||
180 | // We need to differentiate if the link should be opened in a popup or in the systems default browser | 205 | // We need to differentiate if the link should be opened in a popup or in the systems default browser |
181 | if (!frameName && !features && typeof features !== 'string') { | 206 | if (!frameName && !features && typeof features !== 'string') { |
182 | return ipcRenderer.sendToHost('new-window', url); | 207 | return ipcRenderer.sendToHost('new-window', url); |