Merge pull request #871 from jessopb/jessopjanuary

minor changes
This commit is contained in:
Shawn K 2019-01-15 10:11:58 -06:00 committed by GitHub
commit adff7230d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 36 additions and 45 deletions

View file

@ -3,9 +3,7 @@ import React from 'react';
const ChannelInfoDisplay = ({name, longId, shortId}) => { const ChannelInfoDisplay = ({name, longId, shortId}) => {
return ( return (
<div> <div>
<h2>channel name: {name}</h2> <h2>{name}:{shortId}</h2>
<p className={'text--secondary'}>full channel id: {longId}</p>
<p className={'text--secondary'}>short channel id: {shortId}</p>
</div> </div>
); );
}; };

View file

@ -1,10 +1,7 @@
import React from 'react'; import React from 'react';
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
import HorizontalSplit from '@components/HorizontalSplit'; import HorizontalSplit from '@components/HorizontalSplit';
/*
This component shouldn't be necessary after pagination is reworked,
though it might be useful for channel_mine situations.
*/
class BlockedLeft extends React.PureComponent { class BlockedLeft extends React.PureComponent {
render () { render () {
return ( return (
@ -19,7 +16,7 @@ class BlockedRight extends React.PureComponent {
render () { render () {
return ( return (
<React.Fragment> <React.Fragment>
<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> <p>In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content.</p>
<p><a href={'https://lbry.io/faq/dmca'} >Click here</a> for more information.</p> <p><a href={'https://lbry.io/faq/dmca'} >Click here</a> for more information.</p>
</React.Fragment> </React.Fragment>
); );
@ -53,6 +50,6 @@ class AssetBlocked extends React.Component {
</div> </div>
); );
} }
}; }
export default AssetBlocked; export default AssetBlocked;

View file

@ -2,7 +2,7 @@ import React from 'react';
import Row from '@components/Row'; import Row from '@components/Row';
import ProgressBar from '@components/ProgressBar'; import ProgressBar from '@components/ProgressBar';
import { LOCAL_CHECK, UNAVAILABLE, ERROR, AVAILABLE } from '../../constants/asset_display_states'; import { LOCAL_CHECK, UNAVAILABLE, ERROR, AVAILABLE } from '../../constants/asset_display_states';
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
class AvailableContent extends React.Component { class AvailableContent extends React.Component {
render () { render () {
@ -95,6 +95,6 @@ class AssetDisplay extends React.Component {
</div> </div>
); );
} }
}; }
export default AssetDisplay; export default AssetDisplay;

View file

@ -7,7 +7,7 @@ import AssetShareButtons from '@components/AssetShareButtons';
import ClickToCopy from '@components/ClickToCopy'; import ClickToCopy from '@components/ClickToCopy';
import HorizontalSplit from '@components/HorizontalSplit'; import HorizontalSplit from '@components/HorizontalSplit';
import siteConfig from '@config/siteConfig.json'; import siteConfig from '@config/siteConfig.json';
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
import AssetInfoFooter from '../../components/AssetInfoFooter/index'; import AssetInfoFooter from '../../components/AssetInfoFooter/index';
import { createPermanentURI } from '@clientutils/createPermanentURI'; import { createPermanentURI } from '@clientutils/createPermanentURI';
@ -109,7 +109,7 @@ class AssetInfo extends React.Component {
) : ( ) : (
<ClickToCopy <ClickToCopy
id={'embed-text-image'} id={'embed-text-image'}
value={`<img src="${assetCanonicalUrl}.${fileExt}"/>`} value={`<img alt="${name}" src="${assetCanonicalUrl}.${fileExt}" />`}
/> />
)} )}
</div> </div>

View file

