From a6709ffc266c9d39c5098d42e412a7582fb83c24 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Sun, 28 May 2017 17:01:11 +0400 Subject: [PATCH 01/12] Try to only keep one copy of each claim in the store --- ui/js/actions/content.js | 6 +++--- ui/js/actions/file_info.js | 4 ++-- ui/js/constants/action_types.js | 4 ++-- ui/js/reducers/claims.js | 25 +++++++++++++++++++------ ui/js/reducers/file_info.js | 4 +++- ui/js/selectors/claims.js | 19 +++++++++++-------- 6 files changed, 40 insertions(+), 22 deletions(-) diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js index e09bd5ea1..a52634bca 100644 --- a/ui/js/actions/content.js +++ b/ui/js/actions/content.js @@ -274,16 +274,16 @@ export function doFetchClaimsByChannel(uri) { } } -export function doClaimListMine() { +export function doFetchClaimListMine() { return function(dispatch, getState) { dispatch({ - type: types.CLAIM_LIST_MINE_STARTED + type: types.FETCH_CLAIM_LIST_MINE_STARTED }) lbry.claim_list_mine().then((claims) => { dispatch({ - type: types.CLAIM_LIST_MINE_COMPLETED, + type: types.FETCH_CLAIM_LIST_MINE_COMPLETED, data: { claims } diff --git a/ui/js/actions/file_info.js b/ui/js/actions/file_info.js index 23ba50e71..44d76885c 100644 --- a/ui/js/actions/file_info.js +++ b/ui/js/actions/file_info.js @@ -1,7 +1,7 @@ import * as types from 'constants/action_types' import lbry from 'lbry' import { - doClaimListMine + doFetchClaimListMine } from 'actions/content' import { selectClaimsByUri, @@ -110,7 +110,7 @@ export function doFetchFileInfosAndPublishedClaims() { isFileInfoListPending = selectFileListIsPending(state) if (isClaimListMinePending === undefined) { - dispatch(doClaimListMine()) + dispatch(doFetchClaimListMine()) } if (isFileInfoListPending === undefined) { diff --git a/ui/js/constants/action_types.js b/ui/js/constants/action_types.js index 1d1dab869..9f70de9b9 100644 --- a/ui/js/constants/action_types.js +++ b/ui/js/constants/action_types.js @@ -40,8 +40,8 @@ export const RESOLVE_URI_COMPLETED = 'RESOLVE_URI_COMPLETED' export const RESOLVE_URI_CANCELED = 'RESOLVE_URI_CANCELED' export const FETCH_CHANNEL_CLAIMS_STARTED = 'FETCH_CHANNEL_CLAIMS_STARTED' export const FETCH_CHANNEL_CLAIMS_COMPLETED = 'FETCH_CHANNEL_CLAIMS_COMPLETED' -export const CLAIM_LIST_MINE_STARTED = 'CLAIM_LIST_MINE_STARTED' -export const CLAIM_LIST_MINE_COMPLETED = 'CLAIM_LIST_MINE_COMPLETED' +export const FETCH_CLAIM_LIST_MINE_STARTED = 'FETCH_CLAIM_LIST_MINE_STARTED' +export const FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED' export const FILE_LIST_STARTED = 'FILE_LIST_STARTED' export const FILE_LIST_COMPLETED = 'FILE_LIST_COMPLETED' export const FETCH_FILE_INFO_STARTED = 'FETCH_FILE_INFO_STARTED' diff --git a/ui/js/reducers/claims.js b/ui/js/reducers/claims.js index 7105a0d33..b75b00a4d 100644 --- a/ui/js/reducers/claims.js +++ b/ui/js/reducers/claims.js @@ -40,20 +40,33 @@ reducers[types.RESOLVE_URI_CANCELED] = function(state, action) { } -reducers[types.CLAIM_LIST_MINE_STARTED] = function(state, action) { +reducers[types.FETCH_CLAIM_LIST_MINE_STARTED] = function(state, action) { return Object.assign({}, state, { isClaimListMinePending: true }) } -reducers[types.CLAIM_LIST_MINE_COMPLETED] = function(state, action) { - const myClaims = Object.assign({}, state.myClaims) - action.data.claims.forEach((claim) => { - myClaims[claim.claim_id] = claim +reducers[types.FETCH_CLAIM_LIST_MINE_COMPLETED] = function(state, action) { + const { + claims, + } = action.data + const myClaims = new Set(state.myClaims) + const byUri = Object.assign({}, state.claimsByUri) + + claims.forEach(claim => { + const uri = lbryuri.build({ + contentName: claim.name, + claimId: claim.claim_id, + claimSequence: claim.nout, + }) + myClaims.add(uri) + byUri[uri] = claim }) + return Object.assign({}, state, { isClaimListMinePending: false, - myClaims: myClaims + myClaims: myClaims, + claimsByUri: byUri, }) } diff --git a/ui/js/reducers/file_info.js b/ui/js/reducers/file_info.js index 811c829ef..0b06e591b 100644 --- a/ui/js/reducers/file_info.js +++ b/ui/js/reducers/file_info.js @@ -18,7 +18,9 @@ reducers[types.FILE_LIST_COMPLETED] = function(state, action) { const newFileInfos = Object.assign({}, state.fileInfos) fileInfos.forEach((fileInfo) => { - newFileInfos[fileInfo.outpoint] = fileInfo + const { outpoint } = fileInfo + + if (outpoint) newFileInfos[fileInfo.outpoint] = fileInfo }) return Object.assign({}, state, { diff --git a/ui/js/selectors/claims.js b/ui/js/selectors/claims.js index 9a76b872e..5b9b9d0b5 100644 --- a/ui/js/selectors/claims.js +++ b/ui/js/selectors/claims.js @@ -42,7 +42,8 @@ const selectMetadataForUri = (state, props) => { const claim = selectClaimForUri(state, props) const metadata = claim && claim.value && claim.value.stream && claim.value.stream.metadata - return metadata ? metadata : (claim === undefined ? undefined : null) + const value = metadata ? metadata : (claim === undefined ? undefined : null) + return value } export const makeSelectMetadataForUri = () => { @@ -80,18 +81,20 @@ export const selectClaimListMineIsPending = createSelector( export const selectMyClaims = createSelector( _selectState, - (state) => state.myClaims || {} + (state) => state.myClaims || new Set() ) export const selectMyClaimsOutpoints = createSelector( selectMyClaims, - (claims) => { - if (!claims) { - return [] - } + selectClaimsByUri, + (claimIds, byUri) => { + const outpoints = [] - return Object.values(claims).map((claim) => { - return `${claim.txid}:${claim.nout}` + claimIds.forEach(claimId => { + const claim = byUri[claimId] + if (claim) outpoints.push(`${claim.txid}:${claim.nout}`) }) + + return outpoints } ) From 4acd8a8f25f0dd469bd7c2a09482a5989fc9af41 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 29 May 2017 16:43:42 -0400 Subject: [PATCH 02/12] fix upgrade on windows --- ui/js/selectors/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/selectors/app.js b/ui/js/selectors/app.js index 25ed2403c..ebf2a1398 100644 --- a/ui/js/selectors/app.js +++ b/ui/js/selectors/app.js @@ -110,7 +110,7 @@ export const selectUpgradeFilename = createSelector( return `LBRY-${version}.dmg`; case 'linux': return `LBRY_${version}_amd64.deb`; - case 'windows': + case 'win32': return `LBRY.Setup.${version}.exe`; default: throw 'Unknown platform'; From 7572c06b2e06e64cd2f794c76261c4a3d4a72eb7 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 29 May 2017 16:46:19 -0400 Subject: [PATCH 03/12] changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c3cd5204..1eac8df66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,12 +12,12 @@ Web UI version numbers should always match the corresponding version of LBRY App * ### Changed - * + * Do not use a separate claim cache for publishes * ### Fixed - * - * + * Upgrade process should now works on Windows + * Crudely handle failed publishes missing outpoints ### Deprecated * From 3c1b361ee70dddb56100e1059724c7d0dd1cd973 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 29 May 2017 16:46:40 -0400 Subject: [PATCH 04/12] =?UTF-8?q?Bump=20version:=200.11.5=20=E2=86=92=200.?= =?UTF-8?q?11.6rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- app/package.json | 2 +- ui/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 90e320572..528be748b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.11.5 +current_version = 0.11.6rc1 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)(?P\d+))? diff --git a/app/package.json b/app/package.json index cf45db174..71f9c09d8 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "LBRY", - "version": "0.11.5", + "version": "0.11.6rc1", "main": "main.js", "description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.", "author": { diff --git a/ui/package.json b/ui/package.json index 72b997fb1..a828bc5e2 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "lbry-web-ui", - "version": "0.11.5", + "version": "0.11.6rc1", "description": "LBRY UI", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", From 5a552761da3fe612de8a734b2e42528ca9a4a03f Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 29 May 2017 16:46:51 -0400 Subject: [PATCH 05/12] =?UTF-8?q?Bump=20version:=200.11.6rc1=20=E2=86=92?= =?UTF-8?q?=200.11.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGELOG.md | 18 +++++++++++++++--- app/package.json | 2 +- ui/package.json | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 528be748b..eed97c9a7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.11.6rc1 +current_version = 0.11.6 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)(?P\d+))? diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eac8df66..145a4a3dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,12 +12,12 @@ Web UI version numbers should always match the corresponding version of LBRY App * ### Changed - * Do not use a separate claim cache for publishes + * * ### Fixed - * Upgrade process should now works on Windows - * Crudely handle failed publishes missing outpoints + * + * ### Deprecated * @@ -27,6 +27,18 @@ Web UI version numbers should always match the corresponding version of LBRY App * * +## [0.11.6] - 2017-05-29 + +### Changed + * Do not use a separate claim cache for publishes + + +### Fixed + * Upgrade process should now works on Windows + * Crudely handle failed publishes missing outpoints + + + ## [0.11.5] - 2017-05-28 ### Fixed diff --git a/app/package.json b/app/package.json index 71f9c09d8..1c29001fb 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "LBRY", - "version": "0.11.6rc1", + "version": "0.11.6", "main": "main.js", "description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.", "author": { diff --git a/ui/package.json b/ui/package.json index a828bc5e2..d81bc9116 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "lbry-web-ui", - "version": "0.11.6rc1", + "version": "0.11.6", "description": "LBRY UI", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", From 5aca89ab63a3e6b5bcc8ca7b750fe923d9e1e8a7 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Tue, 30 May 2017 12:26:41 +0400 Subject: [PATCH 06/12] Stop landing page content loading error from displaying all the time --- ui/js/page/discover/view.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index 91cdfafda..1842b9156 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -33,6 +33,10 @@ class DiscoverPage extends React.Component{ featuredUris, fetchingFeaturedUris, } = this.props + const failedToLoad = !fetchingFeaturedUris && ( + featuredUris === undefined || + (featuredUris !== undefined && Object.keys(featuredUris).length === 0) + ) return (
@@ -47,7 +51,7 @@ class DiscoverPage extends React.Component{ )) } { - typeof featuredUris !== undefined && + failedToLoad &&
Failed to load landing content.
}
From 2bdc2ce268de08cb23ff76dae2e5c329eb35f30a Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Tue, 30 May 2017 14:12:07 -0400 Subject: [PATCH 07/12] fix close modal in video component --- ui/js/component/fileActions/view.jsx | 2 +- ui/js/component/video/view.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 7f3c1d75c..5dd4357c6 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -122,7 +122,7 @@ class FileActions extends React.Component { openModal('confirmRemove')} label="Remove..." /> : '' } + contentLabel="Confirm Purchase" onConfirmed={this.onAffirmPurchase.bind(this)} onAborted={closeModal}> This will purchase {title} for credits. {modal} - { this.closeModal() }}> + You don't have enough LBRY credits to pay for this stream. {title} for credits. { this.closeModal() }} contentLabel="Timed Out"> + isOpen={modal == 'timedOut'} onConfirmed={closeModal} contentLabel="Timed Out"> Sorry, your download timed out :( ); From dce16af1a63e19a81138437d03a2deed001c66bd Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Tue, 30 May 2017 14:22:24 -0400 Subject: [PATCH 08/12] update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 145a4a3dd..163506d4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,8 @@ Web UI version numbers should always match the corresponding version of LBRY App * ### Fixed - * - * + * Closing modal dialogs was broken on some download and stream errors + * Discover landing page improperly showed loading error when it was loading correctly ### Deprecated * From 230e6e2d70f5703f4b6eb25cbc5551fdd0e3eaa9 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Thu, 25 May 2017 21:40:46 +0400 Subject: [PATCH 09/12] Fix autoplaying --- ui/js/actions/content.js | 4 ++-- ui/js/component/fileActions/index.js | 2 +- ui/js/component/video/index.js | 2 +- ui/js/component/video/view.jsx | 27 +++++++++++++++++---------- ui/package.json | 3 ++- ui/webpack.config.js | 6 +++++- ui/webpack.dev.config.js | 6 +++++- 7 files changed, 33 insertions(+), 17 deletions(-) diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js index a52634bca..e6b6a30a1 100644 --- a/ui/js/actions/content.js +++ b/ui/js/actions/content.js @@ -209,7 +209,7 @@ export function doLoadVideo(uri) { } } -export function doPurchaseUri(uri) { +export function doPurchaseUri(uri, purchaseModalName) { return function(dispatch, getState) { const state = getState() const balance = selectBalance(state) @@ -244,7 +244,7 @@ export function doPurchaseUri(uri) { if (cost > balance) { dispatch(doOpenModal('notEnoughCredits')) } else { - dispatch(doOpenModal('affirmPurchase')) + dispatch(doOpenModal(purchaseModalName)) } return Promise.resolve() diff --git a/ui/js/component/fileActions/index.js b/ui/js/component/fileActions/index.js index e9dc10705..8e9555a14 100644 --- a/ui/js/component/fileActions/index.js +++ b/ui/js/component/fileActions/index.js @@ -66,7 +66,7 @@ const perform = (dispatch) => ({ dispatch(doDeleteFile(fileInfo, deleteFromComputer)) }, openModal: (modal) => dispatch(doOpenModal(modal)), - startDownload: (uri) => dispatch(doPurchaseUri(uri)), + startDownload: (uri) => dispatch(doPurchaseUri(uri, 'affirmPurchase')), loadVideo: (uri) => dispatch(doLoadVideo(uri)), }) diff --git a/ui/js/component/video/index.js b/ui/js/component/video/index.js index 5566da840..423ff533a 100644 --- a/ui/js/component/video/index.js +++ b/ui/js/component/video/index.js @@ -47,7 +47,7 @@ const makeSelect = () => { const perform = (dispatch) => ({ loadVideo: (uri) => dispatch(doLoadVideo(uri)), - purchaseUri: (uri) => dispatch(doPurchaseUri(uri)), + purchaseUri: (uri) => dispatch(doPurchaseUri(uri, 'affirmPurchaseAndPlay')), closeModal: () => dispatch(doCloseModal()), }) diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index 760a728ad..864dea501 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -52,13 +52,12 @@ class VideoPlayButton extends React.Component { className="video__play-button" icon="icon-play" onClick={this.onWatchClick.bind(this)} /> - {modal} { this.closeModal() }}> You don't have enough LBRY credits to pay for this stream. @@ -72,8 +71,6 @@ class VideoPlayButton extends React.Component { } } -const plyr = require('plyr') - class Video extends React.Component { constructor(props) { super(props) @@ -114,7 +111,7 @@ class Video extends React.Component { isPlaying || isLoading ? (!isReadyToPlay ? this is the world's worst loading screen and we shipped our software with it anyway...

{loadStatusMessage}
: - ) : + ) :
@@ -123,18 +120,28 @@ class Video extends React.Component { } } +const from = require('from2') +const player = require('render-media') +const fs = require('fs') + class VideoPlayer extends React.Component { componentDidMount() { const elem = this.refs.video const { - autoplay, downloadPath, contentType, + filename, } = this.props - const players = plyr.setup(elem) - if (autoplay) { - players[0].play() + const file = { + name: filename, + createReadStream: (opts) => { + return fs.createReadStream(downloadPath, opts) + } } + player.render(file, elem, { + autoplay: true, + controls: true, + }) } render() { @@ -145,7 +152,7 @@ class VideoPlayer extends React.Component { } = this.props return ( -