add basic dmca message on embeds page
This commit is contained in:
parent
ca6ce23494
commit
e2b30b7d17
2 changed files with 44 additions and 2 deletions
|
@ -8,7 +8,7 @@ import {
|
|||
makeSelectIsUriResolving,
|
||||
} from 'lbry-redux';
|
||||
import { doPlayUri } from 'redux/actions/content';
|
||||
import { makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
|
||||
import { makeSelectCostInfoForUri, doFetchCostInfoForUri, selectBlackListedOutpoints } from 'lbryinc';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { match } = props;
|
||||
|
@ -21,6 +21,7 @@ const select = (state, props) => {
|
|||
costInfo: makeSelectCostInfoForUri(uri)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import FileRender from 'component/fileRender';
|
|||
import FileViewerEmbeddedTitle from 'component/fileViewerEmbeddedTitle';
|
||||
import Spinner from 'component/spinner';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
|
@ -17,11 +18,26 @@ type Props = {
|
|||
streamingUrl: string,
|
||||
doFetchCostInfoForUri: string => void,
|
||||
isResolvingUri: boolean,
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
};
|
||||
// $FlowFixMe apparently flow thinks this is wrong.
|
||||
export const EmbedContext = React.createContext();
|
||||
const EmbedWrapperPage = (props: Props) => {
|
||||
const { resolveUri, claim, uri, doPlayUri, costInfo, streamingUrl, doFetchCostInfoForUri, isResolvingUri } = props;
|
||||
const {
|
||||
resolveUri,
|
||||
claim,
|
||||
uri,
|
||||
doPlayUri,
|
||||
costInfo,
|
||||
streamingUrl,
|
||||
doFetchCostInfoForUri,
|
||||
isResolvingUri,
|
||||
blackListedOutpoints,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
location: { search },
|
||||
} = useHistory();
|
||||
|
@ -33,6 +49,15 @@ const EmbedWrapperPage = (props: Props) => {
|
|||
const noContentFound = !claim && !isResolvingUri;
|
||||
const isPaidContent = costInfo && costInfo.cost > 0;
|
||||
const contentLink = formatLbryUrlForWeb(uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const isClaimBlackListed =
|
||||
claim &&
|
||||
blackListedOutpoints &&
|
||||
blackListedOutpoints.some(
|
||||
outpoint =>
|
||||
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
||||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (resolveUri && uri && !haveClaim) {
|
||||
|
@ -49,6 +74,22 @@ const EmbedWrapperPage = (props: Props) => {
|
|||
}
|
||||
}, [uri, haveClaim, doFetchCostInfoForUri]);
|
||||
|
||||
if (isClaimBlackListed) {
|
||||
return (
|
||||
<Card
|
||||
title={uri}
|
||||
subtitle={__(
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
|
||||
)}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('embed__wrapper', {
|
||||
|
|
Loading…
Reference in a new issue