@ -3,7 +3,7 @@ import { selectFile, updateError, clearFile } from '../../actions/publish';
import { selectAsset } from '../../selectors/show'; import { selectAsset } from '../../selectors/show';
import View from './view'; import View from './view';
import siteConfig from '@config/siteConfig.json'; import siteConfig from '@config/siteConfig.json';
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
const { assetDefaults: { thumbnail: defaultThumbnail } } = siteConfig; const { assetDefaults: { thumbnail: defaultThumbnail } } = siteConfig;

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { NavLink, withRouter } from 'react-router-dom'; import { NavLink, withRouter } from 'react-router-dom';
import NavBarChannelOptionsDropdown from '@components/NavBarChannelOptionsDropdown'; import NavBarChannelOptionsDropdown from '@components/NavBarChannelOptionsDropdown';
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
const VIEW = 'VIEW'; const VIEW = 'VIEW';
const LOGOUT = 'LOGOUT'; const LOGOUT = 'LOGOUT';

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import createPageTitle from '../../utils/createPageTitle'; import createPageTitle from '../../utils/createPageTitle';
import createMetaTags from '../../utils/createMetaTags'; import createMetaTags from '../../utils/createMetaTags';
import oEmbed from '../../utils/oEmbed.js'; import oEmbed from '../../utils/oEmbed.js';
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
import siteConfig from '@config/siteConfig.json'; import siteConfig from '@config/siteConfig.json';
const { details: { host } } = siteConfig; const { details: { host } } = siteConfig;

View file

