Merge pull request #1 from lbryio/master

Update master from original
This commit is contained in:
Anna Melzer 2018-10-31 17:17:57 +01:00 committed by GitHub
commit aee048e726
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 319 additions and 347 deletions

36
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,36 @@
## PR Checklist
Please check all that apply to this PR using "x":
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
- [ ] I have checked that this PR does not introduce a breaking change
- [ ] This PR introduces breaking changes and I have provided a detailed explanation below
## PR Type
What kind of change does this PR introduce?
<!-- Please check all that apply to this PR using "x". -->
- [ ] Bugfix
- [ ] Feature
- [ ] Breaking changes (bugfix or feature that introduces breaking changes)
- [ ] Code style update (formatting)
- [ ] Refactoring (no functional changes)
- [ ] Documentation changes
- [ ] Other - Please describe:
## Fixes
Issue Number: N/A
## What is the current behavior?
## What is the new behavior?
## Other information
<!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->

View file

@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Adds Persistence to File List Filter Selections ([#2050](https://github.com/lbryio/lbry-desktop/pull/2050))
### Changed
* Upgraded to lbrynet v0.30.0 ([#1998](https://github.com/lbryio/lbry-desktop/pull/1998))
* Make tooltip smarter ([#1979](https://github.com/lbryio/lbry-desktop/pull/1979))
* Change channel pages to have 48 items instead of 10 ([#2002](https://github.com/lbryio/lbry-desktop/pull/2002))
* Update to https ([#2016](https://github.com/lbryio/lbry-desktop/pull/2016))
@ -96,6 +97,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Fix middle click link error ([#1843](https://github.com/lbryio/lbry-desktop/issues/1843)}
* Problem with search auto-complete menu when scrolling over file viewer ([#1847](https://github.com/lbryio/lbry-desktop/issues/1847))
* Show label when publish button is disabled while uploading thumbnail to spee.ch ([#1867](https://github.com/lbryio/lbry-desktop/pull/1867))
* Edit option missing from certain published claims ([#1756](https://github.com/lbryio/lbry-desktop/issues/1756))
* Navigation issue with channels that have more than one page ([#1797](https://github.com/lbryio/lbry-desktop/pull/1797))
* Navigation issue with channels that have more than one page ([#1797](https://github.com/lbryio/lbry-desktop/pull/1797))
* Upgrade modals would stack on-top of each other if the app was kept open for a long time ([#1857](https://github.com/lbryio/lbry-desktop/pull/1857))
### Added
* 3D file viewer for OBJ & STL file types ([#1558](https://github.com/lbryio/lbry-desktop/pull/1558))
@ -114,14 +119,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* More descriptive error message when Shapeshift is unavailable ([#1771](https://github.com/lbryio/lbry-desktop/pull/1771))
* Rename the Github repo to lbry-desktop ([#1765](https://github.com/lbryio/lbry-desktop/pull/1765))
### Fixed
* Edit option missing from certain published claims ([#1756](https://github.com/lbryio/lbry-desktop/issues/1756))
* Navigation issue with channels that have more than one page ([#1797](https://github.com/lbryio/lbry-desktop/pull/1797))
* Navigation issue with channels that have more than one page ([#1797](https://github.com/lbryio/lbry-desktop/pull/1797))
* Upgrade modals would stack on-top of each other if the app was kept open for a long time ([#1857](https://github.com/lbryio/lbry-desktop/pull/1857))
## [0.22.2] - 2018-07-09
### Fixed

View file

@ -1,5 +1,6 @@
# LBRY App
[![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/lbryio/lbry-desktop/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/lbryio/lbry-desktop.svg?branch=master)](https://travis-ci.org/lbryio/lbry-desktop)
[![Dependencies](https://david-dm.org/lbryio/lbry-desktop/status.svg)](https://david-dm.org/lbryio/lbry-desktop)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/78b627d4f5524792adc48719835e1523)](https://www.codacy.com/app/LBRY/lbry-desktop?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=lbryio/lbry-desktop&amp;utm_campaign=Badge_Grade)

View file

@ -17,7 +17,7 @@ const downloadDaemon = targetPlatform =>
let currentPlatform = os.platform();
var daemonPlatform = process.env.TARGET || targetPlatform || currentPlatform;
if (daemonPlatform === 'mac' || daemonPlatform === 'darwin') daemonPlatform = 'macos';
if (daemonPlatform === 'mac' || daemonPlatform === 'darwin') daemonPlatform = 'mac';
if (daemonPlatform === 'win32' || daemonPlatform === 'windows') {
daemonPlatform = 'windows';
daemonFileName = daemonFileName + '.exe';

View file

@ -49,8 +49,8 @@
"formik": "^0.10.4",
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1",
"lbry-redux": "lbryio/lbry-redux#03aea43da5f12bc01546a92bdf460ebd08681013",
"lbryinc": "lbryio/lbryinc#3f34af546ee73ff2ee7d8ad05e540b3b0aa658fb",
"lbry-redux": "lbryio/lbry-redux#f193d38c61ea061679ebc7b4ca139a0e9c95ef8a",
"lbryinc": "lbryio/lbryinc#7a458ea13ceceffa0191e73139f94e5c953f22b1",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",
"mime": "^2.3.1",
@ -134,9 +134,9 @@
"yarn": "^1.3"
},
"lbrySettings": {
"lbrynetDaemonVersion": "0.21.2",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip",
"lbrynetDaemonVersion": "0.30.0",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
"lbrynetDaemonDir": "static/daemon",
"lbrynetDaemonFileName": "lbrynet-daemon"
"lbrynetDaemonFileName": "lbrynet"
}
}

View file

@ -3,7 +3,7 @@ import path from 'path';
import { spawn, execSync } from 'child_process';
export default class Daemon {
static path = process.env.LBRY_DAEMON || path.join(__static, 'daemon/lbrynet-daemon');
static path = process.env.LBRY_DAEMON || path.join(__static, 'daemon/lbrynet');
subprocess;
handlers;
@ -12,13 +12,12 @@ export default class Daemon {
}
launch() {
console.log('Launching daemon:', Daemon.path);
this.subprocess = spawn(Daemon.path);
this.subprocess = spawn(Daemon.path, ['start']);
this.subprocess.stdout.on('data', data => console.log(`Daemon: ${data}`));
this.subprocess.stderr.on('data', data => console.error(`Daemon: ${data}`));
this.subprocess.on('exit', () => this.fire('exit'));
this.subprocess.on('error', error => console.error(`Daemon: ${error}`));
this.subprocess.on('error', error => console.error(`Daemon error: ${error}`));
}
quit() {

View file

@ -64,8 +64,9 @@ if (isDev) {
}
app.on('ready', async () => {
const processList = await findProcess('name', 'lbrynet-daemon');
const processList = await findProcess('name', 'lbrynet');
const isDaemonRunning = processList.length > 0;
if (!isDaemonRunning) {
daemon = new Daemon();
daemon.on('exit', () => {
@ -95,11 +96,16 @@ app.on('ready', async () => {
// HACK: patch webrequest to fix devtools incompatibility with electron 2.x.
// See https://github.com/electron/electron/issues/13008#issuecomment-400261941
session.defaultSession.webRequest.onBeforeRequest({}, (details, callback) => {
if (details.url.indexOf('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33') !== -1) {
callback({redirectURL: details.url.replace('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33', '57c9d07b416b5a2ea23d28247300e4af36329bdc')});
} else {
callback({cancel: false});
}
if (details.url.indexOf('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33') !== -1) {
callback({
redirectURL: details.url.replace(
'7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33',
'57c9d07b416b5a2ea23d28247300e4af36329bdc'
),
});
} else {
callback({ cancel: false });
}
});
});

View file

@ -1,7 +1,12 @@
// @flow
import { connect } from 'react-redux';
import { doNotify } from 'lbry-redux';
import Address from './view';
export default connect(null, {
doNotify,
})(Address);
export default connect(
null,
{
doNotify,
}
)(Address);

View file

@ -1,8 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import CardMedia from './view';
const select = state => ({});
const perform = dispatch => ({});
export default connect(select, perform)(CardMedia);
export default CardMedia;

View file

@ -6,6 +6,7 @@ import {
makeSelectFileInfoForUri,
makeSelectIsUriResolving,
makeSelectClaimIsMine,
makeSelectClaimIsPending,
} from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation';
import {
@ -13,34 +14,22 @@ import {
makeSelectContentPositionForUri,
} from 'redux/selectors/content';
import { selectShowNsfw } from 'redux/selectors/settings';
import { selectPendingPublish } from 'redux/selectors/publish';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
import { doClearContentHistoryUri } from 'redux/actions/content';
import FileCard from './view';
const select = (state, props) => {
let pendingPublish;
if (props.checkPending) {
pendingPublish = selectPendingPublish(props.uri)(state);
}
const fileCardInfo = pendingPublish || {
claim: makeSelectClaimForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
};
return {
obscureNsfw: !selectShowNsfw(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
...fileCardInfo,
pending: !!pendingPublish,
position: makeSelectContentPositionForUri(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
};
};
const select = (state, props) => ({
pending: makeSelectClaimIsPending(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
obscureNsfw: !selectShowNsfw(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
position: makeSelectContentPositionForUri(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
});
const perform = dispatch => ({
navigate: (path, params) => dispatch(doNavigate(path, params)),

View file

@ -10,15 +10,15 @@ type Props = {
sortByHeight?: boolean,
claimsById: Array<{}>,
fileInfos: Array<FileInfo>,
checkPending?: boolean,
sortBy: string,
page: string,
setFileListSort: (string, string) => void,
page?: string,
setFileListSort: (?string, string) => void,
};
class FileList extends React.PureComponent<Props> {
static defaultProps = {
hideFilter: false,
sortBy: SORT_OPTIONS.DATE_NEW,
};
constructor(props: Props) {
@ -29,9 +29,12 @@ class FileList extends React.PureComponent<Props> {
[SORT_OPTIONS.DATE_NEW]: fileInfos =>
this.props.sortByHeight
? fileInfos.sort((fileInfo1, fileInfo2) => {
if (fileInfo1.pending) {
if (fileInfo1.confirmations < 1) {
return -1;
} else if (fileInfo2.confirmations < 1) {
return 1;
}
const height1 = this.props.claimsById[fileInfo1.claim_id]
? this.props.claimsById[fileInfo1.claim_id].height
: 0;
@ -124,7 +127,8 @@ class FileList extends React.PureComponent<Props> {
sortFunctions: {};
render() {
const { fileInfos, hideFilter, checkPending, sortBy } = this.props;
const { fileInfos, hideFilter, sortBy } = this.props;
const content = [];
if (!fileInfos) {
return null;
@ -150,7 +154,7 @@ class FileList extends React.PureComponent<Props> {
const outpoint = `${txid}:${nout}`;
// See https://github.com/lbryio/lbry-desktop/issues/1327 for discussion around using outpoint as the key
content.push(<FileCard key={outpoint} uri={uri} checkPending={checkPending} isNew={isNew} />);
content.push(<FileCard key={outpoint} uri={uri} isNew={isNew} />);
});
return (

View file

@ -8,9 +8,4 @@ const select = (state, props) => ({
isSearching: selectIsSearching(state),
});
const perform = () => ({});
export default connect(
select,
perform
)(FileListSearch);
export default connect(select)(FileListSearch);

View file

@ -1,5 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import FormFieldPrice from './view';
export default connect(null, null)(FormFieldPrice);
export default FormFieldPrice;

View file

@ -1,5 +1,3 @@
import { connect } from 'react-redux';
import { selectBalance } from 'lbry-redux';
import PublishForm from './view';
export default connect(null, null)(PublishForm);
export default PublishForm;

View file

@ -123,7 +123,7 @@ class PublishForm extends React.PureComponent<Props> {
const { channel, updatePublishForm } = this.props;
if (!name) {
updatePublishForm({ nameError: undefined });
updatePublishForm({ name: '', nameError: __('A name is required.') });
return;
}

View file

@ -159,7 +159,6 @@ class ChannelSection extends React.PureComponent<Props, State> {
<FormField
key="channel"
type="select"
tabIndex="1"
onChange={this.handleChannelChange}
value={channel}
>

View file

@ -5,18 +5,20 @@ import { FormRow } from 'component/common/form';
import * as statuses from 'constants/shape_shift';
import Address from 'component/address';
import Button from 'component/button';
import type { Dispatch } from 'redux/actions/shape_shift';
import type { Dispatch, ThunkAction } from 'types/redux';
import type { Action } from 'redux/actions/shape_shift';
import ShiftMarketInfo from './market_info';
type Props = {
shiftState: ?string,
shiftCoinType: ?string,
shiftDepositAddress: ?string,
shiftDepositAddress: string,
shiftReturnAddress: ?string,
shiftOrderId: ?string,
originCoinDepositMax: ?number,
clearShapeShift: Dispatch,
getActiveShift: Dispatch,
clearShapeShift: () => (Dispatch<Action>) => ThunkAction<Action>,
getActiveShift: string => (Dispatch<Action>) => ThunkAction<Action>,
shapeShiftRate: ?number,
originCoinDepositMax: ?number,
originCoinDepositFee: ?number,

View file

@ -2,7 +2,8 @@
import React from 'react';
import { getExampleAddress } from 'util/shape_shift';
import { FormField, FormRow, Submit } from 'component/common/form';
import type { ShapeShiftFormValues, Dispatch } from 'redux/actions/shape_shift';
import type { ShapeShiftFormValues, Action } from 'redux/actions/shape_shift';
import type { Dispatch, ThunkAction } from 'types/redux';
import ShiftMarketInfo from './market_info';
type ShapeShiftFormErrors = {
@ -19,7 +20,7 @@ type Props = {
isSubmitting: boolean,
shiftSupportedCoins: Array<string>,
originCoin: string,
getCoinStats: Dispatch,
getCoinStats: string => (Dispatch<Action>) => ThunkAction<Action>,
originCoinDepositFee: number,
originCoinDepositMin: string,
originCoinDepositMax: number,

View file

@ -4,17 +4,23 @@ import { Formik } from 'formik';
import { validateShapeShiftForm } from 'util/shape_shift';
import Button from 'component/button';
import type { ShapeShiftState } from 'redux/reducers/shape_shift';
import type { Dispatch, ShapeShiftFormValues } from 'redux/actions/shape_shift';
import type { ShapeShiftFormValues, Action } from 'redux/actions/shape_shift';
import type { Dispatch, ThunkAction } from 'types/redux';
import type { FormikActions } from 'types/common';
import ShapeShiftForm from './internal/form';
import ActiveShapeShift from './internal/active-shift';
type Props = {
shapeShift: ShapeShiftState,
getCoinStats: Dispatch,
createShapeShift: Dispatch,
clearShapeShift: Dispatch,
getActiveShift: Dispatch,
shapeShiftInit: Dispatch,
getCoinStats: string => (Dispatch<Action>) => ThunkAction<Action>,
createShapeShift: (
ShapeShiftFormValues,
FormikActions
) => (Dispatch<Action>) => ThunkAction<Action>,
clearShapeShift: () => (Dispatch<Action>) => ThunkAction<Action>,
getActiveShift: string => (Dispatch<Action>) => ThunkAction<Action>,
shapeShiftInit: () => (Dispatch<Action>) => ThunkAction<Action>,
receiveAddress: string,
};
@ -42,7 +48,6 @@ class ShapeShift extends React.PureComponent<Props> {
} = this.props;
const {
loading,
updating,
error,
shiftSupportedCoins,
@ -104,7 +109,7 @@ class ShapeShift extends React.PureComponent<Props> {
getActiveShift={getActiveShift}
shiftCoinType={shiftCoinType}
shiftReturnAddress={shiftReturnAddress}
shiftDepositAddress={shiftDepositAddress}
shiftDepositAddress={shiftDepositAddress || ''}
shiftOrderId={shiftOrderId}
shiftState={shiftState}
clearShapeShift={clearShapeShift}

View file

@ -1,10 +1,9 @@
import React from 'react';
import { connect } from 'react-redux';
import { selectThemePath } from 'redux/selectors/settings.js';
import { selectThemePath } from 'redux/selectors/settings';
import Theme from './view';
const select = state => ({
themePath: selectThemePath(state),
});
export default connect(select, null)(Theme);
export default connect(select)(Theme);

View file

@ -38,18 +38,12 @@ class UriIndicator extends React.PureComponent<Props> {
if (!claim) {
return <span className="empty">{isResolvingUri ? 'Validating...' : 'Unused'}</span>;
}
const {
channel_name: channelName,
has_signature: hasSignature,
signature_is_valid: signatureIsValid,
value,
} = claim;
const { channel_name: channelName, signature_is_valid: signatureIsValid, value } = claim;
const channelClaimId =
value && value.publisherSignature && value.publisherSignature.certificateId;
if (!hasSignature || !channelName) {
if (!channelName) {
return <span className="channel-name">Anonymous</span>;
}

View file

@ -12,19 +12,19 @@ type Props = {
gettingNewAddress: boolean,
};
class WalletAddress extends React.PureComponent<Props> {
type State = {
showQR: boolean,
};
class WalletAddress extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
showQR: false,
};
}
toggleQR() {
this.setState({
showQR: !this.state.showQR,
});
this.toggleQR = this.toggleQR.bind(this);
}
componentWillMount() {
@ -36,6 +36,14 @@ class WalletAddress extends React.PureComponent<Props> {
}
}
toggleQR: Function;
toggleQR() {
this.setState({
showQR: !this.state.showQR,
});
}
render() {
const { receiveAddress, getNewAddress, gettingNewAddress } = this.props;
const { showQR } = this.state;
@ -62,7 +70,7 @@ class WalletAddress extends React.PureComponent<Props> {
<Button
button="link"
label={showQR ? __('Hide QR code') : __('Show QR code')}
onClick={this.toggleQR.bind(this)}
onClick={this.toggleQR}
/>
</div>

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import {
doSendSupport,
doSendTip,
makeSelectTitleForUri,
makeSelectClaimForUri,
selectIsSendingSupport,
@ -16,7 +16,10 @@ const select = (state, props) => ({
});
const perform = dispatch => ({
sendSupport: (amount, claimId, uri) => dispatch(doSendSupport(amount, claimId, uri)),
sendSupport: (amount, claimId, uri) => dispatch(doSendTip(amount, claimId, uri)),
});
export default connect(select, perform)(WalletSendTip);
export default connect(
select,
perform
)(WalletSendTip);

View file

@ -23,12 +23,12 @@ export default function doLogWarningConsoleMessage(activeOnDev = false) {
);
console.log(
"%cIf you don't understand what you are doing here, please close this window and keep your LBC credits/wallet safe.",
"%cIf you don't understand exactly what you are doing here, please close this window and keep your LBC credits/wallet safe.",
style.redText
);
console.log(
'%cIf you do understand exactly what you are doing, you should come work with us https://lbry.io/join-us',
'%cIf you do understand exactly what you are doing, joins us, earn LBC, and make LBRY better! All of LBRY is open-source and we have a sweet secret handshake. Get started at https://lbry.tech/contribute',
style.normalText
);
}

View file

@ -2,10 +2,13 @@ import { connect } from 'react-redux';
import { doHideNotification } from 'lbry-redux';
import ModalAuthFailure from './view';
const select = state => ({});
const select = () => ({});
const perform = dispatch => ({
close: () => dispatch(doHideNotification()),
});
export default connect(null, null)(ModalAuthFailure);
export default connect(
select,
perform
)(ModalAuthFailure);

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { doAutoUpdateDeclined } from 'redux/actions/app';
import { doHideNotification } from 'lbry-redux';
@ -9,4 +8,7 @@ const perform = dispatch => ({
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
});
export default connect(null, perform)(ModalAutoUpdateConfirm);
export default connect(
null,
perform
)(ModalAutoUpdateConfirm);

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { doAutoUpdateDeclined } from 'redux/actions/app';
import { doHideNotification } from 'lbry-redux';
@ -9,4 +8,7 @@ const perform = dispatch => ({
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
});
export default connect(null, perform)(ModalAutoUpdateDownloaded);
export default connect(
null,
perform
)(ModalAutoUpdateDownloaded);

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { doStartUpgrade, doCancelUpgrade } from 'redux/actions/app';
import { doHideNotification } from 'lbry-redux';

View file

@ -2,10 +2,13 @@ import { connect } from 'react-redux';
import { doHideNotification } from 'lbry-redux';
import ModalTransactionFailed from './view';
const select = state => ({});
const select = () => ({});
const perform = dispatch => ({
closeModal: () => dispatch(doHideNotification()),
});
export default connect(select, perform)(ModalTransactionFailed);
export default connect(
select,
perform
)(ModalTransactionFailed);

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { selectDaemonSettings } from 'redux/selectors/settings';
import BackupPage from './view';
@ -7,4 +6,4 @@ const select = state => ({
daemonSettings: selectDaemonSettings(state),
});
export default connect(select, null)(BackupPage);
export default connect(select)(BackupPage);

View file

@ -1,20 +1,19 @@
import { connect } from 'react-redux';
import { selectPendingPublishes, selectClaimsWithPendingPublishes } from 'redux/selectors/publish';
import { selectIsFetchingClaimListMine, selectFileListPublishedSort } from 'lbry-redux';
import { selectPendingPublishes } from 'redux/selectors/publish';
import { selectIsFetchingClaimListMine, selectFileListPublishedSort, selectMyClaimsWithoutChannels } from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation';
import { doCheckPendingPublishes } from 'redux/actions/publish';
import FileListPublished from './view';
const select = state => ({
claims: selectClaimsWithPendingPublishes(state),
claims: selectMyClaimsWithoutChannels(state),
fetching: selectIsFetchingClaimListMine(state),
pendingPublishes: selectPendingPublishes(state),
sortBy: selectFileListPublishedSort(state),
});
const perform = dispatch => ({
navigate: path => dispatch(doNavigate(path)),
checkIfPublishesConfirmed: publishes => dispatch(doCheckPendingPublishes(publishes)),
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
});
export default connect(

View file

@ -1,4 +1,5 @@
// @flow
import type { Claim } from 'types/claim';
import React from 'react';
import Button from 'component/button';
import FileList from 'component/fileList';
@ -6,9 +7,8 @@ import Page from 'component/page';
import { PAGES } from 'lbry-redux';
type Props = {
pendingPublishes: Array<{}>,
claims: Array<{}>,
checkIfPublishesConfirmed: (Array<{}>) => void,
claims: Array<Claim>,
checkPendingPublishes: () => void,
navigate: (string, ?{}) => void,
fetching: boolean,
sortBy: string,
@ -16,10 +16,8 @@ type Props = {
class FileListPublished extends React.PureComponent<Props> {
componentDidMount() {
const { pendingPublishes, checkIfPublishesConfirmed } = this.props;
if (pendingPublishes.length) {
checkIfPublishesConfirmed(pendingPublishes);
}
const { checkPendingPublishes } = this.props;
checkPendingPublishes();
}
render() {

View file

@ -1,5 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import GetCreditsPage from './view';
export default connect(null, null)(GetCreditsPage);
export default GetCreditsPage;

View file

@ -26,7 +26,6 @@ type VersionInfo = {
os_release: string,
platform: string,
lbrynet_version: string,
lbryum_version: string,
};
type State = {
@ -209,10 +208,6 @@ class HelpPage extends React.PureComponent<Props, State> {
<td>{__('Daemon (lbrynet)')}</td>
<td>{ver.lbrynet_version}</td>
</tr>
<tr>
<td>{__('Wallet (lbryum)')}</td>
<td>{ver.lbryum_version}</td>
</tr>
<tr>
<td>{__('Connected Email')}</td>
<td>

View file

@ -1,5 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import SendReceivePage from './view';
export default connect(null, null)(SendReceivePage);
export default SendReceivePage;

View file

@ -3,7 +3,7 @@ import WalletSend from 'component/walletSend';
import WalletAddress from 'component/walletAddress';
import Page from 'component/page';
const SendReceivePage = props => (
const SendReceivePage = () => (
<Page>
<WalletSend />
<WalletAddress />

View file

@ -15,7 +15,6 @@ import {
} from 'redux/actions/subscriptions';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectFileListSubscriptionSort } from 'lbry-redux';
import SubscriptionsPage from './view';
const select = state => ({
@ -26,7 +25,6 @@ const select = state => ({
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
allSubscriptions: selectSubscriptionClaims(state),
unreadSubscriptions: selectUnreadSubscriptions(state),
sortBy: selectFileListSubscriptionSort(state),
viewMode: selectViewMode(state),
});

View file

@ -10,7 +10,7 @@ import FileList from 'component/fileList';
import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
import { FormField } from 'component/common/form';
import FileCard from 'component/fileCard';
import { parseURI, PAGES } from 'lbry-redux';
import { parseURI } from 'lbry-redux';
type Props = {
subscribedChannels: Array<string>, // The channels a user is subscribed to
@ -25,7 +25,6 @@ type Props = {
doSetViewMode: ViewMode => void,
doFetchMySubscriptions: () => void,
doSetClientSetting: (string, boolean) => void,
sortBy: string,
};
export default class extends React.PureComponent<Props> {
@ -45,19 +44,13 @@ export default class extends React.PureComponent<Props> {
}
renderSubscriptions() {
const { viewMode, unreadSubscriptions, allSubscriptions, sortBy } = this.props;
const { viewMode, unreadSubscriptions, allSubscriptions } = this.props;
if (viewMode === VIEW_ALL) {
return (
<React.Fragment>
<div className="card__title">{__('Your subscriptions')}</div>
<FileList
hideFilter
sortByHeight
fileInfos={allSubscriptions}
sortBy={sortBy}
page={PAGES.SUBSCRIPTIONS}
/>
<FileList hideFilter sortByHeight fileInfos={allSubscriptions} />
</React.Fragment>
);
}

View file

@ -1,5 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import WalletPage from './view';
export default connect(null, null)(WalletPage);
export default WalletPage;

View file

@ -292,7 +292,7 @@ export function doFetchClaimsByChannel(uri, page, pageSize) {
data: { uri, page },
});
Lbry.claim_list_by_channel({ uri, page: page || 1, page_size: pageSize || 48 }).then(result => {
Lbry.claim_list_by_channel({ uri, page: page || 1, page_size: pageSize || 20 }).then(result => {
const claimResult = result[uri] || {};
const { claims_in_channel: claimsInChannel, returned_page: returnedPage } = claimResult;

View file

@ -1,4 +1,11 @@
// @flow
import type { Dispatch, GetState } from 'types/redux';
import type { Source, Metadata } from 'types/claim';
import type {
UpdatePublishFormData,
UpdatePublishFormAction,
PublishParams,
} from 'redux/reducers/publish';
import {
ACTIONS,
Lbry,
@ -7,20 +14,14 @@ import {
selectMyChannelClaims,
THUMBNAIL_STATUSES,
batchActions,
creditsToString,
selectPendingById,
} from 'lbry-redux';
import { selectPendingPublishes } from 'redux/selectors/publish';
import type {
UpdatePublishFormData,
UpdatePublishFormAction,
PublishParams,
} from 'redux/reducers/publish';
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
import { doNavigate } from 'redux/actions/navigation';
import fs from 'fs';
import path from 'path';
import { CC_LICENSES, COPYRIGHT, OTHER } from 'constants/licenses';
import type { Dispatch, GetState } from 'types/redux';
import type { Source } from 'types/claim';
type Action = UpdatePublishFormAction | { type: ACTIONS.CLEAR_PUBLISH };
@ -229,7 +230,6 @@ export const doPublish = (params: PublishParams) => (
licenseUrl,
language,
thumbnail,
fee: fee || undefined,
description: description || undefined,
};
@ -237,16 +237,23 @@ export const doPublish = (params: PublishParams) => (
name: ?string,
channel_id: string,
bid: ?number,
metadata: ?any,
metadata: ?Metadata,
file_path?: string,
sources?: Source,
} = {
name,
channel_id: channelId,
bid,
bid: creditsToString(bid),
metadata,
};
if (fee) {
metadata.fee = {
currency: fee.currency,
amount: creditsToString(fee.amount),
};
}
if (filePath) {
publishPayload.file_path = filePath;
} else {
@ -258,7 +265,6 @@ export const doPublish = (params: PublishParams) => (
const success = () => {
dispatch({
type: ACTIONS.PUBLISH_SUCCESS,
data: { pendingPublish: { ...publishPayload } },
});
dispatch(doNotify({ id: MODALS.PUBLISH }, { uri }));
};
@ -274,28 +280,21 @@ export const doPublish = (params: PublishParams) => (
// Calls claim_list_mine until any pending publishes are confirmed
export const doCheckPendingPublishes = () => (dispatch: Dispatch<Action>, getState: GetState) => {
const state = getState();
const pendingPublishes = selectPendingPublishes(state);
const pendingById = selectPendingById(state);
if (!Object.keys(pendingById)) {
return;
}
let publishCheckInterval;
const checkFileList = () => {
Lbry.claim_list_mine().then(claims => {
const pendingPublishMap = {};
pendingPublishes.forEach(({ name }) => {
pendingPublishMap[name] = name;
});
const actions = [];
claims.forEach(claim => {
if (pendingPublishMap[claim.name]) {
actions.push({
type: ACTIONS.REMOVE_PENDING_PUBLISH,
data: {
name: claim.name,
},
});
// If it's confirmed, check that it wasn't pending previously
if (claim.confirmations > 0 && pendingById[claim.claim_id]) {
delete pendingById[claim.claim_id];
delete pendingPublishMap[claim.name];
// If it's confirmed, check if we should notify the user
if (selectosNotificationsEnabled(getState())) {
const notif = new window.Notification('LBRY Publish Complete', {
body: `${claim.value.stream.metadata.title} has been published to lbry://${
@ -314,25 +313,21 @@ export const doCheckPendingPublishes = () => (dispatch: Dispatch<Action>, getSta
}
});
actions.push({
dispatch({
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
data: {
claims,
},
});
dispatch(batchActions(...actions));
if (!Object.keys(pendingPublishMap).length) {
if (!Object.keys(pendingById).length) {
clearInterval(publishCheckInterval);
}
});
};
if (pendingPublishes.length) {
checkFileList();
publishCheckInterval = setInterval(() => {
checkFileList();
publishCheckInterval = setInterval(() => {
checkFileList();
}, 30000);
}
}, 30000);
};

View file

@ -100,7 +100,7 @@ export const doFetchMySubscriptions = () => (dispatch: ReduxDispatch, getState:
data: subscriptions,
});
subscriptions.forEach(({ uri }) => dispatch(doFetchClaimsByChannel(uri, 1, 20)));
subscriptions.forEach(({ uri }) => dispatch(doFetchClaimsByChannel(uri, 1)));
})
.catch(() => {
dispatch({
@ -205,7 +205,7 @@ export const doRemoveUnreadSubscription = (channelUri: string, readUri: string)
dispatch(doRemoveUnreadSubscriptions(channelUri, [readUri]));
};
export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: boolean) => async (
export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: boolean) => (
dispatch: ReduxDispatch,
getState: GetState
) => {
@ -223,85 +223,86 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
);
}
const claimListByChannel = await Lbry.claim_list_by_channel({ uri: subscriptionUri, page: 1 });
const claimResult = claimListByChannel[subscriptionUri] || {};
const { claims_in_channel: claimsInChannel } = claimResult;
Lbry.claim_list_by_channel({ uri: subscriptionUri, page: 1 }).then(claimListByChannel => {
const claimResult = claimListByChannel[subscriptionUri] || {};
const { claims_in_channel: claimsInChannel } = claimResult;
// may happen if subscribed to an abandoned channel or an empty channel
if (!claimsInChannel || !claimsInChannel.length) {
return;
}
// may happen if subscribed to an abandoned channel or an empty channel
if (!claimsInChannel || !claimsInChannel.length) {
return;
}
// Determine if the latest subscription currently saved is actually the latest subscription
const latestIndex = claimsInChannel.findIndex(
claim => `${claim.name}#${claim.claim_id}` === savedSubscription.latest
);
// Determine if the latest subscription currently saved is actually the latest subscription
const latestIndex = claimsInChannel.findIndex(
claim => `${claim.name}#${claim.claim_id}` === savedSubscription.latest
);
// If latest is -1, it is a newly subscribed channel or there have been 10+ claims published since last viewed
const latestIndexToNotify = latestIndex === -1 ? 10 : latestIndex;
// If latest is -1, it is a newly subscribed channel or there have been 10+ claims published since last viewed
const latestIndexToNotify = latestIndex === -1 ? 10 : latestIndex;
// If latest is 0, nothing has changed
// Do not download/notify about new content, it would download/notify 10 claims per channel
if (latestIndex !== 0 && savedSubscription.latest) {
let downloadCount = 0;
// If latest is 0, nothing has changed
// Do not download/notify about new content, it would download/notify 10 claims per channel
if (latestIndex !== 0 && savedSubscription.latest) {
let downloadCount = 0;
const newUnread = [];
claimsInChannel.slice(0, latestIndexToNotify).forEach(claim => {
const uri = buildURI({ contentName: claim.name, claimId: claim.claim_id }, true);
const shouldDownload =
shouldAutoDownload &&
Boolean(downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee);
const newUnread = [];
claimsInChannel.slice(0, latestIndexToNotify).forEach(claim => {
const uri = buildURI({ contentName: claim.name, claimId: claim.claim_id }, true);
const shouldDownload =
shouldAutoDownload &&
Boolean(downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee);
// Add the new content to the list of "un-read" subscriptions
if (shouldNotify) {
newUnread.push(uri);
}
// Add the new content to the list of "un-read" subscriptions
if (shouldNotify) {
newUnread.push(uri);
}
if (shouldDownload) {
downloadCount += 1;
dispatch(doPurchaseUri(uri, { cost: 0 }, true));
}
});
if (shouldDownload) {
downloadCount += 1;
dispatch(doPurchaseUri(uri, { cost: 0 }, true));
}
});
dispatch(
doUpdateUnreadSubscriptions(
subscriptionUri,
newUnread,
downloadCount > 0 ? NOTIFICATION_TYPES.DOWNLOADING : NOTIFICATION_TYPES.NOTIFY_ONLY
)
);
}
// Set the latest piece of content for a channel
// This allows the app to know if there has been new content since it was last set
dispatch(
doUpdateUnreadSubscriptions(
subscriptionUri,
newUnread,
downloadCount > 0 ? NOTIFICATION_TYPES.DOWNLOADING : NOTIFICATION_TYPES.NOTIFY_ONLY
setSubscriptionLatest(
{
channelName: claimsInChannel[0].channel_name,
uri: buildURI(
{
channelName: claimsInChannel[0].channel_name,
claimId: claimsInChannel[0].claim_id,
},
false
),
},
buildURI(
{ contentName: claimsInChannel[0].name, claimId: claimsInChannel[0].claim_id },
false
)
)
);
}
// Set the latest piece of content for a channel
// This allows the app to know if there has been new content since it was last set
dispatch(
setSubscriptionLatest(
{
channelName: claimsInChannel[0].channel_name,
uri: buildURI(
{
channelName: claimsInChannel[0].channel_name,
claimId: claimsInChannel[0].claim_id,
},
false
),
// calling FETCH_CHANNEL_CLAIMS_COMPLETED after not calling STARTED
// means it will delete a non-existant fetchingChannelClaims[uri]
dispatch({
type: ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED,
data: {
uri: subscriptionUri,
claims: claimsInChannel || [],
page: 1,
},
buildURI(
{ contentName: claimsInChannel[0].name, claimId: claimsInChannel[0].claim_id },
false
)
)
);
// calling FETCH_CHANNEL_CLAIMS_COMPLETED after not calling STARTED
// means it will delete a non-existant fetchingChannelClaims[uri]
dispatch({
type: ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED,
data: {
uri: subscriptionUri,
claims: claimsInChannel || [],
page: 1,
},
});
});
};

View file

@ -29,7 +29,6 @@ type PublishState = {
bidError: ?string,
otherLicenseDescription: string,
licenseUrl: string,
pendingPublishes: Array<any>,
};
export type UpdatePublishFormData = {
@ -115,7 +114,6 @@ const defaultState: PublishState = {
publishing: false,
publishSuccess: false,
publishError: undefined,
pendingPublishes: [],
};
export default handleActions(
@ -127,10 +125,9 @@ export default handleActions(
...data,
};
},
[ACTIONS.CLEAR_PUBLISH]: (state: PublishState): PublishState => {
const { pendingPublishes } = state;
return { ...defaultState, pendingPublishes };
},
[ACTIONS.CLEAR_PUBLISH]: (): PublishState => ({
...defaultState,
}),
[ACTIONS.PUBLISH_START]: (state: PublishState): PublishState => ({
...state,
publishing: true,
@ -139,29 +136,11 @@ export default handleActions(
...state,
publishing: false,
}),
[ACTIONS.PUBLISH_SUCCESS]: (state: PublishState, action): PublishState => {
const { pendingPublish } = action.data;
const newPendingPublishes = state.pendingPublishes.slice();
newPendingPublishes.push(pendingPublish);
return {
...state,
publishing: false,
pendingPublishes: newPendingPublishes,
};
},
[ACTIONS.REMOVE_PENDING_PUBLISH]: (state: PublishState, action) => {
const { name } = action.data;
const pendingPublishes = state.pendingPublishes.filter(publish => publish.name !== name);
return {
...state,
pendingPublishes,
};
},
[ACTIONS.PUBLISH_SUCCESS]: (state: PublishState): PublishState => ({
...state,
publishing: false,
}),
[ACTIONS.DO_PREPARE_EDIT]: (state: PublishState, action) => {
const { pendingPublishes } = state;
const { ...publishData } = action.data;
const { channel, name, uri } = publishData;
@ -175,7 +154,6 @@ export default handleActions(
return {
...defaultState,
...publishData,
pendingPublishes,
editingURI: uri,
uri: shortUri,
};

View file

@ -10,47 +10,11 @@ import {
const selectState = state => state.publish || {};
export const selectPendingPublishes = createSelector(
selectState,
state => state.pendingPublishes.map(pendingClaim => ({ ...pendingClaim, pending: true })) || []
);
export const selectClaimsWithPendingPublishes = createSelector(
selectMyClaimsWithoutChannels,
selectPendingPublishes,
(claims, pendingPublishes) => {
// ensure there are no duplicates, they are being checked for in a setInterval
// no need to wait for it to complete though
// loop through myclaims
// if a claim has the same name as one in pendingPublish, remove it from pending
const claimMap = {};
claims.forEach(claim => {
claimMap[claim.name] = true;
});
const filteredPendingPublishes = pendingPublishes.filter(claim => !claimMap[claim.name]);
return [...filteredPendingPublishes, ...claims];
}
);
export const selectPublishFormValues = createSelector(selectState, state => {
const { pendingPublish, ...formValues } = state;
return formValues;
});
export const selectPendingPublish = uri =>
createSelector(selectPendingPublishes, pendingPublishes => {
const { claimName, contentName } = parseURI(uri);
if (!pendingPublishes.length) {
return null;
}
return pendingPublishes.filter(
publish => publish.name === claimName || publish.name === contentName
)[0];
});
// Is the current uri the same as the uri they clicked "edit" on
export const selectIsStillEditing = createSelector(selectPublishFormValues, publishState => {
const { editingURI, uri } = publishState;

View file

@ -227,8 +227,7 @@
.card__subtitle {
color: $lbry-gray-5;
font-size: .9em;
line-height: .9em;
font-size: 0.9em;
padding-top: $spacing-vertical * 1/3;
@media (min-width: $large-breakpoint) {

View file

@ -92,7 +92,7 @@
}
.form-field__error {
color: $lbry-red-5;
color: $lbry-red-3 !important;
}
.form-field__help {

View file

@ -115,4 +115,19 @@ html[data-theme='dark'] {
.item-list__item:not(:last-of-type) {
border-bottom: 1px solid rgba($lbry-gray-1, 0.1);
}
.modal-overlay,
.error-modal-overlay {
background-color: rgba($lbry-black, 0.7);
}
.btn {
color: $lbry-gray-3;
}
.modal {
background-color: rgba($lbry-black, 0.9);
border: 1px solid rgba($lbry-gray-1, 0.1);
color: $lbry-gray-3;
}
}

View file

@ -1,5 +1,7 @@
export function formatCredits(amount, precision) {
return amount.toFixed(precision || 1).replace(/\.?0+$/, '');
export function formatCredits(amount, precision = 1) {
return parseFloat(amount)
.toFixed(precision || 1)
.replace(/\.?0+$/, '');
}
export function formatFullPrice(amount, precision = 1) {

View file

@ -13,7 +13,6 @@ const isDev = PROCESS_ARGV && PROCESS_ARGV.original &&
module.exports = {
// This rule is temporarily necessary until https://github.com/electron-userland/electron-webpack/issues/60 is fixed.
entry: ['babel-polyfill', `${ELECTRON_RENDERER_PROCESS_ROOT}/index.js`],
module: {
rules: [
{

View file

@ -5663,25 +5663,25 @@ lazy-val@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc"
lbry-redux@lbryio/lbry-redux:
lbry-redux@lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/a8e81949837171e94e649fce6f7c7a8b7faadd51"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2375860d6269d0369418879c2531b1d48c4e47f2"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
lbry-redux@lbryio/lbry-redux#03aea43da5f12bc01546a92bdf460ebd08681013:
lbry-redux@lbryio/lbry-redux#f193d38c61ea061679ebc7b4ca139a0e9c95ef8a:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/03aea43da5f12bc01546a92bdf460ebd08681013"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/f193d38c61ea061679ebc7b4ca139a0e9c95ef8a"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
lbryinc@lbryio/lbryinc#3f34af546ee73ff2ee7d8ad05e540b3b0aa658fb:
lbryinc@lbryio/lbryinc#7a458ea13ceceffa0191e73139f94e5c953f22b1:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/3f34af546ee73ff2ee7d8ad05e540b3b0aa658fb"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/7a458ea13ceceffa0191e73139f94e5c953f22b1"
dependencies:
lbry-redux lbryio/lbry-redux
lbry-redux lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2
reselect "^3.0.0"
lcid@^1.0.0: