Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e6579a926 | ||
|
|
8bf04b4448 | ||
|
|
e2192fb0bc | ||
|
|
fb7fc25d4c | ||
|
|
3060c399db | ||
|
|
c4ec975a41 | ||
|
|
7e3ef2e08e | ||
|
|
23b33a6bee | ||
|
|
54c4744b97 | ||
|
|
5f97365103 | ||
|
|
726f721ae5 | ||
|
|
58944935c4 | ||
|
|
959b692df8 | ||
|
|
de87dc8a03 | ||
|
|
8377fca93b | ||
|
|
1238ca4795 | ||
|
|
f809fd46c5 | ||
|
|
a471b1de28 | ||
|
|
9bd703368c | ||
|
|
d4271ccd4f | ||
|
|
5c9838695f | ||
|
|
92a9bd1e6c | ||
|
|
a039dcb9aa | ||
|
|
fd19f1c423 | ||
|
|
7401e38f91 | ||
|
|
cc094fc232 | ||
|
|
84eeb0c190 | ||
|
|
7f6eea0e4b | ||
|
|
39c041b1d2 | ||
|
|
5461f26cac | ||
|
|
e24c694ecc |
No files matched your search
@@ -8,3 +8,4 @@
|
||||
/static/locales
|
||||
|
||||
|
||||
|
||||
+20
-21
@@ -1,50 +1,49 @@
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
env: TARGET=mac
|
||||
osx_image: xcode9.2
|
||||
language: node_js
|
||||
node_js: "9"
|
||||
env:
|
||||
- ELECTRON_CACHE=$HOME/.cache/electron
|
||||
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
|
||||
- os: linux
|
||||
env: TARGET=windows
|
||||
services: docker
|
||||
language: generic
|
||||
before_cache:
|
||||
- rm -rf $HOME/.cache/electron-builder/wine
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
- $HOME/.cache/electron
|
||||
- $HOME/.cache/electron-builder
|
||||
language: node_js
|
||||
node_js: "9"
|
||||
- os: linux
|
||||
env: TARGET=linux
|
||||
language: node_js
|
||||
node_js: "9"
|
||||
cache: false
|
||||
before_install:
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v2.3.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-2.3.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1
|
||||
export PATH="/tmp/git-lfs:$PATH"
|
||||
else
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get install -y libsecret-1-dev
|
||||
sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib
|
||||
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.6.0
|
||||
export PATH="$HOME/.yarn/bin:$PATH"
|
||||
fi
|
||||
before_script:
|
||||
- git lfs pull
|
||||
script:
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||
if [ "$TARGET" == "windows" ]; then
|
||||
docker run --rm \
|
||||
--env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
|
||||
-v ${PWD}:/project \
|
||||
-v ~/.cache/electron:/root/.cache/electron \
|
||||
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
|
||||
electronuserland/builder:wine \
|
||||
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn build --linux --win"
|
||||
else
|
||||
yarn build
|
||||
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn build --win --publish onTag";
|
||||
fi
|
||||
branches:
|
||||
except:
|
||||
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
||||
- if [ "$TARGET" == "mac" ]; then yarn build --publish onTag; fi
|
||||
- if [ "$TARGET" == "linux" ]; then yarn --link-duplicates --pure-lockfile && yarn build --linux --publish onTag; fi
|
||||
addons:
|
||||
artifacts:
|
||||
working_dir: dist
|
||||
paths:
|
||||
- $(git ls-files -o dist/{*.dmg,*.exe,*.deb} | tr "\n" ":")
|
||||
target_paths:
|
||||
- /app/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})
|
||||
- /app/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "LBRY",
|
||||
"version": "0.21.2",
|
||||
"version": "0.21.5",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -37,15 +37,15 @@
|
||||
"electron-dl": "^1.11.0",
|
||||
"electron-is-dev": "^0.3.0",
|
||||
"electron-log": "^2.2.12",
|
||||
"electron-publisher-s3": "^20.2.0",
|
||||
"electron-updater": "^2.21.0",
|
||||
"electron-publisher-s3": "^20.8.1",
|
||||
"electron-updater": "^2.21.10",
|
||||
"electron-window-state": "^4.1.1",
|
||||
"find-process": "^1.1.0",
|
||||
"formik": "^0.10.4",
|
||||
"from2": "^2.3.0",
|
||||
"install": "^0.10.2",
|
||||
"jshashes": "^1.0.7",
|
||||
"keytar-prebuild": "4.0.4",
|
||||
"keytar": "^4.2.1",
|
||||
"localforage": "^1.5.0",
|
||||
"mixpanel-browser": "^2.17.1",
|
||||
"moment": "^2.20.1",
|
||||
@@ -57,14 +57,14 @@
|
||||
"react-modal": "^3.1.7",
|
||||
"react-paginate": "^5.2.1",
|
||||
"react-redux": "^5.0.3",
|
||||
"react-simplemde-editor": "^3.6.11",
|
||||
"react-simplemde-editor": "3.6.11",
|
||||
"redux": "^3.6.0",
|
||||
"redux-logger": "^3.0.1",
|
||||
"redux-persist": "^4.8.0",
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.10",
|
||||
"redux-thunk": "^2.2.0",
|
||||
"render-media": "^2.12.0",
|
||||
"render-media": "^3.1.0",
|
||||
"reselect": "^3.0.0",
|
||||
"semver": "^5.3.0",
|
||||
"shapeshift.io": "^1.3.1",
|
||||
@@ -83,8 +83,8 @@
|
||||
"decompress": "^4.2.0",
|
||||
"del": "^3.0.0",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "1.7.12",
|
||||
"electron-builder": "^20.7.1",
|
||||
"electron": "^1.8.4",
|
||||
"electron-builder": "20.13.3",
|
||||
"electron-devtools-installer": "^2.2.3",
|
||||
"electron-webpack": "^1.13.0",
|
||||
"eslint": "^4.19.0",
|
||||
@@ -116,7 +116,7 @@
|
||||
"yarn": "^1.3"
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.19.1",
|
||||
"lbrynetDaemonVersion": "0.19.3",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet-daemon"
|
||||
|
||||
+24
-10
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-console */
|
||||
// Module imports
|
||||
import keytar from 'keytar-prebuild';
|
||||
import keytar from 'keytar';
|
||||
import SemVer from 'semver';
|
||||
import findProcess from 'find-process';
|
||||
import url from 'url';
|
||||
@@ -177,10 +177,11 @@ ipcMain.on('version-info-requested', () => {
|
||||
};
|
||||
let result = '';
|
||||
|
||||
const req = https.get(Object.assign(opts, url.parse(latestReleaseAPIURL)), res => {
|
||||
const onSuccess = res => {
|
||||
res.on('data', data => {
|
||||
result += data;
|
||||
});
|
||||
|
||||
res.on('end', () => {
|
||||
const tagName = JSON.parse(result).tag_name;
|
||||
const [, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
|
||||
@@ -199,14 +200,27 @@ ipcMain.on('version-info-requested', () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
req.on('error', err => {
|
||||
console.log('Failed to get current version from GitHub. Error:', err);
|
||||
if (rendererWindow) {
|
||||
rendererWindow.webContents.send('version-info-received', null);
|
||||
}
|
||||
});
|
||||
const requestLatestRelease = (apiUrl, alreadyRedirected = false) => {
|
||||
const req = https.get(Object.assign(opts, url.parse(apiUrl)), res => {
|
||||
if (res.statusCode === 301 || res.statusCode === 302) {
|
||||
requestLatestRelease(res.headers.location, true);
|
||||
} else {
|
||||
onSuccess(res);
|
||||
}
|
||||
});
|
||||
|
||||
if (alreadyRedirected) return;
|
||||
req.on('error', err => {
|
||||
console.log('Failed to get current version from GitHub. Error:', err);
|
||||
if (rendererWindow) {
|
||||
rendererWindow.webContents.send('version-info-received', null);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
requestLatestRelease(latestReleaseAPIURL);
|
||||
});
|
||||
|
||||
ipcMain.on('get-auth-token', event => {
|
||||
@@ -243,7 +257,7 @@ const isSecondInstance = app.makeSingleInstance(argv => {
|
||||
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
|
||||
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
|
||||
if (process.platform === 'win32') {
|
||||
URI = URI.replace(/\/$/, '').replace('/#', '#');
|
||||
URI = URI.replace(/\/$/, '').replace('/#', '#').replace('/?', '?');
|
||||
}
|
||||
|
||||
rendererWindow.webContents.send('open-uri-requested', URI);
|
||||
|
||||
@@ -17,7 +17,7 @@ const makeSelect = () => {
|
||||
const select = (state, props) => ({
|
||||
errorMessage: selectError(state, props),
|
||||
isPending: selectIsPending(state, props),
|
||||
reward: selectReward(state, props),
|
||||
reward: selectReward(state, props.reward_type),
|
||||
});
|
||||
|
||||
return select;
|
||||
|
||||
@@ -2,10 +2,11 @@ import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import Router from './view.jsx';
|
||||
import { selectCurrentPage, selectCurrentParams } from 'redux/selectors/navigation.js';
|
||||
import { doShowSnackBar } from 'redux/actions/app.js';
|
||||
|
||||
const select = state => ({
|
||||
params: selectCurrentParams(state),
|
||||
currentPage: selectCurrentPage(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(Router);
|
||||
export default connect(select, {doShowSnackBar})(Router);
|
||||
@@ -19,16 +19,18 @@ import InvitePage from 'page/invite';
|
||||
import BackupPage from 'page/backup';
|
||||
import SubscriptionsPage from 'page/subscriptions';
|
||||
|
||||
const route = (page, routesMap) => {
|
||||
const route = (props, page, routesMap) => {
|
||||
const component = routesMap[page];
|
||||
|
||||
return component;
|
||||
if (!component) {
|
||||
props.doShowSnackBar({ message: 'Invalid page requested' });
|
||||
}
|
||||
return component || routesMap['discover'];
|
||||
};
|
||||
|
||||
const Router = props => {
|
||||
const { currentPage, params } = props;
|
||||
|
||||
return route(currentPage, {
|
||||
return route(props, currentPage, {
|
||||
auth: <AuthPage params={params} />,
|
||||
backup: <BackupPage params={params} />,
|
||||
channel: <ChannelPage params={params} />,
|
||||
|
||||
@@ -13,13 +13,13 @@ import { selectCurrentModal } from 'redux/selectors/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { PHONE_COLLECTION } from 'constants/modal_types';
|
||||
|
||||
const select = (state, props) => {
|
||||
const select = state => {
|
||||
const selectReward = makeSelectRewardByType();
|
||||
|
||||
return {
|
||||
isPending: selectIdentityVerifyIsPending(state),
|
||||
errorMessage: selectIdentityVerifyErrorMessage(state),
|
||||
reward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
|
||||
reward: selectReward(state, rewards.TYPE_NEW_USER),
|
||||
modal: selectCurrentModal(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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';
|
||||
|
||||
+10
-1
@@ -12,7 +12,9 @@ import {
|
||||
doDaemonReady,
|
||||
doShowSnackBar,
|
||||
doAutoUpdate,
|
||||
doBlackListedOutpointsSubscribe,
|
||||
} from 'redux/actions/app';
|
||||
import { isURIValid } from 'lbryURI.js';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||
import { doUserEmailVerify } from 'redux/actions/user';
|
||||
@@ -22,6 +24,7 @@ import app from './app';
|
||||
import analytics from './analytics';
|
||||
|
||||
const { autoUpdater } = remote.require('electron-updater');
|
||||
const appPageURL = 'lbry://?';
|
||||
|
||||
autoUpdater.logger = remote.require('electron-log');
|
||||
|
||||
@@ -40,8 +43,13 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
|
||||
} else {
|
||||
app.store.dispatch(doShowSnackBar({ message: 'Invalid Verification URI' }));
|
||||
}
|
||||
} else {
|
||||
} else if (uri.startsWith(appPageURL)) {
|
||||
const navpage = uri.replace(appPageURL,'').toLowerCase();
|
||||
app.store.dispatch(doNavigate('/' + navpage));
|
||||
} else if (isURIValid (uri)) {
|
||||
app.store.dispatch(doNavigate('/show', { uri }));
|
||||
} else {
|
||||
app.store.dispatch(doShowSnackBar({ message: 'Invalid URL requested' }));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -118,6 +126,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
|
||||
|
||||
@@ -9,7 +9,7 @@ const select = (state, props) => {
|
||||
const selectReward = makeSelectRewardByType();
|
||||
|
||||
return {
|
||||
reward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
|
||||
reward: selectReward(state, rewards.TYPE_NEW_USER),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CreditAmount } from 'component/common';
|
||||
|
||||
class ModalFirstReward extends React.PureComponent {
|
||||
render() {
|
||||
const { closeModal, reward } = this.props;
|
||||
const { closeModal } = this.props;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@@ -16,10 +16,7 @@ class ModalFirstReward extends React.PureComponent {
|
||||
>
|
||||
<section>
|
||||
<h3 className="modal__header">{__('Your First Reward')}</h3>
|
||||
<p>
|
||||
{__('You just earned your first reward of')}{' '}
|
||||
<CreditAmount amount={reward.reward_amount} />.
|
||||
</p>
|
||||
<p>{__('You just earned your first reward!')}</p>
|
||||
<p>
|
||||
{__(
|
||||
"This reward will show in your Wallet in the top right momentarily (if it hasn't already)."
|
||||
|
||||
@@ -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 => ({
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import Lbryio from 'lbryio';
|
||||
import { selectUnclaimedRewardsByType } from 'redux/selectors/rewards';
|
||||
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
||||
import { selectUserIsRewardApproved } from 'redux/selectors/user';
|
||||
import rewards from 'rewards';
|
||||
|
||||
@@ -30,8 +30,8 @@ export function doRewardList() {
|
||||
export function doClaimRewardType(rewardType) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const rewardsByType = selectUnclaimedRewardsByType(state);
|
||||
const reward = rewardsByType[rewardType];
|
||||
const unclaimedRewards = selectUnclaimedRewards(state);
|
||||
const reward = unclaimedRewards.find(ur => ur.reward_type === rewardType);
|
||||
const userIsRewardApproved = selectUserIsRewardApproved(state);
|
||||
|
||||
if (!reward || reward.transaction_id) {
|
||||
@@ -66,7 +66,7 @@ export function doClaimRewardType(rewardType) {
|
||||
data: { modal: MODALS.FIRST_REWARD },
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const failure = error => {
|
||||
dispatch({
|
||||
@@ -82,14 +82,14 @@ export function doClaimRewardType(rewardType) {
|
||||
export function doClaimEligiblePurchaseRewards() {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const rewardsByType = selectUnclaimedRewardsByType(state);
|
||||
const unclaimedRewards = selectUnclaimedRewards(state);
|
||||
const userIsRewardApproved = selectUserIsRewardApproved(state);
|
||||
|
||||
if (!userIsRewardApproved || !Lbryio.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rewardsByType[rewards.TYPE_FIRST_STREAM]) {
|
||||
if (unclaimedRewards.find(ur => ur.reward_type === rewards.TYPE_FIRST_STREAM)) {
|
||||
dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM));
|
||||
} else {
|
||||
[rewards.TYPE_MANY_DOWNLOADS, rewards.TYPE_FEATURED_DOWNLOAD].forEach(type => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -4,7 +4,7 @@ const reducers = {};
|
||||
const defaultState = {
|
||||
fetching: false,
|
||||
claimedRewardsById: {}, // id => reward
|
||||
unclaimedRewardsByType: {},
|
||||
unclaimedRewards: [],
|
||||
claimPendingByType: {},
|
||||
claimErrorsByType: {},
|
||||
};
|
||||
@@ -17,19 +17,19 @@ reducers[ACTIONS.FETCH_REWARDS_STARTED] = state =>
|
||||
reducers[ACTIONS.FETCH_REWARDS_COMPLETED] = (state, action) => {
|
||||
const { userRewards } = action.data;
|
||||
|
||||
const unclaimedRewards = {};
|
||||
const unclaimedRewards = [];
|
||||
const claimedRewards = {};
|
||||
userRewards.forEach(reward => {
|
||||
if (reward.transaction_id) {
|
||||
claimedRewards[reward.id] = reward;
|
||||
} else {
|
||||
unclaimedRewards[reward.reward_type] = reward;
|
||||
unclaimedRewards.push(reward);
|
||||
}
|
||||
});
|
||||
|
||||
return Object.assign({}, state, {
|
||||
claimedRewardsById: claimedRewards,
|
||||
unclaimedRewardsByType: unclaimedRewards,
|
||||
unclaimedRewards,
|
||||
fetching: false,
|
||||
});
|
||||
};
|
||||
@@ -62,24 +62,21 @@ reducers[ACTIONS.CLAIM_REWARD_STARTED] = (state, action) => {
|
||||
|
||||
reducers[ACTIONS.CLAIM_REWARD_SUCCESS] = (state, action) => {
|
||||
const { reward } = action.data;
|
||||
const { unclaimedRewards } = state;
|
||||
|
||||
const unclaimedRewardsByType = Object.assign({}, state.unclaimedRewardsByType);
|
||||
const existingReward = unclaimedRewardsByType[reward.reward_type];
|
||||
const index = unclaimedRewards.findIndex(ur => ur.reward_type === reward.reward_type);
|
||||
unclaimedRewards.splice(index, 1);
|
||||
|
||||
const newReward = Object.assign({}, reward, {
|
||||
reward_title: existingReward.reward_title,
|
||||
reward_description: existingReward.reward_description,
|
||||
});
|
||||
const { claimedRewardsById } = state;
|
||||
claimedRewardsById[reward.id] = reward;
|
||||
|
||||
const claimedRewardsById = Object.assign({}, state.claimedRewardsById);
|
||||
claimedRewardsById[reward.id] = newReward;
|
||||
|
||||
const newState = Object.assign({}, state, {
|
||||
unclaimedRewardsByType,
|
||||
claimedRewardsById,
|
||||
});
|
||||
|
||||
return setClaimRewardState(newState, newReward, false, '');
|
||||
const newState = {
|
||||
...state,
|
||||
unclaimedRewards: [...unclaimedRewards],
|
||||
claimedRewardsById: { ...claimedRewardsById },
|
||||
};
|
||||
|
||||
return setClaimRewardState(newState, reward, false, '');
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CLAIM_REWARD_FAILURE] = (state, action) => {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import REWARDS from 'rewards';
|
||||
|
||||
const selectState = state => state.rewards || {};
|
||||
|
||||
@@ -26,16 +25,7 @@ export const selectClaimedRewardsByTransactionId = createSelector(selectClaimedR
|
||||
}, {})
|
||||
);
|
||||
|
||||
export const selectUnclaimedRewards = createSelector(
|
||||
selectUnclaimedRewardsByType,
|
||||
byType =>
|
||||
Object.values(byType).sort(
|
||||
(a, b) =>
|
||||
REWARDS.SORT_ORDER.indexOf(a.reward_type) < REWARDS.SORT_ORDER.indexOf(b.reward_type)
|
||||
? -1
|
||||
: 1
|
||||
) || []
|
||||
);
|
||||
export const selectUnclaimedRewards = createSelector(selectState, state => state.unclaimedRewards);
|
||||
|
||||
export const selectFetchingRewards = createSelector(selectState, state => !!state.fetching);
|
||||
|
||||
@@ -65,7 +55,8 @@ const selectClaimRewardError = (state, props) =>
|
||||
export const makeSelectClaimRewardError = () =>
|
||||
createSelector(selectClaimRewardError, errorMessage => errorMessage);
|
||||
|
||||
const selectRewardByType = (state, props) => selectUnclaimedRewardsByType(state)[props.reward_type];
|
||||
const selectRewardByType = (state, rewardType) =>
|
||||
selectUnclaimedRewards(state).find(reward => reward.reward_type === rewardType);
|
||||
|
||||
export const makeSelectRewardByType = () => createSelector(selectRewardByType, reward => reward);
|
||||
|
||||
|
||||
+1
-28
@@ -2,21 +2,6 @@ import Lbry from 'lbry';
|
||||
import Lbryio from 'lbryio';
|
||||
import { doShowSnackBar } from 'redux/actions/app';
|
||||
|
||||
function rewardMessage(type, amount) {
|
||||
return {
|
||||
new_developer: __('You earned %s for registering as a new developer.', amount),
|
||||
new_user: __('You earned %s LBC new user reward.', amount),
|
||||
verified_email: __('You earned %s LBC for verifying your email address.', amount),
|
||||
new_channel: __('You earned %s LBC for creating a publisher identity.', amount),
|
||||
first_stream: __('You earned %s LBC for streaming your first video.', amount),
|
||||
many_downloads: __('You earned %s LBC for downloading a bunch of things.', amount),
|
||||
first_publish: __('You earned %s LBC for making your first publication.', amount),
|
||||
featured_download: __('You earned %s LBC for watching a featured download.', amount),
|
||||
referral: __('You earned %s LBC for referring someone.', amount),
|
||||
youtube_creator: __('You earned %s LBC for syncing your YouTube channel.', amount),
|
||||
}[type];
|
||||
}
|
||||
|
||||
const rewards = {};
|
||||
|
||||
rewards.TYPE_NEW_DEVELOPER = 'new_developer';
|
||||
@@ -29,18 +14,6 @@ rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
||||
rewards.TYPE_FEATURED_DOWNLOAD = 'featured_download';
|
||||
rewards.TYPE_REFERRAL = 'referral';
|
||||
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
||||
rewards.SORT_ORDER = [
|
||||
rewards.TYPE_NEW_USER,
|
||||
rewards.TYPE_CONFIRM_EMAIL,
|
||||
rewards.TYPE_FIRST_STREAM,
|
||||
rewards.TYPE_FIRST_CHANNEL,
|
||||
rewards.TYPE_FIRST_PUBLISH,
|
||||
rewards.TYPE_FEATURED_DOWNLOAD,
|
||||
rewards.TYPE_MANY_DOWNLOADS,
|
||||
rewards.TYPE_REFERRAL,
|
||||
rewards.TYPE_NEW_DEVELOPER,
|
||||
rewards.YOUTUBE_CREATOR,
|
||||
];
|
||||
|
||||
rewards.claimReward = type => {
|
||||
function requestReward(resolve, reject, params) {
|
||||
@@ -49,7 +22,7 @@ rewards.claimReward = type => {
|
||||
return;
|
||||
}
|
||||
Lbryio.call('reward', 'new', params, 'post').then(reward => {
|
||||
const message = rewardMessage(type, reward.reward_amount);
|
||||
const message = reward.reward_notification || `You have claimed a ${reward.reward_amount} LBC reward.`;
|
||||
|
||||
// Display global notice
|
||||
const action = doShowSnackBar({
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user