diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-10-02 17:56:02 +0200 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-10-02 17:56:02 +0200 |
commit | 04b52afc6bd2de62c991a6bef3c185be8697bcca (patch) | |
tree | 9023a350a990df2803455a03771b73fa3dcfa353 /src/webview | |
parent | feat(App): Update to electron 6.0.11 (diff) | |
download | ferdium-app-04b52afc6bd2de62c991a6bef3c185be8697bcca.tar.gz ferdium-app-04b52afc6bd2de62c991a6bef3c185be8697bcca.tar.zst ferdium-app-04b52afc6bd2de62c991a6bef3c185be8697bcca.zip |
Fixes #1609 by adding special handling for skype links
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/recipe.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index c223b73de..60660d8f1 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -32,7 +32,7 @@ class RecipeController { | |||
32 | 'settings-update': 'updateAppSettings', | 32 | 'settings-update': 'updateAppSettings', |
33 | 'service-settings-update': 'updateServiceSettings', | 33 | 'service-settings-update': 'updateServiceSettings', |
34 | 'get-service-id': 'serviceIdEcho', | 34 | 'get-service-id': 'serviceIdEcho', |
35 | } | 35 | }; |
36 | 36 | ||
37 | constructor() { | 37 | constructor() { |
38 | this.initialize(); | 38 | this.initialize(); |
@@ -174,6 +174,32 @@ new RecipeController(); | |||
174 | const originalWindowOpen = window.open; | 174 | const originalWindowOpen = window.open; |
175 | 175 | ||
176 | window.open = (url, frameName, features) => { | 176 | window.open = (url, frameName, features) => { |
177 | if (!url && !frameName && !features) { | ||
178 | // The service hasn't yet supplied a URL (as used in Skype). | ||
179 | // Return a new dummy window object and wait for the service to change the properties | ||
180 | const newWindow = { | ||
181 | location: { | ||
182 | href: '', | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | const checkInterval = setInterval(() => { | ||
187 | // Has the service changed the URL yet? | ||
188 | if (newWindow.location.href !== '') { | ||
189 | // Open the new URL | ||
190 | ipcRenderer.sendToHost('new-window', newWindow.location.href); | ||
191 | clearInterval(checkInterval); | ||
192 | } | ||
193 | }, 0); | ||
194 | |||
195 | setTimeout(() => { | ||
196 | // Stop checking for location changes after 1 second | ||
197 | clearInterval(checkInterval); | ||
198 | }, 1000); | ||
199 | |||
200 | return newWindow; | ||
201 | } | ||
202 | |||
177 | // We need to differentiate if the link should be opened in a popup or in the systems default browser | 203 | // We need to differentiate if the link should be opened in a popup or in the systems default browser |
178 | if (!frameName && !features) { | 204 | if (!frameName && !features) { |
179 | return ipcRenderer.sendToHost('new-window', url); | 205 | return ipcRenderer.sendToHost('new-window', url); |