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",
"lbrySettings": {
"lbrynetDaemonVersion": "0.18.2",
"lbrynetDaemonVersion": "0.19.0",
"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 { connect } from 'react-redux';
import FileList from './view';
import { selectClaimsById } from 'redux/selectors/claims';
const select = state => ({});
const select = state => ({
claimsById: selectClaimsById(state),
});
const perform = dispatch => ({});

View file

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

View file

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

View file

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

View file

@ -33,9 +33,7 @@ class UserPhoneVerify extends React.PureComponent {
<Form onSubmit={this.handleSubmit.bind(this)}>
<p>
{__(
`Please enter the verification code sent to +${countryCode}${
phone
}. Didn't receive it? `
`Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? `
)}
<Link onClick={this.reset.bind(this)} label="Go back." />
</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 ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED';
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_MINE_COMPLETED = 'FETCH_CHANNEL_LIST_MINE_COMPLETED';
export const FETCH_CHANNEL_LIST_STARTED = 'FETCH_CHANNEL_LIST_STARTED';
export const FETCH_CHANNEL_LIST_COMPLETED = 'FETCH_CHANNEL_LIST_COMPLETED';
export const CREATE_CHANNEL_STARTED = 'CREATE_CHANNEL_STARTED';
export const CREATE_CHANNEL_COMPLETED = 'CREATE_CHANNEL_COMPLETED';
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.
* (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 = {}) =>
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.
@ -234,10 +234,10 @@ Lbry.file_list = (params = {}) =>
'file_list',
params,
fileInfos => {
removePendingPublishIfNeeded({ name, channelName, outpoint });
removePendingPublishIfNeeded({ name: claimName, channelName, outpoint });
// 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);
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
const componentsRegex = new RegExp(
'^((?: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)
'(/?)(.*)' // path separator, path
);
const [proto, name, modSep, modVal, pathSep, path] = componentsRegex
const [proto, claimName, modSep, modVal, pathSep, path] = componentsRegex
.exec(URI)
.slice(1)
.map(match => match || null);
@ -47,12 +47,12 @@ export function parseURI(URI, requireProto = false) {
}
// Validate and process name
if (!name) {
if (!claimName) {
throw new Error(__('URI does not include name.'));
}
const isChannel = name.startsWith('@');
const channelName = isChannel ? name.slice(1) : name;
const isChannel = claimName.startsWith('@');
const channelName = isChannel ? claimName.slice(1) : claimName;
if (isChannel) {
if (!channelName) {
@ -66,7 +66,7 @@ export function parseURI(URI, requireProto = false) {
contentName = path;
}
const nameBadChars = (channelName || name).match(regexInvalidURI);
const nameBadChars = (channelName || claimName).match(regexInvalidURI);
if (nameBadChars) {
throw new Error(
__(
@ -128,7 +128,7 @@ export function parseURI(URI, requireProto = false) {
}
return {
name,
claimName,
path,
isChannel,
...(contentName ? { contentName } : {}),
@ -148,24 +148,24 @@ export function parseURI(URI, requireProto = false) {
export function buildURI(URIObj, includeProto = true) {
const { claimId, claimSequence, bidPosition, contentName, channelName } = URIObj;
let { name, path } = URIObj;
let { claimName, path } = URIObj;
if (channelName) {
const channelNameFormatted = channelName.startsWith('@') ? channelName : `@${channelName}`;
if (!name) {
name = channelNameFormatted;
} else if (name !== channelNameFormatted) {
if (!claimName) {
claimName = channelNameFormatted;
} else if (claimName !== channelNameFormatted) {
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 (!name) {
name = contentName;
if (!claimName) {
claimName = contentName;
} else if (!path) {
path = contentName;
}
@ -180,7 +180,7 @@ export function buildURI(URIObj, includeProto = true) {
return (
(includeProto ? 'lbry://' : '') +
name +
claimName +
(claimId ? `#${claimId}` : '') +
(claimSequence ? `:${claimSequence}` : '') +
(bidPosition ? `${bidPosition}` : '') +
@ -192,8 +192,8 @@ export function buildURI(URIObj, includeProto = true) {
export function normalizeURI(URI) {
if (URI.match(/pending_claim/)) return URI;
const { name, path, bidPosition, claimSequence, claimId } = parseURI(URI);
return buildURI({ name, path, claimSequence, bidPosition, claimId });
const { claimName, path, bidPosition, claimSequence, claimId } = parseURI(URI);
return buildURI({ claimName, path, claimSequence, bidPosition, claimId });
}
export function isURIValid(URI) {
@ -203,12 +203,12 @@ export function isURIValid(URI) {
} catch (error) {
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');
return regexp.test(name);
return regexp.test(claimName);
}
export function isURIClaimable(URI) {
@ -220,7 +220,7 @@ export function isURIClaimable(URI) {
}
return (
parts &&
parts.name &&
parts.claimName &&
!parts.claimId &&
!parts.bidPosition &&
!parts.claimSequence &&

View file

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

View file

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

View file

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

View file

@ -35,7 +35,7 @@ export function doFetchTransactions() {
type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
});
Lbry.transaction_list({ include_tip_info: true }).then(results => {
Lbry.transaction_list().then(results => {
dispatch({
type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED,
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 });
reducers[ACTIONS.FETCH_CHANNEL_LIST_MINE_COMPLETED] = (state, action) => {
reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => {
const { claims } = action.data;
const myChannelClaims = new Set(state.myChannelClaims);
const byId = Object.assign({}, state.byId);

View file

@ -51,7 +51,7 @@ $md-checkmark-color: #fff;
border: none;
}
+ 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);

View file

@ -18,7 +18,7 @@ table.table-standard {
vertical-align: bottom;
font-weight: 500;
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;
border-bottom: var(--table-border);
img {

View file

@ -20,14 +20,14 @@
border: var(--tooltip-border);
color: var(--tooltip-color);
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);
box-shadow: var(--box-shadow-layer);
}
.tooltip--header .tooltip__link {
@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);
vertical-align: middle;
}