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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -239,7 +239,8 @@ export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint]; const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint];
function attemptPlay(cost, instantPurchaseMax = null) { 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 })); dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
} else { } else {
dispatch(doLoadVideo(uri, shouldRecordViewEvent)); dispatch(doLoadVideo(uri, shouldRecordViewEvent));
@ -248,10 +249,11 @@ export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
// we already fully downloaded the file. // we already fully downloaded the file.
if (fileInfo && fileInfo.completed) { 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 // file manually on their file system, so we need to dispatch a
// doLoadVideo action to reconstruct the file from the blobs // 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(); Promise.resolve();
return; return;

View file

@ -4073,14 +4073,6 @@ find-parent-dir@^0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" 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: find-root@^1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" 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" tar-stream "^1.6.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#84b7d396934d57a37802aadbef71db91230a9404: lbry-redux@lbryio/lbry-redux#42c185e922a7c6091b0e1580bacbfd8e02f45a91:
version "0.0.1" 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: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
lbry-redux@lbryio/lbry-redux#e94de324876185561b4f38b18fabb2aa58b8e3ed: lbry-redux@lbryio/lbry-redux#84b7d396934d57a37802aadbef71db91230a9404:
version "0.0.1" 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: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"