[MM-42086] Upgrade to Electron v17 (#2013)
* [MM-42086] Upgrade to Electron v17 * Added viewName * merge'd * Update package-lock * Try it again
This commit is contained in:
parent
90202f1fbe
commit
14197d1707
970
package-lock.json
generated
970
package-lock.json
generated
File diff suppressed because it is too large
Load diff
18
package.json
18
package.json
|
@ -134,11 +134,11 @@
|
|||
"cross-env": "^5.2.0",
|
||||
"css-loader": "^1.0.1",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "14.1.0",
|
||||
"electron-builder": "^22.14.5",
|
||||
"electron-connect": "^0.6.3",
|
||||
"electron-mocha": "^10.1.0",
|
||||
"electron-notarize": "^1.1.0",
|
||||
"electron": "17.1.0",
|
||||
"electron-builder": "22.14.13",
|
||||
"electron-connect": "0.6.3",
|
||||
"electron-mocha": "11.0.2",
|
||||
"electron-notarize": "1.1.1",
|
||||
"eslint": "7.19.0",
|
||||
"eslint-import-resolver-webpack": "0.13.0",
|
||||
"eslint-plugin-babel": "5.3.1",
|
||||
|
@ -180,10 +180,10 @@
|
|||
"bootstrap-dark": "^1.0.3",
|
||||
"brace-expansion": "^2.0.0",
|
||||
"classnames": "^2.3.1",
|
||||
"electron-context-menu": "3.1.1",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
"electron-log": "^4.4.1",
|
||||
"electron-context-menu": "3.1.2",
|
||||
"electron-devtools-installer": "3.2.0",
|
||||
"electron-is-dev": "2.0.0",
|
||||
"electron-log": "4.4.6",
|
||||
"electron-updater": "5.0.0",
|
||||
"font-awesome": "^4.7.0",
|
||||
"pretty-bytes": "^6.0.0",
|
||||
|
|
|
@ -114,3 +114,7 @@ export const MODAL_UNCLOSEABLE = 'modal-uncloseable';
|
|||
export const UPDATE_PATHS = 'update-paths';
|
||||
|
||||
export const UPDATE_URL_VIEW_WIDTH = 'update-url-view-width';
|
||||
|
||||
export const DISPATCH_GET_DESKTOP_SOURCES = 'dispatch-get-desktop-sources';
|
||||
export const DESKTOP_SOURCES_RESULT = 'desktop-sources-result';
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ import {
|
|||
APP_LOGGED_OUT,
|
||||
GET_VIEW_NAME,
|
||||
GET_VIEW_WEBCONTENTS_ID,
|
||||
DISPATCH_GET_DESKTOP_SOURCES,
|
||||
DESKTOP_SOURCES_RESULT,
|
||||
} from 'common/communication';
|
||||
|
||||
const UNREAD_COUNT_INTERVAL = 1000;
|
||||
|
@ -149,6 +151,10 @@ window.addEventListener('message', ({origin, data = {}} = {}) => {
|
|||
ipcRenderer.send(BROWSER_HISTORY_BUTTON, viewName);
|
||||
break;
|
||||
}
|
||||
case 'get-desktop-sources': {
|
||||
ipcRenderer.send(DISPATCH_GET_DESKTOP_SOURCES, viewName, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -274,17 +280,14 @@ window.addEventListener('storage', (e) => {
|
|||
}
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld('desktopCapturer', {
|
||||
getSources: async (options) => {
|
||||
const sources = await desktopCapturer.getSources(options);
|
||||
return sources.map((source) => {
|
||||
return {
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
thumbnailURL: source.thumbnail.toDataURL(),
|
||||
};
|
||||
});
|
||||
ipcRenderer.on(DESKTOP_SOURCES_RESULT, (event, sources) => {
|
||||
window.postMessage(
|
||||
{
|
||||
type: 'desktop-sources-result',
|
||||
message: sources,
|
||||
},
|
||||
window.location.origin,
|
||||
);
|
||||
});
|
||||
|
||||
/* eslint-enable no-magic-numbers */
|
||||
|
|
|
@ -79,7 +79,6 @@ export class MattermostView extends EventEmitter {
|
|||
const preload = getLocalPreload('preload.js');
|
||||
this.options = Object.assign({}, options);
|
||||
this.options.webPreferences = {
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
additionalArguments: [
|
||||
`version=${app.getVersion()}`,
|
||||
|
|
|
@ -32,7 +32,6 @@ export class ModalView<T, T2> {
|
|||
this.data = data;
|
||||
log.info(`preloading with ${preload}`);
|
||||
this.view = new BrowserView({webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
|
||||
// Workaround for this issue: https://github.com/electron/electron/issues/30993
|
||||
|
|
|
@ -45,7 +45,6 @@ export default class TeamDropdownView {
|
|||
|
||||
const preload = getLocalPreload('dropdown.js');
|
||||
this.view = new BrowserView({webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
|
||||
// Workaround for this issue: https://github.com/electron/electron/issues/30993
|
||||
|
|
|
@ -301,7 +301,6 @@ export class ViewManager {
|
|||
const preload = getLocalPreload('urlView.js');
|
||||
const urlView = new BrowserView({
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
|
||||
// Workaround for this issue: https://github.com/electron/electron/issues/30993
|
||||
|
@ -357,7 +356,6 @@ export class ViewManager {
|
|||
createLoadingScreen = () => {
|
||||
const preload = getLocalPreload('loadingScreenPreload.js');
|
||||
this.loadingScreen = new BrowserView({webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
|
||||
// Workaround for this issue: https://github.com/electron/electron/issues/30993
|
||||
|
|
|
@ -179,7 +179,6 @@ export class WebContentsEventManager {
|
|||
show: false,
|
||||
center: true,
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
spellcheck: (typeof spellcheck === 'undefined' ? true : spellcheck),
|
||||
},
|
||||
});
|
||||
|
|
|
@ -79,7 +79,6 @@ function createMainWindow(options: {linuxAppIcon: string}) {
|
|||
trafficLightPosition: {x: 12, y: 12},
|
||||
backgroundColor: '#fff', // prevents blurry text: https://electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
disableBlinkFeatures: 'Auxclick',
|
||||
preload,
|
||||
spellcheck,
|
||||
|
|
|
@ -17,7 +17,6 @@ export function createSettingsWindow(mainWindow: BrowserWindow, withDevTools: bo
|
|||
title: 'Desktop App Settings',
|
||||
fullscreen: false,
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
spellcheck,
|
||||
}});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/* eslint-disable max-lines */
|
||||
import path from 'path';
|
||||
import {app, BrowserWindow, nativeImage, systemPreferences, ipcMain, IpcMainEvent, IpcMainInvokeEvent} from 'electron';
|
||||
import {app, BrowserWindow, nativeImage, systemPreferences, ipcMain, IpcMainEvent, IpcMainInvokeEvent, desktopCapturer} from 'electron';
|
||||
import log from 'electron-log';
|
||||
|
||||
import {
|
||||
|
@ -22,6 +22,8 @@ import {
|
|||
RESIZE_MODAL,
|
||||
APP_LOGGED_OUT,
|
||||
BROWSER_HISTORY_BUTTON,
|
||||
DISPATCH_GET_DESKTOP_SOURCES,
|
||||
DESKTOP_SOURCES_RESULT,
|
||||
} from 'common/communication';
|
||||
import urlUtils from 'common/utils/url';
|
||||
import {SECOND} from 'common/utils/constants';
|
||||
|
@ -65,6 +67,7 @@ export class WindowManager {
|
|||
ipcMain.on(APP_LOGGED_OUT, this.handleAppLoggedOut);
|
||||
ipcMain.handle(GET_VIEW_NAME, this.handleGetViewName);
|
||||
ipcMain.handle(GET_VIEW_WEBCONTENTS_ID, this.handleGetWebContentsId);
|
||||
ipcMain.on(DISPATCH_GET_DESKTOP_SOURCES, this.handleGetDesktopSources);
|
||||
}
|
||||
|
||||
handleUpdateConfig = () => {
|
||||
|
@ -630,6 +633,23 @@ export class WindowManager {
|
|||
handleGetWebContentsId = (event: IpcMainInvokeEvent) => {
|
||||
return event.sender.id;
|
||||
}
|
||||
|
||||
handleGetDesktopSources = async (event: IpcMainEvent, viewName: string, opts: Electron.SourcesOptions) => {
|
||||
const view = this.viewManager?.views.get(viewName);
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
|
||||
desktopCapturer.getSources(opts).then((sources) => {
|
||||
view.view.webContents.send(DESKTOP_SOURCES_RESULT, sources.map((source) => {
|
||||
return {
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
thumbnailURL: source.thumbnail.toDataURL(),
|
||||
};
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const windowManager = new WindowManager();
|
||||
|
|
Loading…
Reference in a new issue