Electron 15 #7384
13 changed files with 60 additions and 53 deletions
|
@ -1,5 +1,5 @@
|
|||
import { WEBPACK_ELECTRON_PORT } from 'config';
|
||||
import { app, BrowserWindow, dialog, shell, screen, nativeImage } from 'electron';
|
||||
import { app, BrowserWindow, dialog, screen, nativeImage } from 'electron';
|
||||
import isDev from 'electron-is-dev';
|
||||
import windowStateKeeper from 'electron-window-state';
|
||||
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 * as PAGES from 'constants/pages';
|
||||
|
||||
const remote = require('@electron/remote/main');
|
||||
function GetAppLangCode() {
|
||||
// https://www.electronjs.org/docs/api/locales
|
||||
// 1. Gets the user locale.
|
||||
|
@ -54,6 +54,7 @@ export default appState => {
|
|||
webSecurity: !isDev,
|
||||
plugins: true,
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
enableRemoteModule: true, // see about removing this
|
||||
},
|
||||
};
|
||||
|
@ -62,6 +63,7 @@ export default appState => {
|
|||
const rendererURL = isDev ? `http://localhost:${WEBPACK_ELECTRON_PORT}` : `file://${__dirname}/index.html`;
|
||||
|
||||
let window = new BrowserWindow(windowConfiguration);
|
||||
remote.enable(window.webContents);
|
||||
|
||||
// Let us register listeners on the window, so we can update the state
|
||||
// automatically (the listeners will be removed when the window is closed)
|
||||
|
@ -187,9 +189,8 @@ export default appState => {
|
|||
window = null;
|
||||
});
|
||||
|
||||
window.webContents.on('new-window', (event, url) => {
|
||||
event.preventDefault();
|
||||
shell.openExternal(url);
|
||||
window.webContents.setWindowOpenHandler((details) => {
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
window.webContents.on('update-target-url', (event, url) => {
|
||||
|
|
|
@ -18,6 +18,8 @@ import installDevtools from './installDevtools';
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
const { download } = require('electron-dl');
|
||||
const remote = require('@electron/remote/main');
|
||||
remote.initialize();
|
||||
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||
let upgradeDisabled;
|
||||
try {
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
"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": {
|
||||
"@electron/remote": "^2.0.1",
|
||||
"@ungap/from-entries": "^0.2.1",
|
||||
"auto-launch": "^5.0.5",
|
||||
"electron-dl": "^3.2.0",
|
||||
|
@ -80,7 +81,7 @@
|
|||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@datapunt/matomo-tracker-js": "^0.1.4",
|
||||
"@exponent/electron-cookies": "^2.0.0",
|
||||
"@meetfranz/electron-cookies": "^3.0.2",
|
||||
"@hot-loader/react-dom": "^16.13",
|
||||
"@reach/auto-id": "^0.13.0",
|
||||
"@reach/combobox": "^0.12.1",
|
||||
|
@ -121,7 +122,7 @@
|
|||
"dom-scroll-into-view": "^1.2.1",
|
||||
"dotenv-defaults": "^2.0.1",
|
||||
"dotenv-webpack": "^1.8.0",
|
||||
"electron": "11.5.0",
|
||||
"electron": "15.3.2",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-is-dev": "^0.3.0",
|
||||
|
|
|
@ -6,7 +6,7 @@ import { history } from './store';
|
|||
import { SDK_API_PATH } from './index';
|
||||
// @if TARGET='app'
|
||||
import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
import ElectronCookies from '@meetfranz/electron-cookies';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
// @endif
|
||||
import { MATOMO_ID, MATOMO_URL } from 'config';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// @flow
|
||||
import * as React from 'react';
|
||||
import { remote } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import Button from 'component/button';
|
||||
import { FormField } from 'component/common/form';
|
||||
|
||||
|
@ -47,7 +47,7 @@ class FileSelector extends React.PureComponent<Props> {
|
|||
};
|
||||
|
||||
handleDirectoryInputSelection = () => {
|
||||
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then(result => {
|
||||
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then((result) => {
|
||||
const path = result && result.filePaths[0];
|
||||
if (path) {
|
||||
// $FlowFixMe
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// @flow
|
||||
import { remote } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
|
|
|
@ -17,10 +17,8 @@ import NotificationHeaderButton from 'component/notificationHeaderButton';
|
|||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import SkipNavigationButton from 'component/skipNavigationButton';
|
||||
import Logo from 'component/logo';
|
||||
// @if TARGET='app'
|
||||
import { remote } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import { IS_MAC } from 'component/app/view';
|
||||
// @endif
|
||||
|
||||
type Props = {
|
||||
user: ?User,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// @flow
|
||||
import * as React from 'react';
|
||||
import { shell, remote } from 'electron';
|
||||
import { shell } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import Button from 'component/button';
|
||||
import CopyableText from 'component/copyableText';
|
||||
import AdmZip from 'adm-zip';
|
||||
|
|
|
@ -5,7 +5,8 @@ import SnackBar from 'component/snackBar';
|
|||
import SplashScreen from 'component/splash';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { changeZoomFactor } from 'util/zoomWindow';
|
||||
import { ipcRenderer, remote, shell } from 'electron';
|
||||
import { ipcRenderer, shell } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import moment from 'moment';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React, { Fragment, useState, useEffect } from 'react';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { execSync } from 'child_process';
|
||||
import isDev from 'electron-is-dev';
|
||||
import { ipcRenderer, remote } from 'electron';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @flow
|
||||
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { remote } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
|
||||
// @if TARGET='app'
|
||||
const win = remote.BrowserWindow.getFocusedWindow();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { clipboard, remote, shell } from 'electron';
|
||||
import { clipboard, shell } from 'electron';
|
||||
import * as remote from '@electron/remote';
|
||||
import { convertToShareLink } from 'util/lbryURI';
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
|
|
69
yarn.lock
69
yarn.lock
|
@ -1270,28 +1270,26 @@
|
|||
ajv "^6.12.0"
|
||||
ajv-keywords "^3.4.1"
|
||||
|
||||
"@electron/get@^1.0.1":
|
||||
version "1.12.2"
|
||||
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.12.2.tgz#6442066afb99be08cefb9a281e4b4692b33764f3"
|
||||
integrity sha512-vAuHUbfvBQpYTJ5wB7uVIDq5c/Ry0fiTBMs7lnEYAo/qXXppIVcWdfBr57u6eRnKdVso7KSiH6p/LbQAG6Izrg==
|
||||
"@electron/get@^1.13.0":
|
||||
version "1.13.1"
|
||||
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.13.1.tgz#42a0aa62fd1189638bd966e23effaebb16108368"
|
||||
integrity sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA==
|
||||
dependencies:
|
||||
debug "^4.1.1"
|
||||
env-paths "^2.2.0"
|
||||
fs-extra "^8.1.0"
|
||||
got "^9.6.0"
|
||||
progress "^2.0.3"
|
||||
sanitize-filename "^1.6.2"
|
||||
semver "^6.2.0"
|
||||
sumchecker "^3.0.1"
|
||||
optionalDependencies:
|
||||
global-agent "^2.0.2"
|
||||
global-agent "^3.0.0"
|
||||
global-tunnel-ng "^2.7.1"
|
||||
|
||||
"@exponent/electron-cookies@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@exponent/electron-cookies/-/electron-cookies-2.0.0.tgz#4cf8dcf851454036cc524c40e9e482fc4e23f2d9"
|
||||
dependencies:
|
||||
tough-cookie "^2.2.2"
|
||||
tough-cookie-web-storage-store "^1.0.0"
|
||||
"@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==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.2"
|
||||
|
@ -1314,6 +1312,15 @@
|
|||
dependencies:
|
||||
unist-util-visit "^1.3.0"
|
||||
|
||||
"@meetfranz/electron-cookies@^2.0.0":
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@meetfranz/electron-cookies/-/electron-cookies-3.0.2.tgz#762b6bf8d90b339ad0b89234facc84ee9816d1c4"
|
||||
integrity sha512-8HuCIY6yfcHApmmCrwLHqKhDeiag65/3CcubV5AI9Cf39fc7WgaKR6KWWjSJemXNwwaK/nLFUuiArmXO+LBveQ==
|
||||
dependencies:
|
||||
"@electron/remote" "^2.0.1"
|
||||
tough-cookie "^2.3.1"
|
||||
tough-cookie-web-storage-store "^1.0.0"
|
||||
|
||||
"@nodelib/fs.scandir@2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
||||
|
@ -1769,10 +1776,10 @@
|
|||
version "13.9.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.0.tgz#5b6ee7a77faacddd7de719017d0bc12f52f81589"
|
||||
|
||||
"@types/node@^12.0.12":
|
||||
version "12.12.62"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.62.tgz#733923d73669188d35950253dd18a21570085d2b"
|
||||
integrity sha512-qAfo81CsD7yQIM9mVyh6B/U47li5g7cfpVQEDMfQeF8pSZVwzbhwU3crc0qG4DmpsebpJPR49AKOExQyJ05Cpg==
|
||||
"@types/node@^14.6.2":
|
||||
version "14.18.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.1.tgz#459886b51f52aa923dc06b9ea81cb8b1d733e9d3"
|
||||
integrity sha512-fTFWOFrgAkj737w1o0HLTIgisgYHnsZfeiqhG1Ltrf/iJjudEbUwetQAsfrtVE49JGwvpEzQR+EbMkIqG4227g==
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.0"
|
||||
|
@ -3737,11 +3744,6 @@ core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5:
|
|||
version "2.6.11"
|
||||
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:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
|
@ -4710,13 +4712,13 @@ electron-window-state@^4.1.1:
|
|||
jsonfile "^2.2.3"
|
||||
mkdirp "^0.5.1"
|
||||
|
||||
electron@11.5.0:
|
||||
version "11.5.0"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-11.5.0.tgz#f1650543b9d8f2047d3807755bdb120153ed210f"
|
||||
integrity sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==
|
||||
electron@15.3.2:
|
||||
version "15.3.2"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-15.3.2.tgz#4f0cbad781d14e0194f5dfef1709e09a70c8074a"
|
||||
integrity sha512-sEpOX10gjAyvq33HDxJrq2HhYZT3qndZjUrHkzG16QTLjykP7lMvGnJ/bt6wn+T75f4wwv59FUbQx2hW3Xz5TQ==
|
||||
dependencies:
|
||||
"@electron/get" "^1.0.1"
|
||||
"@types/node" "^12.0.12"
|
||||
"@electron/get" "^1.13.0"
|
||||
"@types/node" "^14.6.2"
|
||||
extract-zip "^1.0.3"
|
||||
|
||||
elegant-spinner@^1.0.1:
|
||||
|
@ -5914,13 +5916,12 @@ glob@^7.0.5, glob@^7.1.6:
|
|||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
global-agent@^2.0.2:
|
||||
version "2.1.12"
|
||||
resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-2.1.12.tgz#e4ae3812b731a9e81cbf825f9377ef450a8e4195"
|
||||
integrity sha512-caAljRMS/qcDo69X9BfkgrihGUgGx44Fb4QQToNQjsiWh+YlQ66uqYVAdA8Olqit+5Ng0nkz09je3ZzANMZcjg==
|
||||
global-agent@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-3.0.0.tgz#ae7cd31bd3583b93c5a16437a1afe27cc33a1ab6"
|
||||
integrity sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==
|
||||
dependencies:
|
||||
boolean "^3.0.1"
|
||||
core-js "^3.6.5"
|
||||
es6-error "^4.1.1"
|
||||
matcher "^3.0.0"
|
||||
roarr "^2.15.3"
|
||||
|
@ -10692,7 +10693,7 @@ safe-regex@^1.1.0:
|
|||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
|
||||
|
||||
sanitize-filename@^1.6.2, sanitize-filename@^1.6.3:
|
||||
sanitize-filename@^1.6.3:
|
||||
version "1.6.3"
|
||||
resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378"
|
||||
integrity sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==
|
||||
|
@ -11870,7 +11871,7 @@ tough-cookie-web-storage-store@^1.0.0:
|
|||
dependencies:
|
||||
lodash "^4.6.1"
|
||||
|
||||
tough-cookie@^2.2.2:
|
||||
tough-cookie@^2.3.1:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2"
|
||||
integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==
|
||||
|
|
Loading…
Reference in a new issue