maint: upgrade sdk to 0.32.0

This commit is contained in:
Sean Yesmunt 2019-02-18 12:33:02 -05:00
parent 7d8f83b0b6
commit 08f48f3868
12 changed files with 85 additions and 66 deletions

View file

@ -1,6 +1,6 @@
{
"name": "LBRY",
"version": "0.28.0",
"version": "0.29.0-rc.0",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"keywords": [
"lbry"
@ -25,6 +25,7 @@
"build": "yarn compile && electron-builder build",
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
"dev": "electron-webpack dev",
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev",
"lint": "eslint 'src/**/*.{js,jsx}' --fix && flow",
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
"flow-defs": "flow-typed install",
@ -47,12 +48,11 @@
"electron-updater": "^2.23.3",
"electron-window-state": "^4.1.1",
"express": "^4.16.4",
"find-process": "^1.1.0",
"formik": "^0.10.4",
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#e94de324876185561b4f38b18fabb2aa58b8e3ed",
"lbry-redux": "lbryio/lbry-redux#42c185e922a7c6091b0e1580bacbfd8e02f45a91",
"lbryinc": "lbryio/lbryinc#60d80401891743f991c040bafa8e51da7e939777",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",
@ -134,7 +134,7 @@
"yarn": "^1.3"
},
"lbrySettings": {
"lbrynetDaemonVersion": "0.31.0",
"lbrynetDaemonVersion": "0.32.0",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
"lbrynetDaemonDir": "static/daemon",
"lbrynetDaemonFileName": "lbrynet"

View file

@ -1,6 +1,7 @@
/* eslint-disable no-console */
import path from 'path';
import { spawn, execSync } from 'child_process';
import { Lbry } from 'lbry-redux';
export default class Daemon {
static path = process.env.LBRY_DAEMON || path.join(__static, 'daemon/lbrynet');
@ -21,15 +22,19 @@ export default class Daemon {
}
quit() {
if (process.platform === 'win32') {
try {
execSync(`taskkill /pid ${this.subprocess.pid} /t /f`);
} catch (error) {
console.error(error.message);
}
} else {
this.subprocess.kill();
}
Lbry.stop()
.then()
.catch(() => {
if (process.platform === 'win32') {
try {
execSync(`taskkill /pid ${this.subprocess.pid} /t /f`);
} catch (error) {
console.error(error.message);
}
} else {
this.subprocess.kill();
}
});
}
// Follows the publish/subscribe pattern

View file

@ -2,12 +2,12 @@
// Module imports
import keytar from 'keytar';
import SemVer from 'semver';
import findProcess from 'find-process';
import url from 'url';
import https from 'https';
import { app, dialog, ipcMain, session, shell } from 'electron';
import { autoUpdater } from 'electron-updater';
import isDev from 'electron-is-dev';
import { Lbry } from 'lbry-redux';
import Daemon from './Daemon';
import createTray from './createTray';
import createWindow from './createWindow';
@ -65,10 +65,15 @@ if (isDev) {
}
app.on('ready', async () => {
// Windows WMIC returns lbrynet start with 2 spaces. https://github.com/yibn2008/find-process/issues/18
const processListArgs = process.platform === 'win32' ? 'lbrynet start' : 'lbrynet start';
const processList = await findProcess('name', processListArgs);
const isDaemonRunning = processList.length > 0;
let isDaemonRunning = false;
await Lbry.status()
.then(() => {
isDaemonRunning = true;
console.log('SDK already running');
})
.catch(() => {
console.log('Starting SDK');
});
if (!isDaemonRunning) {
daemon = new Daemon();
@ -226,20 +231,24 @@ ipcMain.on('version-info-requested', () => {
res.on('end', () => {
const tagName = JSON.parse(result).tag_name;
const [, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
if (!remoteVersion) {
if (rendererWindow) {
rendererWindow.webContents.send('version-info-received', null);
}
} else {
const upgradeAvailable = SemVer.gt(formatRc(remoteVersion), formatRc(localVersion));
if (rendererWindow) {
rendererWindow.webContents.send('version-info-received', {
remoteVersion,
localVersion,
upgradeAvailable,
});
if (tagName) {
const [, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
if (!remoteVersion) {
if (rendererWindow) {
rendererWindow.webContents.send('version-info-received', localVersion);
}
} else {
const upgradeAvailable = SemVer.gt(formatRc(remoteVersion), formatRc(localVersion));
if (rendererWindow) {
rendererWindow.webContents.send('version-info-received', {
remoteVersion,
localVersion,
upgradeAvailable,
});
}
}
} else if (rendererWindow) {
rendererWindow.webContents.send('version-info-received', localVersion);
}
});
};

View file

@ -45,7 +45,8 @@ class ChannelTile extends React.PureComponent<Props> {
subscriptionUri = `lbry://${claim.permanent_url}`;
}
const onClick = () => navigate('/show', { uri });
const onClick = () =>
channelName ? navigate('/show', { uri, page: 1 }) : navigate('/show', { uri });
return (
<section

View file

@ -71,7 +71,7 @@ class FileDownloadLink extends React.PureComponent<Props> {
: __('Connecting...');
return <span className="file-download">{label}</span>;
} else if (fileInfo === null && !downloading) {
} else if ((fileInfo === null && !downloading) || (fileInfo && !fileInfo.download_path)) {
if (!costInfo) {
return null;
}

View file

@ -136,7 +136,7 @@ class FileViewer extends React.PureComponent<Props> {
if (playable && costInfo && costInfo.cost === 0 && !fileInfo && !isDownloading) {
this.playContent();
} else if (playable && fileInfo && fileInfo.blobs_completed > 0) {
} else if (playable && fileInfo && fileInfo.download_path && fileInfo.written_bytes > 0) {
this.playContent();
}
};
@ -221,12 +221,12 @@ class FileViewer extends React.PureComponent<Props> {
} = this.props;
const isPlaying = playingUri === uri;
const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0;
const isReadyToPlay = fileInfo && fileInfo.download_path && fileInfo.written_bytes > 0;
const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw;
let loadStatusMessage = '';
if (fileInfo && fileInfo.completed && !fileInfo.written_bytes) {
if (fileInfo && fileInfo.completed && (!fileInfo.download_path || !fileInfo.written_bytes)) {
loadStatusMessage = __(
"It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds."
);

View file

@ -133,7 +133,7 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
this.adjustErrorTimeout();
}
Lbry.resolve({ uri: 'lbry://one' }).then(() => {
Lbry.resolve({ urls: 'lbry://one' }).then(() => {
this.setState({ isRunning: true }, () => this.continueAppLaunch());
});

View file

@ -1,8 +1,10 @@
import { connect } from 'react-redux';
import { PAGE_SIZE } from 'constants/claim';
import {
doResolveUri,
makeSelectClaimForUri,
makeSelectIsUriResolving,
makeSelectTotalPagesForChannel,
selectBlackListedOutpoints,
} from 'lbry-redux';
import ShowPage from './view';
@ -11,6 +13,7 @@ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state),
});
const perform = dispatch => ({

View file

@ -12,6 +12,7 @@ type Props = {
resolveUri: string => void,
uri: string,
claim: Claim,
totalPages: number,
blackListedOutpoints: Array<{
txid: string,
nout: number,
@ -26,9 +27,12 @@ class ShowPage extends React.PureComponent<Props> {
}
componentWillReceiveProps(nextProps: Props) {
const { isResolvingUri, resolveUri, claim, uri } = nextProps;
if (!isResolvingUri && claim === undefined && uri) {
const { isResolvingUri, resolveUri, claim, uri, totalPages } = nextProps;
if (
!isResolvingUri &&
uri &&
(claim === undefined || (claim.name[0] === '@' && totalPages === undefined))
) {
resolveUri(uri);
}
}

View file

@ -330,17 +330,20 @@ export function doQuit() {
export function doQuitAnyDaemon() {
return dispatch => {
try {
if (process.platform === 'win32') {
execSync('taskkill /im lbrynet-daemon.exe /t /f');
} else {
execSync('pkill lbrynet-daemon');
}
} catch (error) {
dispatch(doAlertError(`Quitting daemon failed due to: ${error.message}`));
} finally {
dispatch(doQuit());
}
Lbry.stop()
.then()
.catch(() => {
try {
if (process.platform === 'win32') {
execSync('taskkill /im lbrynet.exe /t /f');
} else {
execSync('pkill lbrynet');
}
} catch (error) {
dispatch(doAlertError(`Quitting daemon failed due to: ${error.message}`));
}
});
dispatch(doQuit());
};
}

View file

@ -239,7 +239,8 @@ export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint];
function attemptPlay(cost, instantPurchaseMax = null) {
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
// If you have a file entry with correct manifest, you won't pay for the key fee again
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax) && !fileInfo) {
dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
} else {
dispatch(doLoadVideo(uri, shouldRecordViewEvent));
@ -248,10 +249,11 @@ export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
// we already fully downloaded the file.
if (fileInfo && fileInfo.completed) {
// If written_bytes is false that means the user has deleted/moved the
// If path is null or bytes written is 0 means the user has deleted/moved the
// file manually on their file system, so we need to dispatch a
// doLoadVideo action to reconstruct the file from the blobs
if (!fileInfo.written_bytes) dispatch(doLoadVideo(uri, shouldRecordViewEvent));
if (!fileInfo.download_path || !fileInfo.written_bytes)
dispatch(doLoadVideo(uri, shouldRecordViewEvent));
Promise.resolve();
return;

View file

@ -4073,14 +4073,6 @@ find-parent-dir@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54"
find-process@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/find-process/-/find-process-1.1.1.tgz#57fb1adbc7f4304786db720a49febd708a3162d4"
dependencies:
chalk "^2.0.1"
commander "^2.11.0"
debug "^2.6.8"
find-root@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4"
@ -5668,17 +5660,17 @@ lazy-val@^1.0.3:
tar-stream "^1.6.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#84b7d396934d57a37802aadbef71db91230a9404:
lbry-redux@lbryio/lbry-redux#42c185e922a7c6091b0e1580bacbfd8e02f45a91:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/84b7d396934d57a37802aadbef71db91230a9404"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/42c185e922a7c6091b0e1580bacbfd8e02f45a91"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"
lbry-redux@lbryio/lbry-redux#e94de324876185561b4f38b18fabb2aa58b8e3ed:
lbry-redux@lbryio/lbry-redux#84b7d396934d57a37802aadbef71db91230a9404:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/e94de324876185561b4f38b18fabb2aa58b8e3ed"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/84b7d396934d57a37802aadbef71db91230a9404"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"