add blacklisted content view
This commit is contained in:
parent
da23dafc94
commit
5b0846215f
6 changed files with 63 additions and 17 deletions
|
@ -49,7 +49,7 @@
|
|||
"find-process": "^1.1.0",
|
||||
"formik": "^0.10.4",
|
||||
"keytar": "^4.2.1",
|
||||
"lbry-redux": "lbryio/lbry-redux",
|
||||
"lbry-redux": "file:../lbry-redux",
|
||||
"localforage": "^1.7.1",
|
||||
"mixpanel-browser": "^2.17.1",
|
||||
"moment": "^2.22.0",
|
||||
|
|
|
@ -7,12 +7,8 @@ import { ipcRenderer, remote, shell } from 'electron';
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import {
|
||||
doConditionalAuthNavigate,
|
||||
doDaemonReady,
|
||||
doAutoUpdate,
|
||||
} from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate } from 'redux/actions/app';
|
||||
import { doNotify, doBlackListedOutpointsSubscribe } from 'lbry-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||
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(doUserEmailVerify(verification.token, verification.recaptcha));
|
||||
} else {
|
||||
app.store.dispatch(doNotify({
|
||||
message: 'Invalid Verification URI',
|
||||
displayType: ['snackbar']
|
||||
}));
|
||||
app.store.dispatch(
|
||||
doNotify({
|
||||
message: 'Invalid Verification URI',
|
||||
displayType: ['snackbar'],
|
||||
})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
app.store.dispatch(doNavigate('/show', { uri }));
|
||||
|
@ -119,8 +117,10 @@ const init = () => {
|
|||
app.store.dispatch(doAutoUpdate());
|
||||
});
|
||||
}
|
||||
|
||||
app.store.dispatch(doUpdateIsNightAsync());
|
||||
app.store.dispatch(doDownloadLanguages());
|
||||
app.store.dispatch(doBlackListedOutpointsSubscribe());
|
||||
|
||||
function onDaemonReady() {
|
||||
window.sessionStorage.setItem('loaded', 'y'); // once we've made it here once per session, we don't need to show splash again
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doResolveUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'lbry-redux';
|
||||
import {
|
||||
doResolveUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectIsUriResolving,
|
||||
selectBlackListedOutpoints,
|
||||
} from 'lbry-redux';
|
||||
import ShowPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
|
|
@ -4,12 +4,21 @@ import BusyIndicator from 'component/common/busy-indicator';
|
|||
import ChannelPage from 'page/channel';
|
||||
import FilePage from 'page/file';
|
||||
import Page from 'component/page';
|
||||
import Button from 'component/button';
|
||||
|
||||
type Props = {
|
||||
isResolvingUri: boolean,
|
||||
resolveUri: string => void,
|
||||
uri: string,
|
||||
claim: { name: string },
|
||||
claim: {
|
||||
name: string,
|
||||
txid: string,
|
||||
nout: number,
|
||||
},
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
};
|
||||
|
||||
class ShowPage extends React.PureComponent<Props> {
|
||||
|
@ -28,7 +37,7 @@ class ShowPage extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { claim, isResolvingUri, uri } = this.props;
|
||||
const { claim, isResolvingUri, uri, blackListedOutpoints } = this.props;
|
||||
|
||||
let innerContent = '';
|
||||
|
||||
|
@ -50,7 +59,37 @@ class ShowPage extends React.PureComponent<Props> {
|
|||
} else if (claim && claim.name.length && claim.name[0] === '@') {
|
||||
innerContent = <ChannelPage uri={uri} />;
|
||||
} 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;
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
searchReducer,
|
||||
walletReducer,
|
||||
notificationsReducer,
|
||||
blacklistReducer,
|
||||
} from 'lbry-redux';
|
||||
import navigationReducer from 'redux/reducers/navigation';
|
||||
import rewardsReducer from 'redux/reducers/rewards';
|
||||
|
@ -71,6 +72,7 @@ const reducers = combineReducers({
|
|||
media: mediaReducer,
|
||||
publish: publishReducer,
|
||||
notifications: notificationsReducer,
|
||||
blacklist: blacklistReducer,
|
||||
});
|
||||
|
||||
const bulkThunk = createBulkThunkMiddleware();
|
||||
|
|
|
@ -5422,9 +5422,8 @@ lazy-val@^1.0.3:
|
|||
version "1.0.3"
|
||||
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"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/06cfc1c88cc4cc6dafd97647cd7529e0571256da"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
|
Loading…
Reference in a new issue