[utils] Fix opening external URL on Linux (GTK)

This commit is contained in:
derrod 2021-10-06 17:14:00 +02:00
parent 8e5f579db7
commit c89f9d82c7

View file

@ -1,5 +1,6 @@
import logging import logging
import json import json
import webbrowser
logger = logging.getLogger('WebViewHelper') logger = logging.getLogger('WebViewHelper')
webview_available = True webview_available = True
@ -24,9 +25,7 @@ window.ue = {
registersignincompletecallback: pywebview.api.trigger_logout registersignincompletecallback: pywebview.api.trigger_logout
}, },
common: { common: {
launchexternalurl: function(url) { launchexternalurl: pywebview.api.open_url_external,
window.open(url, "blank");
},
// not required, just needs to be non-null // not required, just needs to be non-null
auth: { auth: {
completeLogin: pywebview.api.nop completeLogin: pywebview.api.nop
@ -77,6 +76,9 @@ class MockLauncher:
def nop(self, *args, **kwargs): def nop(self, *args, **kwargs):
return return
def open_url_external(self, url):
webbrowser.open(url)
def trigger_logout(self, *args, **kwargs): def trigger_logout(self, *args, **kwargs):
self.inject_js = False self.inject_js = False
# first obtain SID, then log out # first obtain SID, then log out