add blacklisted content view

This commit is contained in:
Sean Yesmunt 2018-04-24 14:17:11 -04:00
parent da23dafc94
commit 5b0846215f
6 changed files with 63 additions and 17 deletions

View file

@ -49,7 +49,7 @@
"find-process": "^1.1.0", "find-process": "^1.1.0",
"formik": "^0.10.4", "formik": "^0.10.4",
"keytar": "^4.2.1", "keytar": "^4.2.1",
"lbry-redux": "lbryio/lbry-redux", "lbry-redux": "file:../lbry-redux",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"mixpanel-browser": "^2.17.1", "mixpanel-browser": "^2.17.1",
"moment": "^2.22.0", "moment": "^2.22.0",

View file

@ -7,12 +7,8 @@ import { ipcRenderer, remote, shell } from 'electron';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate } from 'redux/actions/app';
doConditionalAuthNavigate, import { doNotify, doBlackListedOutpointsSubscribe } from 'lbry-redux';
doDaemonReady,
doAutoUpdate,
} from 'redux/actions/app';
import { doNotify } from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings'; import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doUserEmailVerify } from 'redux/actions/user'; import { doUserEmailVerify } from 'redux/actions/user';
@ -38,10 +34,12 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
app.store.dispatch(doConditionalAuthNavigate(newSession)); app.store.dispatch(doConditionalAuthNavigate(newSession));
app.store.dispatch(doUserEmailVerify(verification.token, verification.recaptcha)); app.store.dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
} else { } else {
app.store.dispatch(doNotify({ app.store.dispatch(
message: 'Invalid Verification URI', doNotify({
displayType: ['snackbar'] message: 'Invalid Verification URI',
})); displayType: ['snackbar'],
})
);
} }
} else { } else {
app.store.dispatch(doNavigate('/show', { uri })); app.store.dispatch(doNavigate('/show', { uri }));
@ -119,8 +117,10 @@ const init = () => {
app.store.dispatch(doAutoUpdate()); app.store.dispatch(doAutoUpdate());
}); });
} }
app.store.dispatch(doUpdateIsNightAsync()); app.store.dispatch(doUpdateIsNightAsync());
app.store.dispatch(doDownloadLanguages()); app.store.dispatch(doDownloadLanguages());
app.store.dispatch(doBlackListedOutpointsSubscribe());
function onDaemonReady() { function onDaemonReady() {
window.sessionStorage.setItem('loaded', 'y'); // once we've made it here once per session, we don't need to show splash again window.sessionStorage.setItem('loaded', 'y'); // once we've made it here once per session, we don't need to show splash again

View file

@ -1,10 +1,16 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doResolveUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'lbry-redux'; import {
doResolveUri,
makeSelectClaimForUri,
makeSelectIsUriResolving,
selectBlackListedOutpoints,
} from 'lbry-redux';
import ShowPage from './view'; import ShowPage from './view';
const select = (state, props) => ({ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state), isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -4,12 +4,21 @@ import BusyIndicator from 'component/common/busy-indicator';
import ChannelPage from 'page/channel'; import ChannelPage from 'page/channel';
import FilePage from 'page/file'; import FilePage from 'page/file';
import Page from 'component/page'; import Page from 'component/page';
import Button from 'component/button';
type Props = { type Props = {
isResolvingUri: boolean, isResolvingUri: boolean,
resolveUri: string => void, resolveUri: string => void,
uri: string, uri: string,
claim: { name: string }, claim: {
name: string,
txid: string,
nout: number,
},
blackListedOutpoints: Array<{
txid: string,
nout: number,
}>,
}; };
class ShowPage extends React.PureComponent<Props> { class ShowPage extends React.PureComponent<Props> {
@ -28,7 +37,7 @@ class ShowPage extends React.PureComponent<Props> {
} }
render() { render() {
const { claim, isResolvingUri, uri } = this.props; const { claim, isResolvingUri, uri, blackListedOutpoints } = this.props;
let innerContent = ''; let innerContent = '';
@ -50,7 +59,37 @@ class ShowPage extends React.PureComponent<Props> {
} else if (claim && claim.name.length && claim.name[0] === '@') { } else if (claim && claim.name.length && claim.name[0] === '@') {
innerContent = <ChannelPage uri={uri} />; innerContent = <ChannelPage uri={uri} />;
} else if (claim) { } else if (claim) {
innerContent = <FilePage uri={uri} />; let isClaimBlackListed = false;
for (let i = 0; i < blackListedOutpoints.length; i += 1) {
const outpoint = blackListedOutpoints[i];
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) {
isClaimBlackListed = true;
break;
}
}
if (isClaimBlackListed) {
innerContent = (
<Page>
<section className="card card--section">
<div className="card__title">{uri}</div>
<div className="card__content">
<p>
{__(
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
)}
</p>
</div>
<div className="card__actions">
<Button button="link" href="https://lbry.io/faq/dmca" label={__('Read More')} />
</div>
</section>
</Page>
);
} else {
innerContent = <FilePage uri={uri} />;
}
} }
return innerContent; return innerContent;

View file

@ -9,6 +9,7 @@ import {
searchReducer, searchReducer,
walletReducer, walletReducer,
notificationsReducer, notificationsReducer,
blacklistReducer,
} from 'lbry-redux'; } from 'lbry-redux';
import navigationReducer from 'redux/reducers/navigation'; import navigationReducer from 'redux/reducers/navigation';
import rewardsReducer from 'redux/reducers/rewards'; import rewardsReducer from 'redux/reducers/rewards';
@ -71,6 +72,7 @@ const reducers = combineReducers({
media: mediaReducer, media: mediaReducer,
publish: publishReducer, publish: publishReducer,
notifications: notificationsReducer, notifications: notificationsReducer,
blacklist: blacklistReducer,
}); });
const bulkThunk = createBulkThunkMiddleware(); const bulkThunk = createBulkThunkMiddleware();

View file

@ -5422,9 +5422,8 @@ lazy-val@^1.0.3:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc" resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc"
lbry-redux@lbryio/lbry-redux: "lbry-redux@file:../lbry-redux":
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/06cfc1c88cc4cc6dafd97647cd7529e0571256da"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"