Upgrade daemon to 0.19.0 #1032

Merged
liamcardenas merged 15 commits from daemon19 into master 2018-03-09 08:53:39 +01:00
17 changed files with 78 additions and 75 deletions

View file

@ -116,7 +116,7 @@
}, },
"license": "MIT", "license": "MIT",
"lbrySettings": { "lbrySettings": {
"lbrynetDaemonVersion": "0.18.2", "lbrynetDaemonVersion": "0.19.0",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip" "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip"
} }
} }

View file

@ -1,8 +1,11 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import FileList from './view'; import FileList from './view';
import { selectClaimsById } from 'redux/selectors/claims';
const select = state => ({}); const select = state => ({
claimsById: selectClaimsById(state),
});
const perform = dispatch => ({}); const perform = dispatch => ({});

View file

@ -13,48 +13,53 @@ class FileList extends React.PureComponent {
}; };
this._sortFunctions = { this._sortFunctions = {
dateNew(fileInfos) { dateNew: fileInfos =>
return fileInfos.slice().sort((fileInfo1, fileInfo2) => { fileInfos.slice().sort((fileInfo1, fileInfo2) => {
const height1 = fileInfo1.height; const height1 = this.props.claimsById[fileInfo1.claim_id]
const height2 = fileInfo2.height; ? this.props.claimsById[fileInfo1.claim_id].height
: 0;
const height2 = this.props.claimsById[fileInfo2.claim_id]
? this.props.claimsById[fileInfo2.claim_id].height
: 0;
if (height1 > height2) { if (height1 > height2) {
return -1; return -1;
} else if (height1 < height2) { } else if (height1 < height2) {
return 1; return 1;
} }
return 0; return 0;
}); }),
}, dateOld: fileInfos =>
dateOld(fileInfos) { fileInfos.slice().sort((fileInfo1, fileInfo2) => {
return fileInfos.slice().sort((fileInfo1, fileInfo2) => { const height1 = this.props.claimsById[fileInfo1.claim_id]
const height1 = fileInfo1.height; ? this.props.claimsById[fileInfo1.claim_id].height
const height2 = fileInfo2.height; : 999999;
const height2 = this.props.claimsById[fileInfo2.claim_id]
? this.props.claimsById[fileInfo2.claim_id].height
: 999999;
if (height1 < height2) { if (height1 < height2) {
return -1; return -1;
} else if (height1 > height2) { } else if (height1 > height2) {
return 1; return 1;
} }
return 0; return 0;
}); }),
}, title: fileInfos =>
title(fileInfos) { fileInfos.slice().sort((fileInfo1, fileInfo2) => {
return fileInfos.slice().sort((fileInfo1, fileInfo2) => {
const title1 = fileInfo1.value const title1 = fileInfo1.value
? fileInfo1.value.stream.metadata.title.toLowerCase() ? fileInfo1.value.stream.metadata.title.toLowerCase()
: fileInfo1.name; : fileInfo1.claim_name;
const title2 = fileInfo2.value const title2 = fileInfo2.value
? fileInfo2.value.stream.metadata.title.toLowerCase() ? fileInfo2.value.stream.metadata.title.toLowerCase()
: fileInfo2.name; : fileInfo2.claim_name;
if (title1 < title2) { if (title1 < title2) {
return -1; return -1;
} else if (title1 > title2) { } else if (title1 > title2) {
return 1; return 1;
} }
return 0; return 0;
}); }),
}, filename: fileInfos =>
filename(fileInfos) { fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => {
return fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => {
const fileName1Lower = fileName1.toLowerCase(); const fileName1Lower = fileName1.toLowerCase();
const fileName2Lower = fileName2.toLowerCase(); const fileName2Lower = fileName2.toLowerCase();
if (fileName1Lower < fileName2Lower) { if (fileName1Lower < fileName2Lower) {
@ -63,8 +68,7 @@ class FileList extends React.PureComponent {
return 1; return 1;
} }
return 0; return 0;
}); }),
},
}; };
} }
@ -72,7 +76,7 @@ class FileList extends React.PureComponent {
if (fileInfo.value) { if (fileInfo.value) {
return fileInfo.value.publisherSignature.certificateId; return fileInfo.value.publisherSignature.certificateId;
} }
return fileInfo.metadata.publisherSignature.certificateId; return fileInfo.channel_claim_id;
} }
handleSortChanged(event) { handleSortChanged(event) {
@ -91,11 +95,11 @@ class FileList extends React.PureComponent {
if (fileInfo.channel_name) { if (fileInfo.channel_name) {
uriParams.channelName = fileInfo.channel_name; uriParams.channelName = fileInfo.channel_name;
uriParams.contentName = fileInfo.name; uriParams.contentName = fileInfo.claim_name || fileInfo.name;
uriParams.claimId = this.getChannelSignature(fileInfo); uriParams.claimId = this.getChannelSignature(fileInfo);
} else { } else {
uriParams.claimId = fileInfo.claim_id; uriParams.claimId = fileInfo.claim_id;
uriParams.name = fileInfo.name; uriParams.claimName = fileInfo.claim_name || fileInfo.name;
} }
const uri = buildURI(uriParams); const uri = buildURI(uriParams);

View file

@ -45,7 +45,7 @@ class FileListSearch extends React.PureComponent {
{uris && uris.length {uris && uris.length
? uris.map( ? uris.map(
uri => uri =>
parseURI(uri).name[0] === '@' ? ( parseURI(uri).claimName[0] === '@' ? (
<ChannelTile key={uri} uri={uri} /> <ChannelTile key={uri} uri={uri} />
) : ( ) : (
<FileTile key={uri} uri={uri} /> <FileTile key={uri} uri={uri} />

View file

@ -74,7 +74,7 @@ class TransactionListItem extends React.PureComponent {
<Link <Link
className="button-text" className="button-text"
navigate="/show" navigate="/show"
navigateParams={{ uri: buildURI({ name, claimId }) }} navigateParams={{ uri: buildURI({ claimName: name, claimId }) }}
> >
{name} {name}
</Link> </Link>

View file

@ -33,9 +33,7 @@ class UserPhoneVerify extends React.PureComponent {
<Form onSubmit={this.handleSubmit.bind(this)}> <Form onSubmit={this.handleSubmit.bind(this)}>
<p> <p>
{__( {__(
`Please enter the verification code sent to +${countryCode}${ `Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? `
phone
}. Didn't receive it? `
)} )}
<Link onClick={this.reset.bind(this)} label="Go back." /> <Link onClick={this.reset.bind(this)} label="Go back." />
</p> </p>

View file

@ -62,8 +62,8 @@ 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 FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED';
export const ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED'; export const ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED';
export const ABANDON_CLAIM_SUCCEEDED = 'ABANDON_CLAIM_SUCCEEDED'; export const ABANDON_CLAIM_SUCCEEDED = 'ABANDON_CLAIM_SUCCEEDED';
export const FETCH_CHANNEL_LIST_MINE_STARTED = 'FETCH_CHANNEL_LIST_MINE_STARTED'; export const FETCH_CHANNEL_LIST_STARTED = 'FETCH_CHANNEL_LIST_STARTED';
export const FETCH_CHANNEL_LIST_MINE_COMPLETED = 'FETCH_CHANNEL_LIST_MINE_COMPLETED'; export const FETCH_CHANNEL_LIST_COMPLETED = 'FETCH_CHANNEL_LIST_COMPLETED';
export const CREATE_CHANNEL_STARTED = 'CREATE_CHANNEL_STARTED'; export const CREATE_CHANNEL_STARTED = 'CREATE_CHANNEL_STARTED';
export const CREATE_CHANNEL_COMPLETED = 'CREATE_CHANNEL_COMPLETED'; export const CREATE_CHANNEL_COMPLETED = 'CREATE_CHANNEL_COMPLETED';
export const PUBLISH_STARTED = 'PUBLISH_STARTED'; export const PUBLISH_STARTED = 'PUBLISH_STARTED';

View file

@ -211,11 +211,11 @@ Lbry.getAppVersionInfo = () =>
/** /**
* Returns results from the file_list API method, plus dummy entries for pending publishes. * Returns results from the file_list API method, plus dummy entries for pending publishes.
* (If a real publish with the same name is found, the pending publish will be ignored and removed.) * (If a real publish with the same claim name is found, the pending publish will be ignored and removed.)
*/ */
Lbry.file_list = (params = {}) => Lbry.file_list = (params = {}) =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
const { name, channel_name: channelName, outpoint } = params; const { claim_name: claimName, channel_name: channelName, outpoint } = params;
/** /**
* If we're searching by outpoint, check first to see if there's a matching pending publish. * If we're searching by outpoint, check first to see if there's a matching pending publish.
@ -234,10 +234,10 @@ Lbry.file_list = (params = {}) =>
'file_list', 'file_list',
params, params,
fileInfos => { fileInfos => {
removePendingPublishIfNeeded({ name, channelName, outpoint }); removePendingPublishIfNeeded({ name: claimName, channelName, outpoint });
// if a naked file_list call, append the pending file infos // if a naked file_list call, append the pending file infos
if (!name && !channelName && !outpoint) { if (!claimName && !channelName && !outpoint) {
const dummyFileInfos = Lbry.getPendingPublishes().map(pendingPublishToDummyFileInfo); const dummyFileInfos = Lbry.getPendingPublishes().map(pendingPublishToDummyFileInfo);
resolve([...fileInfos, ...dummyFileInfos]); resolve([...fileInfos, ...dummyFileInfos]);

View file

@ -30,11 +30,11 @@ export function parseURI(URI, requireProto = false) {
// Break into components. Empty sub-matches are converted to null // Break into components. Empty sub-matches are converted to null
const componentsRegex = new RegExp( const componentsRegex = new RegExp(
'^((?:lbry://)?)' + // protocol '^((?:lbry://)?)' + // protocol
'([^:$#/]*)' + // name (stops at the first separator or end) '([^:$#/]*)' + // claim name (stops at the first separator or end)
'([:$#]?)([^/]*)' + // modifier separator, modifier (stops at the first path separator or end) '([:$#]?)([^/]*)' + // modifier separator, modifier (stops at the first path separator or end)
'(/?)(.*)' // path separator, path '(/?)(.*)' // path separator, path
); );
const [proto, name, modSep, modVal, pathSep, path] = componentsRegex const [proto, claimName, modSep, modVal, pathSep, path] = componentsRegex
.exec(URI) .exec(URI)
.slice(1) .slice(1)
.map(match => match || null); .map(match => match || null);
@ -47,12 +47,12 @@ export function parseURI(URI, requireProto = false) {
} }
// Validate and process name // Validate and process name
if (!name) { if (!claimName) {
throw new Error(__('URI does not include name.')); throw new Error(__('URI does not include name.'));
} }
const isChannel = name.startsWith('@'); const isChannel = claimName.startsWith('@');
const channelName = isChannel ? name.slice(1) : name; const channelName = isChannel ? claimName.slice(1) : claimName;
if (isChannel) { if (isChannel) {
if (!channelName) { if (!channelName) {
@ -66,7 +66,7 @@ export function parseURI(URI, requireProto = false) {
contentName = path; contentName = path;
} }
const nameBadChars = (channelName || name).match(regexInvalidURI); const nameBadChars = (channelName || claimName).match(regexInvalidURI);
if (nameBadChars) { if (nameBadChars) {
throw new Error( throw new Error(
__( __(
@ -128,7 +128,7 @@ export function parseURI(URI, requireProto = false) {
} }
return { return {
name, claimName,
path, path,
isChannel, isChannel,
...(contentName ? { contentName } : {}), ...(contentName ? { contentName } : {}),
@ -148,24 +148,24 @@ export function parseURI(URI, requireProto = false) {
export function buildURI(URIObj, includeProto = true) { export function buildURI(URIObj, includeProto = true) {
const { claimId, claimSequence, bidPosition, contentName, channelName } = URIObj; const { claimId, claimSequence, bidPosition, contentName, channelName } = URIObj;
let { name, path } = URIObj; let { claimName, path } = URIObj;
if (channelName) { if (channelName) {
const channelNameFormatted = channelName.startsWith('@') ? channelName : `@${channelName}`; const channelNameFormatted = channelName.startsWith('@') ? channelName : `@${channelName}`;
if (!name) { if (!claimName) {
name = channelNameFormatted; claimName = channelNameFormatted;
} else if (name !== channelNameFormatted) { } else if (claimName !== channelNameFormatted) {
throw new Error( throw new Error(
__( __(
'Received a channel content URI, but name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.' 'Received a channel content URI, but claim name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.'
) )
); );
} }
} }
if (contentName) { if (contentName) {
if (!name) { if (!claimName) {
name = contentName; claimName = contentName;
} else if (!path) { } else if (!path) {
path = contentName; path = contentName;
} }
@ -180,7 +180,7 @@ export function buildURI(URIObj, includeProto = true) {
return ( return (
(includeProto ? 'lbry://' : '') + (includeProto ? 'lbry://' : '') +
name + claimName +
(claimId ? `#${claimId}` : '') + (claimId ? `#${claimId}` : '') +
(claimSequence ? `:${claimSequence}` : '') + (claimSequence ? `:${claimSequence}` : '') +
(bidPosition ? `${bidPosition}` : '') + (bidPosition ? `${bidPosition}` : '') +
@ -192,8 +192,8 @@ export function buildURI(URIObj, includeProto = true) {
export function normalizeURI(URI) { export function normalizeURI(URI) {
if (URI.match(/pending_claim/)) return URI; if (URI.match(/pending_claim/)) return URI;
const { name, path, bidPosition, claimSequence, claimId } = parseURI(URI); const { claimName, path, bidPosition, claimSequence, claimId } = parseURI(URI);
return buildURI({ name, path, claimSequence, bidPosition, claimId }); return buildURI({ claimName, path, claimSequence, bidPosition, claimId });
} }
export function isURIValid(URI) { export function isURIValid(URI) {
@ -203,12 +203,12 @@ export function isURIValid(URI) {
} catch (error) { } catch (error) {
return false; return false;
} }
return parts && parts.name; return parts && parts.claimName;
} }
export function isNameValid(name, checkCase = true) { export function isNameValid(claimName, checkCase = true) {
const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i'); const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i');
return regexp.test(name); return regexp.test(claimName);
} }
export function isURIClaimable(URI) { export function isURIClaimable(URI) {
@ -220,7 +220,7 @@ export function isURIClaimable(URI) {
} }
return ( return (
parts && parts &&
parts.name && parts.claimName &&
!parts.claimId && !parts.claimId &&
!parts.bidPosition && !parts.bidPosition &&
!parts.claimSequence && !parts.claimSequence &&

View file

@ -58,7 +58,7 @@ class ChannelPage extends React.PureComponent {
<FileTile <FileTile
key={claim.claim_id} key={claim.claim_id}
uri={buildURI({ uri={buildURI({
name: claim.name, claimName: claim.name,
claimId: claim.claim_id, claimId: claim.claim_id,
})} })}
showLocal showLocal

View file

@ -277,9 +277,7 @@ export function doLoadVideo(uri) {
}); });
dispatch( dispatch(
doAlertError( doAlertError(
`Failed to download ${ `Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`
uri
}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`
) )
); );
}); });
@ -436,17 +434,17 @@ export function doPlayUri(uri) {
export function doFetchChannelListMine() { export function doFetchChannelListMine() {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: ACTIONS.FETCH_CHANNEL_LIST_MINE_STARTED, type: ACTIONS.FETCH_CHANNEL_LIST_STARTED,
}); });
const callback = channels => { const callback = channels => {
dispatch({ dispatch({
type: ACTIONS.FETCH_CHANNEL_LIST_MINE_COMPLETED, type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED,
data: { claims: channels }, data: { claims: channels },
}); });
}; };
Lbry.channel_list_mine().then(callback); Lbry.channel_list().then(callback);
}; };
} }
@ -523,7 +521,7 @@ export function doAbandonClaim(txid, nout) {
claimId, claimId,
}, },
}); });
dispatch(doResolveUri(buildURI({ name, claimId }))); dispatch(doResolveUri(buildURI({ claimName: name, claimId })));
dispatch(doFetchClaimListMine()); dispatch(doFetchClaimListMine());
} else { } else {
dispatch(doOpenModal(MODALS.TRANSACTION_FAILED)); dispatch(doOpenModal(MODALS.TRANSACTION_FAILED));

View file

@ -41,7 +41,7 @@ export function doSearch(rawQuery) {
data.forEach(result => { data.forEach(result => {
const uri = buildURI({ const uri = buildURI({
name: result.name, claimName: result.name,
claimId: result.claimId, claimId: result.claimId,
}); });
actions.push(doResolveUri(uri)); actions.push(doResolveUri(uri));

View file

@ -35,7 +35,7 @@ export function doFetchTransactions() {
type: ACTIONS.FETCH_TRANSACTIONS_STARTED, type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
}); });
Lbry.transaction_list({ include_tip_info: true }).then(results => { Lbry.transaction_list().then(results => {
dispatch({ dispatch({
type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED, type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED,
data: { data: {

View file

@ -71,10 +71,10 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => {
}); });
}; };
reducers[ACTIONS.FETCH_CHANNEL_LIST_MINE_STARTED] = state => reducers[ACTIONS.FETCH_CHANNEL_LIST_STARTED] = state =>
Object.assign({}, state, { fetchingMyChannels: true }); Object.assign({}, state, { fetchingMyChannels: true });
reducers[ACTIONS.FETCH_CHANNEL_LIST_MINE_COMPLETED] = (state, action) => { reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => {
const { claims } = action.data; const { claims } = action.data;
const myChannelClaims = new Set(state.myChannelClaims); const myChannelClaims = new Set(state.myChannelClaims);
const byId = Object.assign({}, state.byId); const byId = Object.assign({}, state.byId);

View file

@ -51,7 +51,7 @@ $md-checkmark-color: #fff;
border: none; border: none;
} }
+ label:after { + label:after {
$md-checkmark-size: $md-checkbox-size - 2*$md-checkbox-padding; $md-checkmark-size: $md-checkbox-size - 2 * $md-checkbox-padding;
transform: rotate(-45deg); transform: rotate(-45deg);

View file

@ -18,7 +18,7 @@ table.table-standard {
vertical-align: bottom; vertical-align: bottom;
font-weight: 500; font-weight: 500;
font-size: 0.9em; font-size: 0.9em;
padding: $spacing-vertical/4+1 8px $spacing-vertical/4-2; padding: $spacing-vertical/4 + 1 8px $spacing-vertical/4-2;
text-align: left; text-align: left;
border-bottom: var(--table-border); border-bottom: var(--table-border);
img { img {

View file

@ -20,14 +20,14 @@
border: var(--tooltip-border); border: var(--tooltip-border);
color: var(--tooltip-color); color: var(--tooltip-color);
background-color: var(--tooltip-bg); background-color: var(--tooltip-bg);
font-size: calc(var(--font-size) * 7/8); font-size: calc(var(--font-size) * 7 / 8);
line-height: var(--font-line-height); line-height: var(--font-line-height);
box-shadow: var(--box-shadow-layer); box-shadow: var(--box-shadow-layer);
} }
.tooltip--header .tooltip__link { .tooltip--header .tooltip__link {
@include text-link(#aaa); @include text-link(#aaa);
font-size: calc(var(--font-size) * 3/4); font-size: calc(var(--font-size) * 3 / 4);
margin-left: var(--button-padding); margin-left: var(--button-padding);
vertical-align: middle; vertical-align: middle;
} }