canonical_url related fixes

This commit is contained in:
Sean Yesmunt 2019-08-27 19:36:41 -04:00
parent 2e91167fc3
commit 14cd37ac05
8 changed files with 29 additions and 28 deletions

View file

@ -126,7 +126,7 @@
"husky": "^0.14.3",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#5925d562c802581538bb88f52e959ef7a135d1ec",
"lbry-redux": "lbryio/lbry-redux#18ff574d0ea5769866efa84e946e16d689283566",
"lbryinc": "lbryio/lbryinc#1ce266b3c52654190b955e9c869b8e302aa5c585",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { makeSelectFilePartlyDownloaded, makeSelectClaimIsMine } from 'lbry-redux';
import { makeSelectFilePartlyDownloaded, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
import { selectRewardContentClaimIds } from 'lbryinc';
import { makeSelectIsSubscribed, makeSelectIsNew } from 'redux/selectors/subscriptions';
import FileProperties from './view';
@ -10,6 +10,7 @@ const select = (state, props) => ({
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
isNew: makeSelectIsNew(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
});
export default connect(

View file

@ -1,7 +1,6 @@
// @flow
import * as icons from 'constants/icons';
import * as React from 'react';
import { parseURI } from 'lbry-redux';
import Icon from 'component/common/icon';
import FilePrice from 'component/filePrice';
import VideoDuration from 'component/videoDuration';
@ -12,12 +11,13 @@ type Props = {
claimIsMine: boolean,
isSubscribed: boolean,
isNew: boolean,
claim: Claim,
rewardedContentClaimIds: Array<string>,
};
export default function FileProperties(props: Props) {
const { uri, downloaded, claimIsMine, rewardedContentClaimIds, isSubscribed } = props;
const { claimId } = parseURI(uri);
const { uri, downloaded, claimIsMine, rewardedContentClaimIds, isSubscribed, claim } = props;
const { claim_id: claimId } = claim;
const isRewardContent = rewardedContentClaimIds.includes(claimId);
return (

View file

@ -26,17 +26,16 @@ class SocialShare extends React.PureComponent<Props> {
render() {
const { claim } = this.props;
const { short_url: shortUrl } = claim;
const { canonical_url: canonicalUrl } = claim;
const { speechShareable, onDone } = this.props;
const lbryTvPrefix = 'https://beta.lbry.tv/';
const lbryPrefix = 'https://open.lbry.com/';
const lbryUri = shortUrl.split('lbry://')[1];
const lbryTvUri = lbryUri.replace('#', '/');
const encodedLbryURL: string = `${lbryPrefix}${encodeURIComponent(lbryUri)}`;
const lbryURL: string = `${lbryPrefix}${lbryUri}`;
const encodedLbryTvUrl = `${lbryTvPrefix}${encodeURIComponent(lbryTvUri)}`;
const lbryTvUrl = `${lbryTvPrefix}${lbryTvUri}`;
const lbryUri = canonicalUrl.split('lbry://')[1];
const lbryWebUrl = lbryUri.replace(/#/g, ':');
const encodedLbryURL: string = `${lbryPrefix}${encodeURIComponent(lbryWebUrl)}`;
const lbryURL: string = `${lbryPrefix}${lbryWebUrl}`;
const encodedLbryTvUrl = `${lbryTvPrefix}${encodeURIComponent(lbryWebUrl)}`;
const lbryTvUrl = `${lbryTvPrefix}${lbryWebUrl}`;
const shareOnFb = __('Share on Facebook');
const shareOnTwitter = __('Share On Twitter');

View file

@ -136,9 +136,9 @@ class FilePage extends React.Component<Props> {
// We will select the claim id before they publish
let editUri;
if (claimIsMine) {
const uriObject: { contentName: string, claimId: string, channelName?: string } = {
contentName: claim.name,
claimId: claim.claim_id,
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
streamName: claim.name,
streamClaimId: claim.claim_id,
};
if (channelName) {
uriObject.channelName = channelName;

View file

@ -258,19 +258,14 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
// 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
const latest = claimsInChannel[0];
dispatch(
setSubscriptionLatest(
{
channelName: claimsInChannel[0].channel_name,
uri: buildURI(
{
channelName: claimsInChannel[0].channel_name,
claimId: claimsInChannel[0].claim_id,
},
false
),
channelName: latest.channel_name,
uri: latest.signing_channel.canonical_url,
},
buildURI({ contentName: claimsInChannel[0].name, claimId: claimsInChannel[0].claim_id }, false)
buildURI({ streamName: latest.name, streamClaimId: latest.claim_id }, false)
)
);

View file

@ -651,5 +651,11 @@
"Loading": "Loading",
"I feel woosy! Stop spinning!": "I feel woosy! Stop spinning!",
"URI does not include name.": "URI does not include name.",
"This file is in your library.": "This file is in your library."
"This file is in your library.": "This file is in your library.",
"'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.": "'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.",
"Invalid claim ID %s.": "Invalid claim ID %s.",
"'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead": "'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead",
"View Tag": "View Tag",
"Block": "Block",
"% downloaded": "% downloaded"
}

View file

@ -6889,9 +6889,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#5925d562c802581538bb88f52e959ef7a135d1ec:
lbry-redux@lbryio/lbry-redux#18ff574d0ea5769866efa84e946e16d689283566:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/5925d562c802581538bb88f52e959ef7a135d1ec"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/18ff574d0ea5769866efa84e946e16d689283566"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"