fix: electron upgrade fixes (#2058)

* fix: electron upgrade fixes

* fix: electron remote

* fixes

* fixes

* pin

* actually
This commit is contained in:
Diego Rodríguez Baquero
2021-10-10 13:21:45 -05:00
committed by GitHub
parent 0732bd93d2
commit c36e43eaa3
12 changed files with 1152 additions and 721 deletions

View File

@@ -1,5 +1,6 @@
console.time('init')
require('@electron/remote/main').initialize()
const { app, ipcMain } = require('electron')
// Start crash reporter early, so it takes effect for child processes

View File

@@ -222,7 +222,8 @@ function init () {
ipcMain.emit = function (name, e, ...args) {
// Relay messages between the main window and the WebTorrent hidden window
if (name.startsWith('wt-') && !app.isQuitting) {
if (e.sender.browserWindowOptions.title === 'webtorrent-hidden-window') {
console.dir(e.sender.getTitle())
if (e.sender.getTitle() === 'WebTorrent Hidden Window') {
// Send message to main window
windows.main.send(name, ...args)
log('webtorrent: got %s', name)

View File

@@ -33,6 +33,7 @@ function init () {
},
width: 300
})
require('@electron/remote/main').enable(win.webContents)
win.loadURL(config.WINDOW_ABOUT)

View File

@@ -50,6 +50,7 @@ function init (state, options) {
x: initialBounds.x,
y: initialBounds.y
})
require('@electron/remote/main').enable(win.webContents)
win.loadURL(config.WINDOW_MAIN)
@@ -65,7 +66,7 @@ function init (state, options) {
menu.onToggleFullScreen(main.win.isFullScreen())
})
win.webContents.on('will-navigate', (e, url) => {
win.webContents.on('will-navigate', (e) => {
// Prevent drag-and-drop from navigating the Electron window, which can happen
// before our drag-and-drop handlers have been initialized.
e.preventDefault()
@@ -151,7 +152,7 @@ function setBounds (bounds, maximize) {
log('setBounds: maximizing')
main.win.maximize()
} else if (maximize === false && main.win.isMaximized()) {
log('setBounds: unmaximizing')
log('setBounds: minimizing')
main.win.unmaximize()
}

View File

@@ -33,6 +33,7 @@ function init () {
},
width: 150
})
require('@electron/remote/main').enable(win.webContents)
win.loadURL(config.WINDOW_WEBTORRENT)