upgrade electron

disable cors switch

electron version test

v8

wip

v9

bump

nativeImage

clean
This commit is contained in:
jessop 2020-09-06 18:46:30 -04:00 committed by Sean Yesmunt
parent ec3307320a
commit e61f8551a3
7 changed files with 1847 additions and 860 deletions

View file

@ -30,7 +30,7 @@ export default window => {
const template = [ const template = [
{ {
label: `Open ${app.getName()}`, label: `Open ${app.name}`,
click: () => { click: () => {
window.show(); window.show();
}, },

View file

@ -1,5 +1,5 @@
import { WEBPACK_ELECTRON_PORT } from 'config'; import { WEBPACK_ELECTRON_PORT } from 'config';
import { app, BrowserWindow, dialog, shell, screen } 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';
@ -46,11 +46,12 @@ export default appState => {
// If state is undefined, create window as maximized. // If state is undefined, create window as maximized.
width: windowState.width === undefined ? width : windowState.width, width: windowState.width === undefined ? width : windowState.width,
height: windowState.height === undefined ? height : windowState.height, height: windowState.height === undefined ? height : windowState.height,
icon: 'static/img/tray/default/tray.png', icon: nativeImage.createFromPath('static/img/tray/default/tray.png'),
webPreferences: { webPreferences: {
// Disable renderer process's webSecurity on development to enable CORS. // Disable renderer process's webSecurity on development to enable CORS.
webSecurity: !isDev, webSecurity: !isDev,
plugins: true, plugins: true,
nodeIntegration: true,
}, },
}; };
const lbryProto = 'lbry://'; const lbryProto = 'lbry://';

View file

@ -47,9 +47,10 @@ let lbryFirst;
const appState = {}; const appState = {};
app.setAsDefaultProtocolClient('lbry'); app.setAsDefaultProtocolClient('lbry');
app.setName('LBRY'); app.name = 'LBRY';
app.setAppUserModelId('io.lbry.LBRY'); app.setAppUserModelId('io.lbry.LBRY');
app.commandLine.appendSwitch('force-color-profile', 'srgb'); app.commandLine.appendSwitch('force-color-profile', 'srgb');
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors');
if (isDev) { if (isDev) {
// Disable security warnings in dev mode: // Disable security warnings in dev mode:
@ -187,21 +188,6 @@ if (!gotSingleInstanceLock) {
}); });
} }
// HACK: patch webrequest to fix devtools incompatibility with electron 2.x.
// See https://github.com/electron/electron/issues/13008#issuecomment-400261941
session.defaultSession.webRequest.onBeforeRequest({}, (details, callback) => {
if (details.url.includes('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33')) {
callback({
redirectURL: details.url.replace(
'7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33',
'57c9d07b416b5a2ea23d28247300e4af36329bdc'
),
});
} else {
callback({ cancel: false });
}
});
// If an "Origin" header is passed, the SDK will check that it is set to allow that origin in the daemon_settings.yml // If an "Origin" header is passed, the SDK will check that it is set to allow that origin in the daemon_settings.yml
// By default, electron sends http://localhost:{port} as the origin for POST requests // By default, electron sends http://localhost:{port} as the origin for POST requests
// https://github.com/electron/electron/issues/7931#issuecomment-361759277 // https://github.com/electron/electron/issues/7931#issuecomment-361759277

View file

@ -105,7 +105,7 @@ export default () => {
]; ];
const darwinTemplateAddition = { const darwinTemplateAddition = {
label: app.getName(), label: app.name,
submenu: [ submenu: [
{ role: 'about' }, { role: 'about' },
{ type: 'separator' }, { type: 'separator' },

View file

@ -106,11 +106,11 @@
"dom-scroll-into-view": "^1.2.1", "dom-scroll-into-view": "^1.2.1",
"dotenv-defaults": "^1.1.1", "dotenv-defaults": "^1.1.1",
"dotenv-webpack": "^1.8.0", "dotenv-webpack": "^1.8.0",
"electron": "4.1.0", "electron": "9.0.1",
"electron-builder": "^22.4.0", "electron-builder": "^22.8.0",
"electron-devtools-installer": "^2.2.4", "electron-devtools-installer": "^2.2.4",
"electron-is-dev": "^0.3.0", "electron-is-dev": "^0.3.0",
"electron-webpack": "^2.7.4", "electron-webpack": "^2.8.2",
"electron-window-state": "^4.1.1", "electron-window-state": "^4.1.1",
"eslint": "^5.15.2", "eslint": "^5.15.2",
"eslint-config-prettier": "^2.9.0", "eslint-config-prettier": "^2.9.0",

View file

@ -1310,7 +1310,6 @@
"Discussion": "Discussion", "Discussion": "Discussion",
"Staked LBRY Credits": "Staked LBRY Credits", "Staked LBRY Credits": "Staked LBRY Credits",
"1 comment": "1 comment", "1 comment": "1 comment",
"%total_comments% comments": "%total_comments% comments",
"Upvote": "Upvote", "Upvote": "Upvote",
"Downvote": "Downvote", "Downvote": "Downvote",
"Hide %number% Replies": "Hide %number% Replies", "Hide %number% Replies": "Hide %number% Replies",
@ -1321,10 +1320,12 @@
"Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.", "Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.",
"Channel cannot be anonymous, please select a channel and try again.": "Channel cannot be anonymous, please select a channel and try again.", "Channel cannot be anonymous, please select a channel and try again.": "Channel cannot be anonymous, please select a channel and try again.",
"Change to list layout": "Change to list layout", "Change to list layout": "Change to list layout",
"Change to tile layout": "Change to tile layout",
"Create a channel": "Create a channel", "Create a channel": "Create a channel",
"Credit Details": "Credit Details", "Credit Details": "Credit Details",
"LBRY Credits": "LBRY Credits", "LBRY Credits": "LBRY Credits",
"Sync my YouTube channel": "Sync my YouTube channel", "Sync my YouTube channel": "Sync my YouTube channel",
"Change to tile layout": "Change to tile layout",
"%total_comments% comments": "%total_comments% comments",
"Electron": "Electron",
"--end--": "--end--" "--end--": "--end--"
} }

2669
yarn.lock

File diff suppressed because it is too large Load diff