Fix the OAuth redirect on windows (#10629)

This commit is contained in:
Sergei Garin 2024-07-23 13:27:27 +03:00 committed by GitHub
parent 7e4c25c167
commit c11f5aeed2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,11 +100,30 @@ class App {
this.handleItemOpening(fileToOpen, urlToOpen)
this.setChromeOptions(chromeOptions)
security.enableAll()
electron.app.on('before-quit', () => {
this.isQuitting = true
})
electron.app.on('second-instance', (_event, argv) => {
logger.log(`Got data from 'second-instance' event: '${argv.toString()}'.`)
const isWin = os.platform() === 'win32'
if (isWin) {
const ensoLinkInArgs = argv.find(arg =>
arg.startsWith(common.DEEP_LINK_SCHEME)
)
if (ensoLinkInArgs != null) {
electron.app.emit(
'open-url',
new CustomEvent('open-url'),
ensoLinkInArgs
)
}
}
// The second instances will close themselves, but our window likely is not in the
// foreground - the focus went to the "second instance" of the application.
if (this.window) {