Revert "upgrade electron to 15 (#7363)" (#7383)

This reverts commit 08c47a57f1.
This commit is contained in:
jessopb 2021-12-31 14:49:45 -05:00 committed by GitHub
parent 68ecfbb990
commit 6d04ff6e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 49 deletions

View file

@ -1,5 +1,5 @@
import { WEBPACK_ELECTRON_PORT } from 'config'; import { WEBPACK_ELECTRON_PORT } from 'config';
import { app, BrowserWindow, dialog, screen, nativeImage } from 'electron'; import { app, BrowserWindow, dialog, shell, screen, nativeImage } from 'electron';
import isDev from 'electron-is-dev'; import isDev from 'electron-is-dev';
import windowStateKeeper from 'electron-window-state'; import windowStateKeeper from 'electron-window-state';
import SUPPORTED_LANGUAGES from 'constants/supported_languages'; import SUPPORTED_LANGUAGES from 'constants/supported_languages';
@ -9,7 +9,7 @@ import { TO_TRAY_WHEN_CLOSED } from 'constants/settings';
import setupBarMenu from './menu/setupBarMenu'; import setupBarMenu from './menu/setupBarMenu';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
const remote = require('@electron/remote/main');
function GetAppLangCode() { function GetAppLangCode() {
// https://www.electronjs.org/docs/api/locales // https://www.electronjs.org/docs/api/locales
// 1. Gets the user locale. // 1. Gets the user locale.
@ -54,7 +54,6 @@ export default appState => {
webSecurity: !isDev, webSecurity: !isDev,
plugins: true, plugins: true,
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true, // see about removing this enableRemoteModule: true, // see about removing this
}, },
}; };
@ -63,7 +62,6 @@ export default appState => {
const rendererURL = isDev ? `http://localhost:${WEBPACK_ELECTRON_PORT}` : `file://${__dirname}/index.html`; const rendererURL = isDev ? `http://localhost:${WEBPACK_ELECTRON_PORT}` : `file://${__dirname}/index.html`;
let window = new BrowserWindow(windowConfiguration); let window = new BrowserWindow(windowConfiguration);
remote.enable(window.webContents);
// Let us register listeners on the window, so we can update the state // Let us register listeners on the window, so we can update the state
// automatically (the listeners will be removed when the window is closed) // automatically (the listeners will be removed when the window is closed)
@ -189,8 +187,9 @@ export default appState => {
window = null; window = null;
}); });
window.webContents.setWindowOpenHandler((details) => { window.webContents.on('new-window', (event, url) => {
return { action: 'deny' }; event.preventDefault();
shell.openExternal(url);
}); });
window.webContents.on('update-target-url', (event, url) => { window.webContents.on('update-target-url', (event, url) => {

View file

@ -18,8 +18,6 @@ import installDevtools from './installDevtools';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
const { download } = require('electron-dl'); const { download } = require('electron-dl');
const remote = require('@electron/remote/main');
remote.initialize();
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled'); const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
let upgradeDisabled; let upgradeDisabled;
try { try {

View file

@ -44,7 +44,6 @@
"postinstall:warning": "echo '\n\nWARNING\n\nNot all node modules were installed because NODE_ENV is set to \"production\".\nThis should only be set after installing dependencies with \"yarn\". The app will not work.\n\n'" "postinstall:warning": "echo '\n\nWARNING\n\nNot all node modules were installed because NODE_ENV is set to \"production\".\nThis should only be set after installing dependencies with \"yarn\". The app will not work.\n\n'"
}, },
"dependencies": { "dependencies": {
"@electron/remote": "^2.0.1",
"@ungap/from-entries": "^0.2.1", "@ungap/from-entries": "^0.2.1",
"auto-launch": "^5.0.5", "auto-launch": "^5.0.5",
"electron-dl": "^3.2.0", "electron-dl": "^3.2.0",
@ -123,7 +122,7 @@
"dom-scroll-into-view": "^1.2.1", "dom-scroll-into-view": "^1.2.1",
"dotenv-defaults": "^2.0.1", "dotenv-defaults": "^2.0.1",
"dotenv-webpack": "^1.8.0", "dotenv-webpack": "^1.8.0",
"electron": "15.3.2", "electron": "11.5.0",
"electron-builder": "^22.9.1", "electron-builder": "^22.9.1",
"electron-devtools-installer": "^3.1.1", "electron-devtools-installer": "^3.1.1",
"electron-is-dev": "^0.3.0", "electron-is-dev": "^0.3.0",

View file

@ -1,6 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import * as remote from '@electron/remote'; import { remote } from 'electron';
import Button from 'component/button'; import Button from 'component/button';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
@ -47,7 +47,7 @@ class FileSelector extends React.PureComponent<Props> {
}; };
handleDirectoryInputSelection = () => { handleDirectoryInputSelection = () => {
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then((result) => { remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then(result => {
const path = result && result.filePaths[0]; const path = result && result.filePaths[0];
if (path) { if (path) {
// $FlowFixMe // $FlowFixMe

View file

@ -1,5 +1,5 @@
// @flow // @flow
import * as remote from '@electron/remote'; import { remote } from 'electron';
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import * as RENDER_MODES from 'constants/file_render_modes'; import * as RENDER_MODES from 'constants/file_render_modes';

View file

@ -17,8 +17,10 @@ import NotificationHeaderButton from 'component/notificationHeaderButton';
import ChannelThumbnail from 'component/channelThumbnail'; import ChannelThumbnail from 'component/channelThumbnail';
import SkipNavigationButton from 'component/skipNavigationButton'; import SkipNavigationButton from 'component/skipNavigationButton';
import Logo from 'component/logo'; import Logo from 'component/logo';
import * as remote from '@electron/remote'; // @if TARGET='app'
import { remote } from 'electron';
import { IS_MAC } from 'component/app/view'; import { IS_MAC } from 'component/app/view';
// @endif
type Props = { type Props = {
user: ?User, user: ?User,

View file

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import { shell } from 'electron'; import { shell, remote } from 'electron';
import * as remote from '@electron/remote';
import Button from 'component/button'; import Button from 'component/button';
import CopyableText from 'component/copyableText'; import CopyableText from 'component/copyableText';
import AdmZip from 'adm-zip'; import AdmZip from 'adm-zip';

View file

@ -5,8 +5,7 @@ import SnackBar from 'component/snackBar';
import SplashScreen from 'component/splash'; import SplashScreen from 'component/splash';
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import { changeZoomFactor } from 'util/zoomWindow'; import { changeZoomFactor } from 'util/zoomWindow';
import { ipcRenderer, shell } from 'electron'; import { ipcRenderer, remote, shell } from 'electron';
import * as remote from '@electron/remote';
import moment from 'moment'; import moment from 'moment';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
import React, { Fragment, useState, useEffect } from 'react'; import React, { Fragment, useState, useEffect } from 'react';

View file

@ -1,7 +1,6 @@
import { execSync } from 'child_process'; import { execSync } from 'child_process';
import isDev from 'electron-is-dev'; import isDev from 'electron-is-dev';
import { ipcRenderer } from 'electron'; import { ipcRenderer, remote } from 'electron';
import * as remote from '@electron/remote';
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import * as remote from '@electron/remote'; import { remote } from 'electron';
// @if TARGET='app' // @if TARGET='app'
const win = remote.BrowserWindow.getFocusedWindow(); const win = remote.BrowserWindow.getFocusedWindow();

View file

@ -1,5 +1,4 @@
import { clipboard, shell } from 'electron'; import { clipboard, remote, shell } from 'electron';
import * as remote from '@electron/remote';
import { convertToShareLink } from 'util/lbryURI'; import { convertToShareLink } from 'util/lbryURI';
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';

View file

@ -1270,27 +1270,22 @@
ajv "^6.12.0" ajv "^6.12.0"
ajv-keywords "^3.4.1" ajv-keywords "^3.4.1"
"@electron/get@^1.13.0": "@electron/get@^1.0.1":
version "1.13.1" version "1.12.2"
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.13.1.tgz#42a0aa62fd1189638bd966e23effaebb16108368" resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.12.2.tgz#6442066afb99be08cefb9a281e4b4692b33764f3"
integrity sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA== integrity sha512-vAuHUbfvBQpYTJ5wB7uVIDq5c/Ry0fiTBMs7lnEYAo/qXXppIVcWdfBr57u6eRnKdVso7KSiH6p/LbQAG6Izrg==
dependencies: dependencies:
debug "^4.1.1" debug "^4.1.1"
env-paths "^2.2.0" env-paths "^2.2.0"
fs-extra "^8.1.0" fs-extra "^8.1.0"
got "^9.6.0" got "^9.6.0"
progress "^2.0.3" progress "^2.0.3"
semver "^6.2.0" sanitize-filename "^1.6.2"
sumchecker "^3.0.1" sumchecker "^3.0.1"
optionalDependencies: optionalDependencies:
global-agent "^3.0.0" global-agent "^2.0.2"
global-tunnel-ng "^2.7.1" global-tunnel-ng "^2.7.1"
"@electron/remote@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@electron/remote/-/remote-2.0.1.tgz#810cbc595a21f0f94641eb2d7e8264063a3f84de"
integrity sha512-bGX4/yB2bPZwXm1DsxgoABgH0Cz7oFtXJgkerB8VrStYdTyvhGAULzNLRn9rVmeAuC3VUDXaXpZIlZAZHpsLIA==
"@exponent/electron-cookies@^2.0.0": "@exponent/electron-cookies@^2.0.0":
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/@exponent/electron-cookies/-/electron-cookies-2.0.0.tgz#4cf8dcf851454036cc524c40e9e482fc4e23f2d9" resolved "https://registry.yarnpkg.com/@exponent/electron-cookies/-/electron-cookies-2.0.0.tgz#4cf8dcf851454036cc524c40e9e482fc4e23f2d9"
@ -1774,10 +1769,10 @@
version "13.9.0" version "13.9.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.0.tgz#5b6ee7a77faacddd7de719017d0bc12f52f81589" resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.0.tgz#5b6ee7a77faacddd7de719017d0bc12f52f81589"
"@types/node@^14.6.2": "@types/node@^12.0.12":
version "14.18.1" version "12.12.62"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.1.tgz#459886b51f52aa923dc06b9ea81cb8b1d733e9d3" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.62.tgz#733923d73669188d35950253dd18a21570085d2b"
integrity sha512-fTFWOFrgAkj737w1o0HLTIgisgYHnsZfeiqhG1Ltrf/iJjudEbUwetQAsfrtVE49JGwvpEzQR+EbMkIqG4227g== integrity sha512-qAfo81CsD7yQIM9mVyh6B/U47li5g7cfpVQEDMfQeF8pSZVwzbhwU3crc0qG4DmpsebpJPR49AKOExQyJ05Cpg==
"@types/normalize-package-data@^2.4.0": "@types/normalize-package-data@^2.4.0":
version "2.4.0" version "2.4.0"
@ -3742,6 +3737,11 @@ core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5:
version "2.6.11" version "2.6.11"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c"
core-js@^3.6.5:
version "3.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==
core-util-is@1.0.2, core-util-is@~1.0.0: core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@ -4747,13 +4747,13 @@ electron-window-state@^4.1.1:
jsonfile "^2.2.3" jsonfile "^2.2.3"
mkdirp "^0.5.1" mkdirp "^0.5.1"
electron@15.3.2: electron@11.5.0:
version "15.3.2" version "11.5.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-15.3.2.tgz#4f0cbad781d14e0194f5dfef1709e09a70c8074a" resolved "https://registry.yarnpkg.com/electron/-/electron-11.5.0.tgz#f1650543b9d8f2047d3807755bdb120153ed210f"
integrity sha512-sEpOX10gjAyvq33HDxJrq2HhYZT3qndZjUrHkzG16QTLjykP7lMvGnJ/bt6wn+T75f4wwv59FUbQx2hW3Xz5TQ== integrity sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==
dependencies: dependencies:
"@electron/get" "^1.13.0" "@electron/get" "^1.0.1"
"@types/node" "^14.6.2" "@types/node" "^12.0.12"
extract-zip "^1.0.3" extract-zip "^1.0.3"
elegant-spinner@^1.0.1: elegant-spinner@^1.0.1:
@ -5951,12 +5951,13 @@ glob@^7.0.5, glob@^7.1.6:
once "^1.3.0" once "^1.3.0"
path-is-absolute "^1.0.0" path-is-absolute "^1.0.0"
global-agent@^3.0.0: global-agent@^2.0.2:
version "3.0.0" version "2.1.12"
resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-3.0.0.tgz#ae7cd31bd3583b93c5a16437a1afe27cc33a1ab6" resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-2.1.12.tgz#e4ae3812b731a9e81cbf825f9377ef450a8e4195"
integrity sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q== integrity sha512-caAljRMS/qcDo69X9BfkgrihGUgGx44Fb4QQToNQjsiWh+YlQ66uqYVAdA8Olqit+5Ng0nkz09je3ZzANMZcjg==
dependencies: dependencies:
boolean "^3.0.1" boolean "^3.0.1"
core-js "^3.6.5"
es6-error "^4.1.1" es6-error "^4.1.1"
matcher "^3.0.0" matcher "^3.0.0"
roarr "^2.15.3" roarr "^2.15.3"
@ -10743,7 +10744,7 @@ safe-regex@^1.1.0:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
sanitize-filename@^1.6.3: sanitize-filename@^1.6.2, sanitize-filename@^1.6.3:
version "1.6.3" version "1.6.3"
resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378" resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378"
integrity sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg== integrity sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==