update electron version to 11, some changes to app update
This commit is contained in:
parent
88b9c9decd
commit
eaf3826df8
6 changed files with 62 additions and 58 deletions
|
@ -54,6 +54,7 @@ export default appState => {
|
||||||
webSecurity: !isDev,
|
webSecurity: !isDev,
|
||||||
plugins: true,
|
plugins: true,
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
enableRemoteModule: true, // see about removing this
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const lbryProto = 'lbry://';
|
const lbryProto = 'lbry://';
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import '@babel/polyfill';
|
import '@babel/polyfill';
|
||||||
import SemVer from 'semver';
|
import SemVer from 'semver';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
import { app, dialog, ipcMain, session, shell } from 'electron';
|
import { app, dialog, ipcMain, session, shell, BrowserWindow } from 'electron';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
import Lbry from 'lbry';
|
import Lbry from 'lbry';
|
||||||
import LbryFirstInstance from './LbryFirstInstance';
|
import LbryFirstInstance from './LbryFirstInstance';
|
||||||
|
@ -17,6 +17,7 @@ import startSandbox from './startSandbox';
|
||||||
import installDevtools from './installDevtools';
|
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 filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||||
let upgradeDisabled;
|
let upgradeDisabled;
|
||||||
try {
|
try {
|
||||||
|
@ -283,6 +284,20 @@ app.on('before-quit', () => {
|
||||||
appState.isQuitting = true;
|
appState.isQuitting = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on('download-upgrade', async (event, params) => {
|
||||||
|
const { url, options } = params;
|
||||||
|
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||||
|
options.onProgress = function(p) {
|
||||||
|
rendererWindow.webContents.send('download-progress-update', p);
|
||||||
|
};
|
||||||
|
options.directory = dir;
|
||||||
|
options.onCompleted = function(c) {
|
||||||
|
rendererWindow.webContents.send('download-update-complete', c);
|
||||||
|
};
|
||||||
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
|
await download(win, url, options).catch(e => console.log('e', e));
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on('upgrade', (event, installerPath) => {
|
ipcMain.on('upgrade', (event, installerPath) => {
|
||||||
app.on('quit', () => {
|
app.on('quit', () => {
|
||||||
console.log('Launching upgrade installer at', installerPath);
|
console.log('Launching upgrade installer at', installerPath);
|
||||||
|
@ -297,6 +312,10 @@ ipcMain.on('upgrade', (event, installerPath) => {
|
||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on('check-for-updates', () => {
|
||||||
|
autoUpdater.checkForUpdates();
|
||||||
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
autoUpdateDownloaded = true;
|
autoUpdateDownloaded = true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/from-entries": "^0.2.1",
|
"@ungap/from-entries": "^0.2.1",
|
||||||
"auto-launch": "^5.0.5",
|
"auto-launch": "^5.0.5",
|
||||||
"electron-dl": "^1.11.0",
|
"electron-dl": "^3.2.0",
|
||||||
"electron-log": "^2.2.12",
|
"electron-log": "^2.2.12",
|
||||||
"electron-notarize": "^1.0.0",
|
"electron-notarize": "^1.0.0",
|
||||||
"electron-updater": "^4.2.4",
|
"electron-updater": "^4.2.4",
|
||||||
|
@ -123,7 +123,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": "9.4.0",
|
"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",
|
||||||
|
|
22
ui/index.jsx
22
ui/index.jsx
|
@ -11,7 +11,14 @@ import * as MODALS from 'constants/modal_types';
|
||||||
import React, { Fragment, useState, useEffect } from 'react';
|
import React, { Fragment, useState, useEffect } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { doDaemonReady, doAutoUpdate, doOpenModal, doHideModal, doToggle3PAnalytics } from 'redux/actions/app';
|
import {
|
||||||
|
doDaemonReady,
|
||||||
|
doAutoUpdate,
|
||||||
|
doOpenModal,
|
||||||
|
doHideModal,
|
||||||
|
doToggle3PAnalytics,
|
||||||
|
doUpdateDownloadProgress,
|
||||||
|
} from 'redux/actions/app';
|
||||||
import { isURIValid } from 'util/lbryURI';
|
import { isURIValid } from 'util/lbryURI';
|
||||||
import { setSearchApi } from 'redux/actions/search';
|
import { setSearchApi } from 'redux/actions/search';
|
||||||
import { doSetLanguage, doFetchLanguage, doUpdateIsNightAsync } from 'redux/actions/settings';
|
import { doSetLanguage, doFetchLanguage, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||||
|
@ -107,6 +114,19 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||||
handleError();
|
handleError();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('download-progress-update', (e, p) => {
|
||||||
|
app.store.dispatch(doUpdateDownloadProgress(Math.round(p.percent * 100)));
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('download-update-complete', (e, c) => {
|
||||||
|
app.store.dispatch({
|
||||||
|
type: ACTIONS.UPGRADE_DOWNLOAD_COMPLETED,
|
||||||
|
data: {
|
||||||
|
path: c.path,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
ipcRenderer.on('language-set', (event, language) => {
|
ipcRenderer.on('language-set', (event, language) => {
|
||||||
app.store.dispatch(doSetLanguage(language));
|
app.store.dispatch(doSetLanguage(language));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// @if TARGET='app'
|
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
import { ipcRenderer, remote } from 'electron';
|
import { ipcRenderer, remote } from 'electron';
|
||||||
// @endif
|
|
||||||
import path from 'path';
|
|
||||||
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';
|
||||||
|
@ -33,7 +30,6 @@ import {
|
||||||
selectUpdateUrl,
|
selectUpdateUrl,
|
||||||
selectUpgradeDownloadItem,
|
selectUpgradeDownloadItem,
|
||||||
selectUpgradeDownloadPath,
|
selectUpgradeDownloadPath,
|
||||||
selectUpgradeFilename,
|
|
||||||
selectAutoUpdateDeclined,
|
selectAutoUpdateDeclined,
|
||||||
selectRemoteVersion,
|
selectRemoteVersion,
|
||||||
selectUpgradeTimer,
|
selectUpgradeTimer,
|
||||||
|
@ -50,12 +46,6 @@ import { doSignOutCleanup } from 'util/saved-passwords';
|
||||||
import { doNotificationSocketConnect } from 'redux/actions/websocket';
|
import { doNotificationSocketConnect } from 'redux/actions/websocket';
|
||||||
import { stringifyServerParam, shouldSetSetting } from 'util/sync-settings';
|
import { stringifyServerParam, shouldSetSetting } from 'util/sync-settings';
|
||||||
|
|
||||||
// @if TARGET='app'
|
|
||||||
const { autoUpdater } = remote.require('electron-updater');
|
|
||||||
const { download } = remote.require('electron-dl');
|
|
||||||
const Fs = remote.require('fs');
|
|
||||||
// @endif
|
|
||||||
|
|
||||||
const CHECK_UPGRADE_INTERVAL = 10 * 60 * 1000;
|
const CHECK_UPGRADE_INTERVAL = 10 * 60 * 1000;
|
||||||
|
|
||||||
export function doOpenModal(id, modalProps = {}) {
|
export function doOpenModal(id, modalProps = {}) {
|
||||||
|
@ -100,38 +90,14 @@ export function doStartUpgrade() {
|
||||||
|
|
||||||
export function doDownloadUpgrade() {
|
export function doDownloadUpgrade() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
// @if TARGET='app'
|
|
||||||
const state = getState();
|
const state = getState();
|
||||||
// Make a new directory within temp directory so the filename is guaranteed to be available
|
const url = selectUpdateUrl(state);
|
||||||
const dir = Fs.mkdtempSync(remote.app.getPath('temp') + path.sep);
|
ipcRenderer.send('download-upgrade', { url, options: {} });
|
||||||
const upgradeFilename = selectUpgradeFilename(state);
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
onProgress: (p) => dispatch(doUpdateDownloadProgress(Math.round(p * 100))),
|
|
||||||
directory: dir,
|
|
||||||
};
|
|
||||||
download(remote.getCurrentWindow(), selectUpdateUrl(state), options).then((downloadItem) => {
|
|
||||||
/**
|
|
||||||
* TODO: get the download path directly from the download object. It should just be
|
|
||||||
* downloadItem.getSavePath(), but the copy on the main process is being garbage collected
|
|
||||||
* too soon.
|
|
||||||
*/
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.UPGRADE_DOWNLOAD_COMPLETED,
|
|
||||||
data: {
|
|
||||||
downloadItem,
|
|
||||||
path: path.join(dir, upgradeFilename),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||||
});
|
});
|
||||||
dispatch(doHideModal());
|
dispatch(doHideModal());
|
||||||
dispatch(doOpenModal(MODALS.DOWNLOADING));
|
dispatch(doOpenModal(MODALS.DOWNLOADING));
|
||||||
// @endif
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +188,7 @@ export function doCheckUpgradeAvailable() {
|
||||||
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
|
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
|
||||||
|
|
||||||
if (!autoUpdateDeclined && !isDev) {
|
if (!autoUpdateDeclined && !isDev) {
|
||||||
autoUpdater.checkForUpdates();
|
ipcRenderer.send('check-for-updates');
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
32
yarn.lock
32
yarn.lock
|
@ -6005,13 +6005,14 @@ electron-devtools-installer@^3.1.1:
|
||||||
semver "^7.2.1"
|
semver "^7.2.1"
|
||||||
unzip-crx-3 "^0.2.0"
|
unzip-crx-3 "^0.2.0"
|
||||||
|
|
||||||
electron-dl@^1.11.0:
|
electron-dl@^3.2.0:
|
||||||
version "1.14.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron-dl/-/electron-dl-1.14.0.tgz#1466f1b945664ca3d784268307c2b935728177bf"
|
resolved "https://registry.yarnpkg.com/electron-dl/-/electron-dl-3.3.0.tgz#4e422e276c627373ba61fcf3f92ffa088988db1a"
|
||||||
|
integrity sha512-Zwaz/OMGPIfBLV2SQH4sTsdDOs/U4y5AOHfremMBXEpjIxX+SiTx845DZAvJJwgb5hfowyWOBLiJhd/emBNLLQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
ext-name "^5.0.0"
|
ext-name "^5.0.0"
|
||||||
pupa "^1.0.0"
|
pupa "^2.0.1"
|
||||||
unused-filename "^1.0.0"
|
unused-filename "^2.1.0"
|
||||||
|
|
||||||
electron-is-dev@^0.3.0:
|
electron-is-dev@^0.3.0:
|
||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
|
@ -6120,10 +6121,10 @@ electron-window-state@^4.1.1:
|
||||||
jsonfile "^2.2.3"
|
jsonfile "^2.2.3"
|
||||||
mkdirp "^0.5.1"
|
mkdirp "^0.5.1"
|
||||||
|
|
||||||
electron@9.4.0:
|
electron@11.5.0:
|
||||||
version "9.4.0"
|
version "11.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron/-/electron-9.4.0.tgz#c3c607e3598226ddbaaff8babcdffa8bb2210936"
|
resolved "https://registry.yarnpkg.com/electron/-/electron-11.5.0.tgz#f1650543b9d8f2047d3807755bdb120153ed210f"
|
||||||
integrity sha512-hOC4q0jkb+UDYZRy8vrZ1IANnq+jznZnbkD62OEo06nU+hIbp2IrwDRBNuSLmQ3cwZMVir0WSIA1qEVK0PkzGA==
|
integrity sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@electron/get" "^1.0.1"
|
"@electron/get" "^1.0.1"
|
||||||
"@types/node" "^12.0.12"
|
"@types/node" "^12.0.12"
|
||||||
|
@ -13134,10 +13135,6 @@ punycode@^2.1.0, punycode@^2.1.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
|
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
|
||||||
|
|
||||||
pupa@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/pupa/-/pupa-1.0.0.tgz#9a9568a5af7e657b8462a6e9d5328743560ceff6"
|
|
||||||
|
|
||||||
pupa@^2.0.1:
|
pupa@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.0.1.tgz#dbdc9ff48ffbea4a26a069b6f9f7abb051008726"
|
resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.0.1.tgz#dbdc9ff48ffbea4a26a069b6f9f7abb051008726"
|
||||||
|
@ -16278,12 +16275,13 @@ untildify@^4.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b"
|
resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b"
|
||||||
integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==
|
integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==
|
||||||
|
|
||||||
unused-filename@^1.0.0:
|
unused-filename@^2.1.0:
|
||||||
version "1.0.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/unused-filename/-/unused-filename-1.0.0.tgz#d340880f71ae2115ebaa1325bef05cc6684469c6"
|
resolved "https://registry.yarnpkg.com/unused-filename/-/unused-filename-2.1.0.tgz#33719c4e8d9644f32d2dec1bc8525c6aaeb4ba51"
|
||||||
|
integrity sha512-BMiNwJbuWmqCpAM1FqxCTD7lXF97AvfQC8Kr/DIeA6VtvhJaMDupZ82+inbjl5yVP44PcxOuCSxye1QMS0wZyg==
|
||||||
dependencies:
|
dependencies:
|
||||||
modify-filename "^1.1.0"
|
modify-filename "^1.1.0"
|
||||||
path-exists "^3.0.0"
|
path-exists "^4.0.0"
|
||||||
|
|
||||||
unzip-crx-3@^0.2.0:
|
unzip-crx-3@^0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
|
|
Loading…
Reference in a new issue