Compare commits

...
7 Commits
Author SHA1 Message Date
Igor Gassmann 7401e38f91 chore: bump version to 0.21.3 2018-04-23 15:22:33 -04:00
Sean Yesmunt cc094fc232 update changelog 2018-04-23 11:57:27 -04:00
Sean Yesmunt 84eeb0c190 update changelog 2018-04-23 11:57:20 -04:00
Sean Yesmunt 7f6eea0e4b Merge pull request #1361 from lbryio/issue/565
feat: block black listed content from the app
2018-04-20 11:40:57 -04:00
Sean Yesmunt 39c041b1d2 remove CHECK_UPGRADE_SUBSCRIBE dispatch in blacklist action 2018-04-20 11:39:37 -04:00
Sean Yesmunt 5461f26cac return new state in app reducer 2018-04-20 11:32:12 -04:00
Igor Gassmann e24c694ecc feat: block black listed content from the app 2018-04-19 15:56:27 -04:00
10 changed files with 137 additions and 14 deletions

No files matched your search

+7
View File
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).
## [0.21.3] - 2018-04-23
### Added
* Block blacklisted content ([#1361](https://github.com/lbryio/lbry-app/pull/1361))
## [0.21.2] - 2018-03-22
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "LBRY",
"version": "0.21.2",
"version": "0.21.3",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"keywords": [
"lbry"
+4
View File
@@ -52,6 +52,10 @@ export const SUPPORT_TRANSACTION_FAILED = 'SUPPORT_TRANSACTION_FAILED';
// Claims
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
export const FETCH_FEATURED_CONTENT_COMPLETED = 'FETCH_FEATURED_CONTENT_COMPLETED';
export const FETCH_BLACK_LISTED_CONTENT_STARTED = 'FETCH_BLACK_LISTED_CONTENT_STARTED';
export const FETCH_BLACK_LISTED_CONTENT_COMPLETED = 'FETCH_BLACK_LISTED_CONTENT_COMPLETED';
export const FETCH_BLACK_LISTED_CONTENT_FAILED = 'FETCH_BLACK_LISTED_CONTENT_FAILED';
export const BLACK_LISTED_CONTENT_SUBSCRIBE = 'BLACK_LISTED_CONTENT_SUBSCRIBE';
export const RESOLVE_URIS_STARTED = 'RESOLVE_URIS_STARTED';
export const RESOLVE_URIS_COMPLETED = 'RESOLVE_URIS_COMPLETED';
export const FETCH_CHANNEL_CLAIMS_STARTED = 'FETCH_CHANNEL_CLAIMS_STARTED';
+2
View File
@@ -12,6 +12,7 @@ import {
doDaemonReady,
doShowSnackBar,
doAutoUpdate,
doBlackListedOutpointsSubscribe,
} from 'redux/actions/app';
import { doNavigate } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
@@ -118,6 +119,7 @@ const init = () => {
}
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
+2 -1
View File
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { doResolveUri } from 'redux/actions/content';
import { selectBlackListedOutpoints } from 'redux/selectors/app';
import { makeSelectClaimForUri } from 'redux/selectors/claims';
import { makeSelectIsUriResolving } from 'redux/selectors/content';
import ShowPage from './view';
@@ -8,6 +8,7 @@ import ShowPage from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
});
const perform = dispatch => ({
+31 -3
View File
@@ -1,3 +1,4 @@
import Link from 'component/link/view';
import React from 'react';
import { BusyMessage } from 'component/common';
import ChannelPage from 'page/channel';
@@ -12,14 +13,13 @@ class ShowPage extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { isResolvingUri, resolveUri, claim, uri } = nextProps;
if (!isResolvingUri && claim === undefined && uri) {
resolveUri(uri);
}
}
render() {
const { claim, isResolvingUri, uri } = this.props;
const { claim, isResolvingUri, uri, blackListedOutpoints } = this.props;
let innerContent = '';
@@ -43,7 +43,35 @@ class ShowPage extends React.PureComponent {
} else if (claim && claim.name.length && claim.name[0] === '@') {
innerContent = <ChannelPage uri={uri} />;
} else if (claim) {
innerContent = <FilePage uri={uri} />;
let isClaimBlackListed = false;
blackListedOutpoints.forEach(outpoint => {
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) isClaimBlackListed = true;
});
if (isClaimBlackListed) {
innerContent = (
<section className="card">
<div className="card__inner">
<div className="card__title-identity">
<h1>{uri}</h1>
</div>
</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">
<Link button="alt" href="https://lbry.io/faq/dmca" label={__('Read More')} />
</div>
</section>
);
} else {
innerContent = <FilePage uri={uri} />;
}
}
return <main className="main--single-column">{innerContent}</main>;
+49
View File
@@ -1,6 +1,7 @@
import { execSync } from 'child_process';
import isDev from 'electron-is-dev';
import Lbry from 'lbry';
import Lbryio from 'lbryio';
import path from 'path';
import * as ACTIONS from 'constants/action_types';
import * as MODALS from 'constants/modal_types';
@@ -31,6 +32,7 @@ const { download } = remote.require('electron-dl');
const Fs = remote.require('fs');
const CHECK_UPGRADE_INTERVAL = 10 * 60 * 1000;
const CHECK_BLACK_LISTED_CONTENT_INTERVAL = 60 * 60 * 1000;
export function doOpenModal(modal, modalProps = {}) {
return {
@@ -285,6 +287,53 @@ export function doAlertError(errorList) {
};
}
export function doFetchBlackListedOutpoints() {
return dispatch => {
dispatch({
type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_STARTED,
});
const success = ({ outpoints }) => {
const splitedOutpoints = [];
outpoints.forEach((outpoint, index)=> {
const [ txid, nout ] = outpoint.split(':');
splitedOutpoints[index] = { 'txid': txid, 'nout': Number.parseInt(nout, 10)};
});
dispatch({
type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_COMPLETED,
data: {
outpoints: splitedOutpoints,
success: true,
},
});
};
const failure = ({ error }) => {
dispatch({
type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_FAILED,
data: {
error,
success: false,
},
});
};
Lbryio.call('file', 'list_blocked').then(success, failure);
};
}
export function doBlackListedOutpointsSubscribe() {
return dispatch => {
dispatch(doFetchBlackListedOutpoints());
setInterval(
() => dispatch(doFetchBlackListedOutpoints()),
CHECK_BLACK_LISTED_CONTENT_INTERVAL
);
};
}
export function doDaemonReady() {
return (dispatch, getState) => {
const state = getState();
+31 -1
View File
@@ -23,6 +23,9 @@ export type AppState = {
upgradeSkipped: boolean,
daemonVersionMatched: ?boolean,
daemonReady: boolean,
fetchingBlackListedOutpoints: boolean,
fetchingBlackListedOutpointsSucceed: ?boolean,
blackListedOutpoints: ?mixed,
hasSignature: boolean,
badgeNumber: number,
volume: number,
@@ -45,13 +48,15 @@ const defaultState: AppState = {
upgradeSkipped: sessionStorage.getItem('upgradeSkipped') === 'true',
daemonVersionMatched: null,
daemonReady: false,
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: undefined,
blackListedOutpoints: undefined,
hasSignature: false,
badgeNumber: 0,
volume: Number(sessionStorage.getItem('volume')) || 1,
autoUpdateDownloaded: false,
autoUpdateDeclined: false,
modalsAllowed: true,
downloadProgress: undefined,
upgradeDownloading: undefined,
upgradeDownloadComplete: undefined,
@@ -77,6 +82,31 @@ reducers[ACTIONS.DAEMON_VERSION_MISMATCH] = state =>
modal: MODALS.INCOMPATIBLE_DAEMON,
});
reducers[ACTIONS.FETCH_BLACK_LISTED_CONTENT_STARTED] = state =>
Object.assign({}, state, {
fetchingBlackListedOutpoints: true,
});
reducers[ACTIONS.FETCH_BLACK_LISTED_CONTENT_COMPLETED] = (state, action) => {
const { outpoints, success } = action.data;
return Object.assign({}, state, {
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: success,
blackListedOutpoints: outpoints,
});
};
reducers[ACTIONS.FETCH_BLACK_LISTED_CONTENT_FAILED] = (state, action) => {
const { error, success } = action.data;
return Object.assign({}, state, {
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: success,
fetchingBlackListedOutpointsError: error,
});
};
reducers[ACTIONS.UPGRADE_CANCELLED] = state =>
Object.assign({}, state, {
downloadProgress: null,
+2
View File
@@ -17,6 +17,8 @@ export const selectUpdateUrl = createSelector(selectPlatform, platform => {
}
});
export const selectBlackListedOutpoints = createSelector(selectState, state => state.blackListedOutpoints);
export const selectRemoteVersion = createSelector(selectState, state => state.remoteVersion);
export const selectIsUpgradeAvailable = createSelector(
+8 -8
View File
@@ -26,7 +26,7 @@ $text-color: #000;
/* Misc */
--content-max-width: 1000px;
--nsfw-blur-intensity: 20px;
--height-video-embedded: $width-page-constrained * 9 / 16;
--height-video-embedded: 450px; // 800px * 9/16
/* Font */
--font-size: 16px;
@@ -86,8 +86,8 @@ $text-color: #000;
--button-color: #fff;
--button-primary-bg: var(--color-primary);
--button-primary-color: #fff;
--button-padding: $spacing-vertical * 2/3;
--button-height: $spacing-vertical * 1.5;
--button-padding: 16px;
--button-height: 36px;
--button-intra-margin: $spacing-vertical;
--button-radius: 3px;
@@ -95,7 +95,7 @@ $text-color: #000;
--header-bg: var(--color-bg);
--header-color: #666;
--header-active-color: rgba(0, 0, 0, 0.85);
--header-height: $spacing-vertical * 2.5;
--header-height: 60px;
--header-button-bg: transparent; //var(--button-bg);
--header-button-hover-bg: rgba(100, 100, 100, 0.15);
@@ -121,12 +121,12 @@ $text-color: #000;
/* Card */
--card-bg: var(--color-bg);
--card-hover-translate: 10px;
--card-margin: $spacing-vertical * 2/3;
--card-max-width: $width-page-constrained;
--card-padding: $spacing-vertical * 2/3;
--card-margin: 16px;
--card-max-width: 800px;
--card-padding: 16px;
--card-radius: 2px;
--card-link-scaling: 1.1;
--card-small-width: $spacing-vertical * 10;
--card-small-width: 240px;
/* Modal */
--modal-width: 440px;