@ -1,7 +1,7 @@
import siteConfig from '@config/siteConfig.json'; import siteConfig from '@config/siteConfig.json';
import determineContentTypeFromExtension from './determineContentTypeFromExtension'; import determineContentTypeFromExtension from './determineContentTypeFromExtension';
import createMetaTagsArray from './createMetaTagsArray'; import createMetaTagsArray from './createMetaTagsArray';
import createCanonicalLink from '../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
const { const {
details: { details: {

View file

@ -1,7 +1,7 @@
import siteConfig from '@config/siteConfig.json'; import siteConfig from '@config/siteConfig.json';
import determineContentTypeFromExtension from './determineContentTypeFromExtension'; import determineContentTypeFromExtension from './determineContentTypeFromExtension';
import createMetaTagsArray from './createMetaTagsArray'; import createMetaTagsArray from './createMetaTagsArray';
import createCanonicalLink from '../../../utils/createCanonicalLink'; import createCanonicalLink from '@globalutils/createCanonicalLink';
const { const {
details: { details: {

View file

@ -3,7 +3,7 @@ const logger = require('winston');
const { details: { host }, publishing: { disabled, disabledMessage } } = require('@config/siteConfig'); const { details: { host }, publishing: { disabled, disabledMessage } } = require('@config/siteConfig');
const { sendGATimingEvent } = require('../../../../utils/googleAnalytics.js'); const { sendGATimingEvent } = require('../../../../utils/googleAnalytics.js');
const isApprovedChannel = require('../../../../../utils/isApprovedChannel'); const isApprovedChannel = require('@globalutils/isApprovedChannel');
const { publishing: { publishOnlyApproved, approvedChannels } } = require('@config/siteConfig'); const { publishing: { publishOnlyApproved, approvedChannels } } = require('@config/siteConfig');
const { handleErrorResponse } = require('../../../utils/errorHandlers.js'); const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
@ -18,7 +18,7 @@ const parsePublishApiRequestFiles = require('./parsePublishApiRequestFiles.js');
const authenticateUser = require('./authentication.js'); const authenticateUser = require('./authentication.js');
const chainquery = require('chainquery').default; const chainquery = require('chainquery').default;
const createCanonicalLink = require('../../../../../utils/createCanonicalLink'); const createCanonicalLink = require('@globalutils/createCanonicalLink');
const CLAIM_TAKEN = 'CLAIM_TAKEN'; const CLAIM_TAKEN = 'CLAIM_TAKEN';
const UNAPPROVED_CHANNEL = 'UNAPPROVED_CHANNEL'; const UNAPPROVED_CHANNEL = 'UNAPPROVED_CHANNEL';
@ -115,7 +115,7 @@ const claimPublish = ({ body, files, headers, ip, originalUrl, user, tor }, res)
if (channelName) { if (channelName) {
return chainquery.claim.queries.getShortClaimIdFromLongClaimId(claimData.certificateId, channelName); return chainquery.claim.queries.getShortClaimIdFromLongClaimId(claimData.certificateId, channelName);
} else { } else {
return chainquery.claim.queries.getShortClaimIdFromLongClaimId(claimId, name, claimData).catch(error => { return chainquery.claim.queries.getShortClaimIdFromLongClaimId(claimId, name, claimData).catch(() => {
return claimId.slice(0, 1); return claimId.slice(0, 1);
}); });
} }

View file

@ -10,7 +10,7 @@ const parsePublishApiRequestFiles = require('../publish/parsePublishApiRequestFi
const authenticateUser = require('../publish/authentication.js'); const authenticateUser = require('../publish/authentication.js');
const createThumbnailPublishParams = require('../publish/createThumbnailPublishParams.js'); const createThumbnailPublishParams = require('../publish/createThumbnailPublishParams.js');
const chainquery = require('chainquery').default; const chainquery = require('chainquery').default;
const createCanonicalLink = require('../../../../../utils/createCanonicalLink'); const createCanonicalLink = require('@globalutils/createCanonicalLink');
/* /*
route to update a claim through the daemon route to update a claim through the daemon
@ -153,7 +153,7 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
if (channelName) { if (channelName) {
return chainquery.claim.queries.getShortClaimIdFromLongClaimId(result.certificateId, channelName); return chainquery.claim.queries.getShortClaimIdFromLongClaimId(result.certificateId, channelName);
} else { } else {
return chainquery.claim.queries.getShortClaimIdFromLongClaimId(result.claimId, name, result).catch(error => { return chainquery.claim.queries.getShortClaimIdFromLongClaimId(result.claimId, name, result).catch(() => {
return result.claimId.slice(0, 1); return result.claimId.slice(0, 1);
}); });
} }

View file

@ -36,7 +36,7 @@ const {
const { sessionKey } = require('@private/authConfig.json'); const { sessionKey } = require('@private/authConfig.json');
// configure.js doesn't handle new keys in config.json files yet. Make sure it doens't break. // configure.js doesn't handle new keys in config.json files yet. Make sure it doens't break.
let bLE; let finalBlockListEndpoint;
function Server () { function Server () {
this.initialize = () => { this.initialize = () => {
@ -176,30 +176,29 @@ function Server () {
return; return;
} }
if (blockListEndpoint) { if (blockListEndpoint) {
bLE = blockListEndpoint; finalBlockListEndpoint = blockListEndpoint;
} else if (!blockListEndpoint) { } else if (!blockListEndpoint) {
if (typeof (blockListEndpoint) !== 'string') { if (typeof (blockListEndpoint) !== 'string') {
logger.warn('blockListEndpoint is null due to outdated siteConfig file. \n' + logger.warn('blockListEndpoint is null due to outdated siteConfig file. \n' +
'Continuing with default LBRY blocklist api endpoint. \n ' + 'Continuing with default LBRY blocklist api endpoint. \n ' +
'(Specify /"blockListEndpoint" : ""/ to disable.') '(Specify /"blockListEndpoint" : ""/ to disable.');
bLE = 'https://api.lbry.io/file/list_blocked'; finalBlockListEndpoint = 'https://api.lbry.io/file/list_blocked';
} }
} }
logger.info(`Peforming updates...`); logger.info(`Peforming updates...`);
if (!bLE) { if (!finalBlockListEndpoint) {
logger.info('Configured for no Block List') logger.info('Configured for no Block List');
db.Tor.refreshTable().then( (updatedTorList) => { db.Tor.refreshTable().then((updatedTorList) => {
logger.info('Tor list updated, length:', updatedTorList.length); logger.info('Tor list updated, length:', updatedTorList.length);
}); });
} else { } else {
return Promise.all([ return Promise.all([
db.Blocked.refreshTable(bLE), db.Blocked.refreshTable(finalBlockListEndpoint),
db.Tor.refreshTable()]) db.Tor.refreshTable()])
.then(([updatedBlockedList, updatedTorList]) => { .then(([updatedBlockedList, updatedTorList]) => {
logger.info('Blocked list updated, length:', updatedBlockedList.length); logger.info('Blocked list updated, length:', updatedBlockedList.length);
logger.info('Tor list updated, length:', updatedTorList.length); logger.info('Tor list updated, length:', updatedTorList.length);
}) });
} }
}; };
this.start = () => { this.start = () => {

View file

@ -12,10 +12,8 @@ import * as httpContext from 'express-http-context';
import Reducers from '@reducers'; import Reducers from '@reducers';
import GAListener from '@components/GAListener'; import GAListener from '@components/GAListener';
import App from '@app'; import App from '@app';
import Sagas from '@sagas';
import Actions from '@actions';
const createCanonicalLink = require('../../utils/createCanonicalLink'); const createCanonicalLink = require('@globalutils/createCanonicalLink');
const getCanonicalUrlFromShow = show => { const getCanonicalUrlFromShow = show => {
const requestId = show.requestList[show.request.id]; const requestId = show.requestList[show.request.id];
@ -49,19 +47,18 @@ export default (req, res) => {
action = false, action = false,
saga = false, saga = false,
} = httpContext.get('routeData'); } = httpContext.get('routeData');
if (action === 'fallback') { if (action === 'fallback') {
res.status(404); res.status(404);
} }
const runSaga = (action !== false && saga !== false); const runSaga = (action !== false && saga !== false);
const renderPage = (store) => { const renderPage = (store) => {
// Workaround, remove when a solution for async httpContext exists // Workaround, remove when a solution for async httpContext exists
const showState = store.getState().show; const showState = store.getState().show;
const assetKeys = Object.keys(showState.assetList); const assetKeys = Object.keys(showState.assetList);
if(assetKeys.length !== 0) { if (assetKeys.length !== 0) {
res.claimId = showState.assetList[assetKeys[0]].claimId; res.claimId = showState.assetList[assetKeys[0]].claimId;
} else { } else {
const channelKeys = Object.keys(showState.channelList); const channelKeys = Object.keys(showState.channelList);
@ -118,17 +115,17 @@ export default (req, res) => {
.then(() => { .then(() => {
// redirect if request does not use canonical url // redirect if request does not use canonical url
const canonicalUrl = getCanonicalUrlFromShow(store.getState().show); const canonicalUrl = getCanonicalUrlFromShow(store.getState().show);
if (!canonicalUrl) { if (!canonicalUrl) {
res.status(404); res.status(404);
} }
if (canonicalUrl && canonicalUrl !== req.originalUrl) { if (canonicalUrl && canonicalUrl !== req.originalUrl) {
console.log(`redirecting ${req.originalUrl} to ${canonicalUrl}`); console.log(`redirecting ${req.originalUrl} to ${canonicalUrl}`);
res.redirect(canonicalUrl); res.redirect(canonicalUrl);
} }
return renderPage(store) return renderPage(store);
}); });
} else { } else {
const store = createStore(Reducers); const store = createStore(Reducers);

View file

@ -18,7 +18,7 @@ async function getMediaDimensions (fileType, filePath) {
[ height, width ] = await getVideoHeightAndWidth(filePath); [ height, width ] = await getVideoHeightAndWidth(filePath);
break; break;
default: default:
logger.error('unable to create File data for unspported file type:', fileType); logger.error('unable to create File dimension data for unspported file type:', fileType);
break; break;
} }
return { return {