From 5d09bcc5503fbb5b8cf6d873be8adb14756509f6 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 1 Jun 2017 14:39:28 -0400 Subject: [PATCH 1/9] rename deprecated call --- ui/js/lbry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/lbry.js b/ui/js/lbry.js index b9e70d359..b7e0f9960 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -318,7 +318,7 @@ lbry._balanceSubscribeInterval = 5000; lbry._balanceUpdateInterval = null; lbry._updateBalanceSubscribers = function() { - lbry.get_balance().then(function(balance) { + lbry.wallet_balance().then(function(balance) { for (let callback of Object.values(lbry._balanceSubscribeCallbacks)) { callback(balance); } From c115e9c923f4f4c1f4b6fc7abc92a573f958fde3 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 1 Jun 2017 16:40:18 -0400 Subject: [PATCH 2/9] fix whitespace in access token --- ui/js/lbryio.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/js/lbryio.js b/ui/js/lbryio.js index 0c08dbf1e..286a70927 100644 --- a/ui/js/lbryio.js +++ b/ui/js/lbryio.js @@ -95,11 +95,12 @@ lbryio.call = function(resource, action, params={}, method='get', evenIfDisabled }; lbryio.getAccessToken = () => { - return getSession('accessToken'); + const token = getSession('accessToken'); + return token ? token.toString().trim() : token; } lbryio.setAccessToken = (token) => { - setSession('accessToken', token) + setSession('accessToken', token ? token.toString().trim() : token) } lbryio.authenticate = function() { From 8bdcaa75c851b91158e3ec175fccc84417567256 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 1 Jun 2017 18:20:29 -0400 Subject: [PATCH 3/9] update README --- README.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0819f2cbc..05abf0173 100644 --- a/README.md +++ b/README.md @@ -18,26 +18,24 @@ To install from source or make changes to the application, continue reading belo ## Development -This repo uses submodules, so clone it using `--recursive`. +### One-time Setup -### Setup +1. Install node and npm. +2. Check out this repo. +3. Set up a Python virtual environment, or live on the wild side. +4. Run `./build.sh`. This builds the UI assets and puts them into `app/dist`. It also downloads [lbry daemon](https://github.com/lbryio/lbry/releases). -The -[lbry daemon](https://github.com/lbryio/lbry/blob/master/INSTALL.md) needs -to be installed along with pyinstaller. You also need to be -able to build the lbry-web-ui, so have node, webpack, etc installed. +### Running -### Build +Run `./node_modules/.bin/electron app` -run `./build.sh` +### Ongoing Development +1. `cd ui` +2. `./watch.sh` -This builds the UI assets and puts them into `app/dist`. It also builds `app/dist/lbrynet-daemon`. +This will set up a monitor that will automatically monitor and compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app. -### Run - -`./node_modules/.bin/electron app` - -### Package +### Packaging We use [electron-builder](https://github.com/electron-userland/electron-builder) to create distributable packages, which is run by calling: From ced93942f5efe9737be7d7d21cd702313d9762f4 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 1 Jun 2017 18:21:07 -0400 Subject: [PATCH 4/9] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05abf0173..13ed35f78 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Run `./node_modules/.bin/electron app` 1. `cd ui` 2. `./watch.sh` -This will set up a monitor that will automatically monitor and compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app. +This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app. ### Packaging From 7d9621f85008f2c19004ba0ee5f66ac299c495ac Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 1 Jun 2017 18:24:20 -0400 Subject: [PATCH 5/9] add screenshot --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 13ed35f78..b9196bc28 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This is a graphical browser for the decentralized content marketplace provided by the [LBRY](https://lbry.io) protocol. It is essentially the [lbry daemon](https://github.com/lbryio/lbry) bundled with a UI using [Electron](http://electron.atom.io/). +![App Screenshot](https://lbry.io/img/lbry-ui.png) + ## Installing We provide installers for Windows, macOS, and Debian-based Linux. From fa66f4e918f5922418650bf2c9560a7dc26a7e70 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Wed, 31 May 2017 11:31:08 +0400 Subject: [PATCH 6/9] Fix download progress for recontructing files --- ui/js/actions/content.js | 3 ++- ui/js/component/fileActions/view.jsx | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js index e6b6a30a1..a7276abf9 100644 --- a/ui/js/actions/content.js +++ b/ui/js/actions/content.js @@ -166,6 +166,8 @@ export function doDownloadFile(uri, streamInfo) { fileInfo, } }) + + dispatch(doUpdateLoadStatus(uri, streamInfo.outpoint)) }) lbryio.call('file', 'view', { @@ -176,7 +178,6 @@ export function doDownloadFile(uri, streamInfo) { rewards.claimEligiblePurchaseRewards() - dispatch(doUpdateLoadStatus(uri, streamInfo.outpoint)) } } diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 5dd4357c6..6653bd236 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -110,7 +110,6 @@ class FileActions extends React.Component { content = openInShell(fileInfo)} />; } else { console.log('handle this case of file action props?'); - console.log(this.props) } return ( From b1bbf7ee4e0d693e21e517da61e6eb55b1c95a1c Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Wed, 31 May 2017 14:24:55 +0400 Subject: [PATCH 7/9] Scroll to top of page when changing path --- ui/js/actions/app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js index a513b820c..bf0451c82 100644 --- a/ui/js/actions/app.js +++ b/ui/js/actions/app.js @@ -52,6 +52,7 @@ export function doChangePath(path) { const state = getState() const pageTitle = selectPageTitle(state) window.document.title = pageTitle + window.scrollTo(0, 0) const currentPage = selectCurrentPage(state) if (currentPage === 'search') { From 8505959c22e7385b3610749d16b1047ee293027b Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Wed, 31 May 2017 21:36:38 +0400 Subject: [PATCH 8/9] Use render-media to render audio and images --- ui/js/component/fileActions/view.jsx | 2 ++ ui/js/component/video/index.js | 5 +++- ui/js/component/video/view.jsx | 40 ++++++++++++++++++++-------- ui/js/lbry.js | 2 +- ui/js/page/filePage/view.jsx | 3 ++- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 6653bd236..604261376 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -73,6 +73,8 @@ class FileActions extends React.Component { let content + console.log(fileInfo) + if (downloading) { const diff --git a/ui/js/component/video/index.js b/ui/js/component/video/index.js index 423ff533a..e581f4bc6 100644 --- a/ui/js/component/video/index.js +++ b/ui/js/component/video/index.js @@ -13,7 +13,8 @@ import { doLoadVideo, } from 'actions/content' import { - makeSelectMetadataForUri + makeSelectMetadataForUri, + makeSelectContentTypeForUri, } from 'selectors/claims' import { makeSelectFileInfoForUri, @@ -32,6 +33,7 @@ const makeSelect = () => { const selectIsLoading = makeSelectLoadingForUri() const selectIsDownloading = makeSelectDownloadingForUri() const selectMetadata = makeSelectMetadataForUri() + const selectContentType = makeSelectContentTypeForUri() const select = (state, props) => ({ costInfo: selectCostInfo(state, props), @@ -40,6 +42,7 @@ const makeSelect = () => { modal: selectCurrentModal(state), isLoading: selectIsLoading(state, props), isDownloading: selectIsDownloading(state, props), + contentType: selectContentType(state, props), }) return select diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index d7a1f274f..723b92c62 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -2,6 +2,10 @@ import React from 'react'; import FilePrice from 'component/filePrice' import Link from 'component/link'; import Modal from 'component/modal'; +import lbry from 'lbry' +import { + Thumbnail, +} from 'component/common' class VideoPlayButton extends React.Component { onPurchaseConfirmed() { @@ -33,6 +37,7 @@ class VideoPlayButton extends React.Component { isLoading, costInfo, fileInfo, + mediaType, } = this.props /* @@ -44,13 +49,14 @@ class VideoPlayButton extends React.Component { */ const disabled = isLoading || fileInfo === undefined || (fileInfo === null && (!costInfo || costInfo.cost === undefined)) + const icon = mediaType == "image" ? "icon-folder-o" : "icon-play" return (
You don't have enough LBRY credits to pay for this stream. @@ -89,12 +95,14 @@ class Video extends React.Component { isLoading, isDownloading, fileInfo, + contentType, } = this.props const { isPlaying = false, } = this.state const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0 + const mediaType = lbry.getMediaType(contentType, fileInfo && fileInfo.file_name) let loadStatusMessage = '' @@ -106,14 +114,24 @@ class Video extends React.Component { loadStatusMessage = "Downloading stream... not long left now!" } + let klassName = "" + if (isLoading || isDownloading) klassName += "video-embedded video" + if (mediaType === "video") { + klassName += "video-embedded video" + klassName += isPlaying ? " video--active" : " video--hidden" + } else { + if (!isPlaying) klassName += "video-embedded" + } + const poster = metadata.thumbnail + return ( -
{ +
{ isPlaying || isLoading ? (!isReadyToPlay ? this is the world's worst loading screen and we shipped our software with it anyway...

{loadStatusMessage}
: - ) : + ) :
- +
}
); @@ -126,10 +144,9 @@ const fs = require('fs') class VideoPlayer extends React.Component { componentDidMount() { - const elem = this.refs.video + const elem = this.refs.media const { downloadPath, - contentType, filename, } = this.props const file = { @@ -138,7 +155,7 @@ class VideoPlayer extends React.Component { return fs.createReadStream(downloadPath, opts) } } - player.render(file, elem, { + player.append(file, elem, { autoplay: true, controls: true, }) @@ -147,14 +164,15 @@ class VideoPlayer extends React.Component { render() { const { downloadPath, - contentType, + mediaType, poster, } = this.props return ( - +
+ {mediaType === "audio" && } +
+
) } } diff --git a/ui/js/lbry.js b/ui/js/lbry.js index b7e0f9960..7b95016ac 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -286,7 +286,7 @@ lbry.imagePath = function(file) lbry.getMediaType = function(contentType, fileName) { if (contentType) { - return /^[^/]+/.exec(contentType); + return /^[^/]+/.exec(contentType)[0]; } else if (fileName) { var dotIndex = fileName.lastIndexOf('.'); if (dotIndex == -1) { diff --git a/ui/js/page/filePage/view.jsx b/ui/js/page/filePage/view.jsx index e7a1e2068..b1e031df7 100644 --- a/ui/js/page/filePage/view.jsx +++ b/ui/js/page/filePage/view.jsx @@ -92,11 +92,12 @@ class FilePage extends React.Component{ const channelClaimId = claim.value && claim.value.publisherSignature ? claim.value.publisherSignature.certificateId : null; const channelUri = signatureIsValid && hasSignature && channelName ? lbryuri.build({channelName, claimId: channelClaimId}, false) : null const uriIndicator = + const mediaType = lbry.getMediaType(contentType) return (
- { contentType && contentType.startsWith('video/') ? + { ["video", "audio", "image"].indexOf(mediaType) !== -1 ?
From 912933d4e742e66cf2698fd5bf70e089852d3be3 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Fri, 2 Jun 2017 14:40:40 +0700 Subject: [PATCH 9/9] Sync loading between file actions and video player --- ui/js/component/fileActions/index.js | 2 ++ ui/js/component/fileActions/view.jsx | 5 ++--- ui/js/component/video/view.jsx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/js/component/fileActions/index.js b/ui/js/component/fileActions/index.js index 8e9555a14..1d8ba6088 100644 --- a/ui/js/component/fileActions/index.js +++ b/ui/js/component/fileActions/index.js @@ -43,6 +43,7 @@ const makeSelect = () => { const selectIsAvailableForUri = makeSelectIsAvailableForUri() const selectDownloadingForUri = makeSelectDownloadingForUri() const selectCostInfoForUri = makeSelectCostInfoForUri() + const selectLoadingForUri = makeSelectLoadingForUri() const select = (state, props) => ({ fileInfo: selectFileInfoForUri(state, props), @@ -51,6 +52,7 @@ const makeSelect = () => { modal: selectCurrentModal(state), downloading: selectDownloadingForUri(state, props), costInfo: selectCostInfoForUri(state, props), + loading: selectLoadingForUri(state, props), }) return select diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 604261376..8b3d2678b 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -63,6 +63,7 @@ class FileActions extends React.Component { closeModal, startDownload, costInfo, + loading, } = this.props const deleteChecked = this.state.deleteChecked, @@ -73,9 +74,7 @@ class FileActions extends React.Component { let content - console.log(fileInfo) - - if (downloading) { + if (loading || downloading) { const progress = (fileInfo && fileInfo.written_bytes) ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0, diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index 723b92c62..09ca9a5ac 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -126,7 +126,7 @@ class Video extends React.Component { return (
{ - isPlaying || isLoading ? + isPlaying ? (!isReadyToPlay ? this is the world's worst loading screen and we shipped our software with it anyway...

{loadStatusMessage}
: ) :