Test7495b2 #7629
17 changed files with 1195 additions and 987 deletions
0
.yarn/versions/6cb9d5fa.yml
vendored
Normal file
0
.yarn/versions/6cb9d5fa.yml
vendored
Normal file
|
@ -29,6 +29,10 @@
|
||||||
"from": "./static/font",
|
"from": "./static/font",
|
||||||
"to": "static/font",
|
"to": "static/font",
|
||||||
"filter": ["**/*"]
|
"filter": ["**/*"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": "./static/app-update.yml",
|
||||||
|
"to": "app-update.yml"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"publish": [
|
"publish": [
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { diskSpaceLinux, diskSpaceWindows, diskSpaceMac } from '../ui/util/disks
|
||||||
const { download } = require('electron-dl');
|
const { download } = require('electron-dl');
|
||||||
const remote = require('@electron/remote/main');
|
const remote = require('@electron/remote/main');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
const sudo = require('sudo-prompt');
|
||||||
|
|
||||||
remote.initialize();
|
remote.initialize();
|
||||||
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||||
|
@ -33,6 +34,7 @@ try {
|
||||||
upgradeDisabled = false;
|
upgradeDisabled = false;
|
||||||
}
|
}
|
||||||
autoUpdater.autoDownload = !upgradeDisabled;
|
autoUpdater.autoDownload = !upgradeDisabled;
|
||||||
|
autoUpdater.allowPrerelease = false;
|
||||||
|
|
||||||
// This is set to true if an auto update has been downloaded through the Electron
|
// This is set to true if an auto update has been downloaded through the Electron
|
||||||
// auto-update system and is ready to install. If the user declined an update earlier,
|
// auto-update system and is ready to install. If the user declined an update earlier,
|
||||||
|
@ -50,11 +52,9 @@ let showingAutoUpdateCloseAlert = false;
|
||||||
// https://www.electronjs.org/docs/latest/api/auto-updater#autoupdatercheckforupdates
|
// https://www.electronjs.org/docs/latest/api/auto-updater#autoupdatercheckforupdates
|
||||||
let keepCheckingForUpdates = true;
|
let keepCheckingForUpdates = true;
|
||||||
|
|
||||||
// Auto updater doesn't support Linux installations (only trough AppImages)
|
let downloadUpgradeInitiated = false;
|
||||||
// this is why, for that case, we download a full executable (.deb package)
|
|
||||||
// as a fallback support. This variable will be used to prevent
|
let downloadUpgradeItem;
|
||||||
// multiple downloads when auto updater isn't supported.
|
|
||||||
let downloadUpgradeInProgress = false;
|
|
||||||
|
|
||||||
// Keep a global reference, if you don't, they will be closed automatically when the JavaScript
|
// Keep a global reference, if you don't, they will be closed automatically when the JavaScript
|
||||||
// object is garbage collected.
|
// object is garbage collected.
|
||||||
|
@ -327,37 +327,74 @@ ipcMain.on('get-disk-space', async (event) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on('cancel-download-upgrade', () => {
|
||||||
|
if (downloadUpgradeItem) {
|
||||||
|
// Cancel the download and execute the onCancel
|
||||||
|
// callback set in the options.
|
||||||
|
downloadUpgradeItem.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on('download-upgrade', async (event, params) => {
|
ipcMain.on('download-upgrade', async (event, params) => {
|
||||||
if (downloadUpgradeInProgress) {
|
// Prevent downloading multiple times.
|
||||||
|
if (downloadUpgradeInitiated || downloadUpgradeItem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { url, options } = params;
|
const { url, options } = params;
|
||||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||||
|
|
||||||
|
downloadUpgradeInitiated = true;
|
||||||
|
|
||||||
|
// Grab the download item's handler to allow
|
||||||
|
// cancelling the operation if required.
|
||||||
|
options.onStarted = function(downloadItem) {
|
||||||
|
downloadUpgradeItem = downloadItem;
|
||||||
|
};
|
||||||
|
options.onCancel = function() {
|
||||||
|
downloadUpgradeItem = undefined;
|
||||||
|
downloadUpgradeInitiated = false;
|
||||||
|
};
|
||||||
options.onProgress = function(p) {
|
options.onProgress = function(p) {
|
||||||
rendererWindow.webContents.send('download-progress-update', p);
|
rendererWindow.webContents.send('download-progress-update', p);
|
||||||
};
|
};
|
||||||
options.directory = dir;
|
options.directory = dir;
|
||||||
options.onCompleted = function(c) {
|
options.onCompleted = function(c) {
|
||||||
downloadUpgradeInProgress = false;
|
downloadUpgradeInitiated = false;
|
||||||
|
downloadUpgradeItem = undefined;
|
||||||
rendererWindow.webContents.send('download-update-complete', c);
|
rendererWindow.webContents.send('download-update-complete', c);
|
||||||
};
|
};
|
||||||
const win = BrowserWindow.getFocusedWindow();
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
downloadUpgradeInProgress = true;
|
|
||||||
await download(win, url, options).catch(e => console.log('e', e));
|
await download(win, url, options).catch(e => console.log('e', e));
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('upgrade', (event, installerPath) => {
|
ipcMain.on('upgrade', (event, installerPath) => {
|
||||||
|
// what to do if no shutdown in a long time?
|
||||||
|
console.log('Update downloaded to', installerPath);
|
||||||
|
console.log('The app will close and you will be prompted to install the latest version of LBRY.');
|
||||||
|
console.log('After the install is complete, please reopen the app.');
|
||||||
|
|
||||||
|
// Prevent .deb package from opening with archive manager (Ubuntu >= 20)
|
||||||
|
if (process.platform === 'linux' && !process.env.APPIMAGE) {
|
||||||
|
sudo.exec(`dpkg -i ${installerPath}`, { name: app.name }, (err, stdout, stderr) => {
|
||||||
|
if (err || stderr) {
|
||||||
|
rendererWindow.webContents.send('upgrade-installing-error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-launch the application when the installation finishes.
|
||||||
|
app.relaunch();
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
app.on('quit', () => {
|
app.on('quit', () => {
|
||||||
console.log('Launching upgrade installer at', installerPath);
|
console.log('Launching upgrade installer at', installerPath);
|
||||||
// This gets triggered called after *all* other quit-related events, so
|
// This gets triggered called after *all* other quit-related events, so
|
||||||
// we'll only get here if we're fully prepared and quitting for real.
|
// we'll only get here if we're fully prepared and quitting for real.
|
||||||
shell.openPath(installerPath);
|
shell.openPath(installerPath);
|
||||||
});
|
});
|
||||||
// what to do if no shutdown in a long time?
|
|
||||||
console.log('Update downloaded to', installerPath);
|
|
||||||
console.log('The app will close and you will be prompted to install the latest version of LBRY.');
|
|
||||||
console.log('After the install is complete, please reopen the app.');
|
|
||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lbry",
|
"name": "lbry",
|
||||||
"version": "0.53.4",
|
"version": "0.53.5-alpha.test7495b2",
|
||||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"lbry"
|
"lbry"
|
||||||
|
@ -67,6 +67,7 @@
|
||||||
"remove-markdown": "^0.3.0",
|
"remove-markdown": "^0.3.0",
|
||||||
"rss": "^1.2.2",
|
"rss": "^1.2.2",
|
||||||
"source-map-explorer": "^2.5.2",
|
"source-map-explorer": "^2.5.2",
|
||||||
|
"sudo-prompt": "^9.2.1",
|
||||||
"tempy": "^0.6.0",
|
"tempy": "^0.6.0",
|
||||||
"videojs-logo": "^2.1.4"
|
"videojs-logo": "^2.1.4"
|
||||||
},
|
},
|
||||||
|
@ -243,5 +244,6 @@
|
||||||
"lbrynetDaemonDir": "static/daemon",
|
"lbrynetDaemonDir": "static/daemon",
|
||||||
"lbrynetDaemonFileName": "lbrynet"
|
"lbrynetDaemonFileName": "lbrynet"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@3.2.0"
|
"packageManager": "yarn@3.2.0",
|
||||||
|
"stableVersion": "0.53.4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2312,5 +2312,7 @@
|
||||||
"Free --[legend, unused disk space]--": "Free",
|
"Free --[legend, unused disk space]--": "Free",
|
||||||
"Top content in %language%": "Top content in %language%",
|
"Top content in %language%": "Top content in %language%",
|
||||||
"Apply": "Apply",
|
"Apply": "Apply",
|
||||||
|
"Installing, please wait...": "Installing, please wait...",
|
||||||
|
"There was an error during installation. Please, try again.": "There was an error during installation. Please, try again.",
|
||||||
"--end--": "--end--"
|
"--end--": "--end--"
|
||||||
}
|
}
|
||||||
|
|
3
static/app-update.yml
Normal file
3
static/app-update.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
owner: lbryio
|
||||||
|
repo: lbry-desktop
|
||||||
|
provider: github
|
|
@ -7,6 +7,7 @@ import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
||||||
import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from 'redux/actions/claims';
|
import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from 'redux/actions/claims';
|
||||||
import { selectMyChannelUrls, selectMyChannelClaimIds } from 'redux/selectors/claims';
|
import { selectMyChannelUrls, selectMyChannelClaimIds } from 'redux/selectors/claims';
|
||||||
import * as SETTINGS from 'constants/settings';
|
import * as SETTINGS from 'constants/settings';
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import {
|
import {
|
||||||
makeSelectClientSetting,
|
makeSelectClientSetting,
|
||||||
|
@ -24,7 +25,7 @@ import {
|
||||||
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
||||||
import { doSyncLoop } from 'redux/actions/sync';
|
import { doSyncLoop } from 'redux/actions/sync';
|
||||||
import {
|
import {
|
||||||
doDownloadUpgradeRequested,
|
doOpenModal,
|
||||||
doSignIn,
|
doSignIn,
|
||||||
doGetAndPopulatePreferences,
|
doGetAndPopulatePreferences,
|
||||||
doSetActiveChannel,
|
doSetActiveChannel,
|
||||||
|
@ -60,7 +61,7 @@ const perform = (dispatch) => ({
|
||||||
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
|
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
|
||||||
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
||||||
signIn: () => dispatch(doSignIn()),
|
signIn: () => dispatch(doSignIn()),
|
||||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
requestDownloadUpgrade: () => dispatch(doOpenModal(MODALS.UPGRADE)),
|
||||||
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
|
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
|
||||||
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
|
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
|
||||||
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
|
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { selectRemoteVersion } from 'redux/selectors/app';
|
||||||
import LastReleaseChanges from './view';
|
import LastReleaseChanges from './view';
|
||||||
|
|
||||||
export default LastReleaseChanges;
|
const select = (state) => ({
|
||||||
|
releaseVersion: selectRemoteVersion(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = {};
|
||||||
|
|
||||||
|
export default connect(select, perform)(LastReleaseChanges);
|
||||||
|
|
|
@ -5,11 +5,12 @@ import Button from 'component/button';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
releaseVersion: string,
|
||||||
hideReleaseVersion?: boolean,
|
hideReleaseVersion?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
const LastReleaseChanges = (props: Props) => {
|
const LastReleaseChanges = (props: Props) => {
|
||||||
const { hideReleaseVersion } = props;
|
const { hideReleaseVersion, releaseVersion } = props;
|
||||||
const [releaseTag, setReleaseTag] = useState('');
|
const [releaseTag, setReleaseTag] = useState('');
|
||||||
const [releaseChanges, setReleaseChanges] = useState('');
|
const [releaseChanges, setReleaseChanges] = useState('');
|
||||||
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
|
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
|
||||||
|
@ -35,7 +36,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest';
|
const lastReleaseUrl = `https://api.github.com/repos/lbryio/lbry-desktop/releases/tags/${releaseVersion}`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: { Accept: 'application/vnd.github.v3+json' },
|
headers: { Accept: 'application/vnd.github.v3+json' },
|
||||||
|
@ -54,7 +55,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||||
setFetchingReleaseChanges(false);
|
setFetchingReleaseChanges(false);
|
||||||
setFetchReleaseFailed(true);
|
setFetchReleaseFailed(true);
|
||||||
});
|
});
|
||||||
}, []);
|
}, [releaseVersion, setFetchingReleaseChanges, setReleaseTag, setReleaseChanges, setFetchReleaseFailed]);
|
||||||
|
|
||||||
if (fetchingReleaseChanges) {
|
if (fetchingReleaseChanges) {
|
||||||
return <p>{__('Loading...')}</p>;
|
return <p>{__('Loading...')}</p>;
|
||||||
|
|
|
@ -45,6 +45,8 @@ export const DOWNLOAD_UPGRADE = 'DOWNLOAD_UPGRADE';
|
||||||
export const UPGRADE_DOWNLOAD_STARTED = 'UPGRADE_DOWNLOAD_STARTED';
|
export const UPGRADE_DOWNLOAD_STARTED = 'UPGRADE_DOWNLOAD_STARTED';
|
||||||
export const UPGRADE_DOWNLOAD_COMPLETED = 'UPGRADE_DOWNLOAD_COMPLETED';
|
export const UPGRADE_DOWNLOAD_COMPLETED = 'UPGRADE_DOWNLOAD_COMPLETED';
|
||||||
export const UPGRADE_DOWNLOAD_PROGRESSED = 'UPGRADE_DOWNLOAD_PROGRESSED';
|
export const UPGRADE_DOWNLOAD_PROGRESSED = 'UPGRADE_DOWNLOAD_PROGRESSED';
|
||||||
|
export const UPGRADE_INIT_INSTALL = 'UPGRADE_INIT_INSTALL';
|
||||||
|
export const UPGRADE_INSTALL_ERROR = 'UPGRADE_INSTALL_ERROR';
|
||||||
export const CHECK_UPGRADE_AVAILABLE = 'CHECK_UPGRADE_AVAILABLE';
|
export const CHECK_UPGRADE_AVAILABLE = 'CHECK_UPGRADE_AVAILABLE';
|
||||||
export const CHECK_UPGRADE_START = 'CHECK_UPGRADE_START';
|
export const CHECK_UPGRADE_START = 'CHECK_UPGRADE_START';
|
||||||
export const CHECK_UPGRADE_SUCCESS = 'CHECK_UPGRADE_SUCCESS';
|
export const CHECK_UPGRADE_SUCCESS = 'CHECK_UPGRADE_SUCCESS';
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {
|
||||||
doToggle3PAnalytics,
|
doToggle3PAnalytics,
|
||||||
doUpdateDownloadProgress,
|
doUpdateDownloadProgress,
|
||||||
doNotifyUpdateAvailable,
|
doNotifyUpdateAvailable,
|
||||||
|
doShowUpgradeInstallationError,
|
||||||
} from 'redux/actions/app';
|
} 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';
|
||||||
|
@ -132,6 +133,10 @@ autoUpdater.on('update-available', (e) => {
|
||||||
app.store.dispatch(doNotifyUpdateAvailable(e));
|
app.store.dispatch(doNotifyUpdateAvailable(e));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('upgrade-installing-error', () => {
|
||||||
|
app.store.dispatch(doShowUpgradeInstallationError());
|
||||||
|
});
|
||||||
|
|
||||||
ipcRenderer.on('download-progress-update', (e, p) => {
|
ipcRenderer.on('download-progress-update', (e, p) => {
|
||||||
app.store.dispatch(doUpdateDownloadProgress(Math.round(p.percent * 100)));
|
app.store.dispatch(doUpdateDownloadProgress(Math.round(p.percent * 100)));
|
||||||
});
|
});
|
||||||
|
@ -208,6 +213,8 @@ function AppWrapper() {
|
||||||
const enabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
|
const enabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
autoUpdater.allowPrerelease = true;
|
autoUpdater.allowPrerelease = true;
|
||||||
|
} else {
|
||||||
|
autoUpdater.allowPrerelease = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [persistDone]);
|
}, [persistDone]);
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doStartUpgrade, doCancelUpgrade, doHideModal } from 'redux/actions/app';
|
import { doStartUpgrade, doCancelUpgrade, doHideModal } from 'redux/actions/app';
|
||||||
import { selectDownloadProgress, selectDownloadComplete, selectUpgradeDownloadPath } from 'redux/selectors/app';
|
import {
|
||||||
|
selectDownloadProgress,
|
||||||
|
selectDownloadComplete,
|
||||||
|
selectUpgradeDownloadPath,
|
||||||
|
selectUpgradeInitialized,
|
||||||
|
selectUpgradeFailedInstallation,
|
||||||
|
} from 'redux/selectors/app';
|
||||||
import ModalDownloading from './view';
|
import ModalDownloading from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = (state) => ({
|
||||||
downloadProgress: selectDownloadProgress(state),
|
downloadProgress: selectDownloadProgress(state),
|
||||||
downloadComplete: selectDownloadComplete(state),
|
downloadComplete: selectDownloadComplete(state),
|
||||||
downloadItem: selectUpgradeDownloadPath(state),
|
downloadItem: selectUpgradeDownloadPath(state),
|
||||||
|
upgradeInitialized: selectUpgradeInitialized(state),
|
||||||
|
failedInstallation: selectUpgradeFailedInstallation(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = (dispatch) => ({
|
||||||
startUpgrade: () => dispatch(doStartUpgrade()),
|
startUpgrade: () => dispatch(doStartUpgrade()),
|
||||||
cancelUpgrade: () => {
|
cancelUpgrade: () => {
|
||||||
dispatch(doHideModal());
|
dispatch(doHideModal());
|
||||||
|
@ -17,7 +25,4 @@ const perform = dispatch => ({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(select, perform)(ModalDownloading);
|
||||||
select,
|
|
||||||
perform
|
|
||||||
)(ModalDownloading);
|
|
||||||
|
|
|
@ -10,11 +10,21 @@ type Props = {
|
||||||
downloadItem: string,
|
downloadItem: string,
|
||||||
startUpgrade: () => void,
|
startUpgrade: () => void,
|
||||||
cancelUpgrade: () => void,
|
cancelUpgrade: () => void,
|
||||||
|
upgradeInitialized: boolean,
|
||||||
|
failedInstallation: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModalDownloading extends React.PureComponent<Props> {
|
class ModalDownloading extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { downloadProgress, downloadComplete, downloadItem, startUpgrade, cancelUpgrade } = this.props;
|
const {
|
||||||
|
downloadProgress,
|
||||||
|
downloadComplete,
|
||||||
|
downloadItem,
|
||||||
|
startUpgrade,
|
||||||
|
cancelUpgrade,
|
||||||
|
upgradeInitialized,
|
||||||
|
failedInstallation,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal title={__('Downloading update')} isOpen contentLabel={__('Downloading update')} type="custom">
|
<Modal title={__('Downloading update')} isOpen contentLabel={__('Downloading update')} type="custom">
|
||||||
|
@ -40,9 +50,18 @@ class ModalDownloading extends React.PureComponent<Props> {
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{failedInstallation && <p>{__('There was an error during installation. Please, try again.')}</p>}
|
||||||
|
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
{downloadComplete ? <Button button="primary" label={__('Begin Upgrade')} onClick={startUpgrade} /> : null}
|
{downloadComplete ? (
|
||||||
<Button button="link" label={__('Cancel')} onClick={cancelUpgrade} />
|
<Button
|
||||||
|
disabled={upgradeInitialized}
|
||||||
|
button="primary"
|
||||||
|
label={__(upgradeInitialized ? 'Installing, please wait...' : 'Begin Upgrade')}
|
||||||
|
onClick={startUpgrade}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
<Button disabled={upgradeInitialized} button="link" label={__('Cancel')} onClick={cancelUpgrade} />
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,6 @@ import {
|
||||||
import {
|
import {
|
||||||
selectIsUpgradeSkipped,
|
selectIsUpgradeSkipped,
|
||||||
selectUpdateUrl,
|
selectUpdateUrl,
|
||||||
selectUpgradeDownloadItem,
|
|
||||||
selectUpgradeDownloadPath,
|
selectUpgradeDownloadPath,
|
||||||
selectAutoUpdateDeclined,
|
selectAutoUpdateDeclined,
|
||||||
selectRemoteVersion,
|
selectRemoteVersion,
|
||||||
|
@ -85,6 +84,15 @@ export function doStartUpgrade() {
|
||||||
const upgradeDownloadPath = selectUpgradeDownloadPath(state);
|
const upgradeDownloadPath = selectUpgradeDownloadPath(state);
|
||||||
|
|
||||||
ipcRenderer.send('upgrade', upgradeDownloadPath);
|
ipcRenderer.send('upgrade', upgradeDownloadPath);
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.UPGRADE_INIT_INSTALL,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doShowUpgradeInstallationError() {
|
||||||
|
return {
|
||||||
|
type: ACTIONS.UPGRADE_INSTALL_ERROR,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,25 +162,8 @@ export function doAutoUpdateDeclined() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doCancelUpgrade() {
|
export function doCancelUpgrade() {
|
||||||
return (dispatch, getState) => {
|
ipcRenderer.send('cancel-download-upgrade');
|
||||||
const state = getState();
|
return { type: ACTIONS.UPGRADE_CANCELLED };
|
||||||
const upgradeDownloadItem = selectUpgradeDownloadItem(state);
|
|
||||||
|
|
||||||
if (upgradeDownloadItem) {
|
|
||||||
/*
|
|
||||||
* Right now the remote reference to the download item gets garbage collected as soon as the
|
|
||||||
* the download is over (maybe even earlier), so trying to cancel a finished download may
|
|
||||||
* throw an error.
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
upgradeDownloadItem.cancel();
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err); // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch({ type: ACTIONS.UPGRADE_CANCELLED });
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doCheckUpgradeAvailable() {
|
export function doCheckUpgradeAvailable() {
|
||||||
|
|
|
@ -67,6 +67,8 @@ const defaultState: AppState = {
|
||||||
modalsAllowed: true,
|
modalsAllowed: true,
|
||||||
hasClickedComment: false,
|
hasClickedComment: false,
|
||||||
downloadProgress: undefined,
|
downloadProgress: undefined,
|
||||||
|
upgradeInitialized: false,
|
||||||
|
upgradeFailedInstallation: false,
|
||||||
upgradeDownloading: undefined,
|
upgradeDownloading: undefined,
|
||||||
upgradeDownloadComplete: undefined,
|
upgradeDownloadComplete: undefined,
|
||||||
checkUpgradeTimer: undefined,
|
checkUpgradeTimer: undefined,
|
||||||
|
@ -162,6 +164,18 @@ reducers[ACTIONS.UPGRADE_DOWNLOAD_STARTED] = (state) =>
|
||||||
upgradeDownloading: true,
|
upgradeDownloading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.UPGRADE_INIT_INSTALL] = (state) =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
upgradeInitialized: true,
|
||||||
|
upgradeFailedInstallation: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.UPGRADE_INSTALL_ERROR] = (state) =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
upgradeInitialized: false,
|
||||||
|
upgradeFailedInstallation: true,
|
||||||
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.CHANGE_MODALS_ALLOWED] = (state, action) =>
|
reducers[ACTIONS.CHANGE_MODALS_ALLOWED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
modalsAllowed: action.data.modalsAllowed,
|
modalsAllowed: action.data.modalsAllowed,
|
||||||
|
|
|
@ -6,12 +6,20 @@ export const selectState = (state) => state.app || {};
|
||||||
|
|
||||||
export const selectPlatform = createSelector(selectState, (state) => state.platform);
|
export const selectPlatform = createSelector(selectState, (state) => state.platform);
|
||||||
|
|
||||||
export const selectUpdateUrl = createSelector(selectPlatform, (platform) => {
|
export const selectRemoteVersion = createSelector(selectState, (state) => state.remoteVersion);
|
||||||
|
|
||||||
|
export const selectUpdateUrl = createSelector(selectPlatform, selectRemoteVersion, (platform, releaseVersion) => {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return 'https://lbry.com/get/lbry.dmg';
|
return 'https://lbry.com/get/lbry.dmg';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return 'https://lbry.com/get/lbry.deb';
|
// releaseVersion can be used as the tag name
|
||||||
|
// Example: v0.53.5-alpha.test7495b
|
||||||
|
// When downloading, we need to remove the initial
|
||||||
|
// v, ending up with a file name like
|
||||||
|
// LBRY_0.53.5-alpha.test7495b.deb
|
||||||
|
const fileName = 'LBRY_' + (releaseVersion || '').replace('v', '') + '.deb';
|
||||||
|
return `https://github.com/lbryio/lbry-desktop/releases/download/${releaseVersion}/${fileName}`;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return 'https://lbry.com/get/lbry.exe';
|
return 'https://lbry.com/get/lbry.exe';
|
||||||
default:
|
default:
|
||||||
|
@ -21,10 +29,12 @@ export const selectUpdateUrl = createSelector(selectPlatform, (platform) => {
|
||||||
|
|
||||||
export const selectHasClickedComment = createSelector(selectState, (state) => state.hasClickedComment);
|
export const selectHasClickedComment = createSelector(selectState, (state) => state.hasClickedComment);
|
||||||
|
|
||||||
export const selectRemoteVersion = createSelector(selectState, (state) => state.remoteVersion);
|
|
||||||
|
|
||||||
export const selectIsUpgradeAvailable = createSelector(selectState, (state) => state.isUpgradeAvailable);
|
export const selectIsUpgradeAvailable = createSelector(selectState, (state) => state.isUpgradeAvailable);
|
||||||
|
|
||||||
|
export const selectUpgradeInitialized = createSelector(selectState, (state) => state.upgradeInitialized);
|
||||||
|
|
||||||
|
export const selectUpgradeFailedInstallation = createSelector(selectState, (state) => state.upgradeFailedInstallation);
|
||||||
|
|
||||||
export const selectUpgradeFilename = createSelector(selectPlatform, selectRemoteVersion, (platform, version) => {
|
export const selectUpgradeFilename = createSelector(selectPlatform, selectRemoteVersion, (platform, version) => {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
|
@ -46,8 +56,6 @@ export const selectIsUpgradeSkipped = createSelector(selectState, (state) => sta
|
||||||
|
|
||||||
export const selectUpgradeDownloadPath = createSelector(selectState, (state) => state.downloadPath);
|
export const selectUpgradeDownloadPath = createSelector(selectState, (state) => state.downloadPath);
|
||||||
|
|
||||||
export const selectUpgradeDownloadItem = createSelector(selectState, (state) => state.downloadItem);
|
|
||||||
|
|
||||||
export const selectAutoUpdateDownloaded = createSelector(selectState, (state) => state.autoUpdateDownloaded);
|
export const selectAutoUpdateDownloaded = createSelector(selectState, (state) => state.autoUpdateDownloaded);
|
||||||
|
|
||||||
export const selectAutoUpdateDeclined = createSelector(selectState, (state) => state.autoUpdateDeclined);
|
export const selectAutoUpdateDeclined = createSelector(selectState, (state) => state.autoUpdateDeclined);
|
||||||
|
|
Loading…
Reference in a new issue