updated app to use siteconfig rather than speechconfig
This commit is contained in:
parent
0c1f81cced
commit
0e9455278e
|
@ -1,7 +1,7 @@
|
||||||
# Spee.ch
|
# Spee.ch
|
||||||
Spee.ch is a web app that reads and publishes images and videos to and from the [LBRY](https://lbry.io/) blockchain.
|
Spee.ch is a web app that reads and publishes images and videos to and from the [LBRY](https://lbry.io/) blockchain.
|
||||||
|
|
||||||
## How to run this repository locally
|
##Installation
|
||||||
* start mysql
|
* start mysql
|
||||||
* install mysql
|
* install mysql
|
||||||
* create a database called `lbry`
|
* create a database called `lbry`
|
||||||
|
@ -12,7 +12,8 @@ Spee.ch is a web app that reads and publishes images and videos to and from the
|
||||||
* start spee.ch
|
* start spee.ch
|
||||||
* clone this repo
|
* clone this repo
|
||||||
* run `npm install`
|
* run `npm install`
|
||||||
* create your `speechConfig.js` file
|
* create your `
|
||||||
|
speechConfig.js` file
|
||||||
* copy `speechConfig.js.example` and name it `speechConfig.js`
|
* copy `speechConfig.js.example` and name it `speechConfig.js`
|
||||||
* replace the `null` values in the config file with the appropriate values for your environment
|
* replace the `null` values in the config file with the appropriate values for your environment
|
||||||
* build the app by running `npm run build-prod`
|
* build the app by running `npm run build-prod`
|
||||||
|
|
26
config/siteConfig.js
Normal file
26
config/siteConfig.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
module.exports = {
|
||||||
|
analytics: {
|
||||||
|
googleId: 'default',
|
||||||
|
},
|
||||||
|
publishing: {
|
||||||
|
primaryClaimAddress : 'default',
|
||||||
|
additionalClaimAddresses: [],
|
||||||
|
thumbnailChannel : 'default',
|
||||||
|
thumbnailChannelId : 'default',
|
||||||
|
uploadDirectory : '/home/lbry/Uploads',
|
||||||
|
},
|
||||||
|
details: {
|
||||||
|
title : 'Spee<h',
|
||||||
|
name : 'Spee.ch',
|
||||||
|
host : 'https://dev1.spee.ch',
|
||||||
|
description: 'Open-source, decentralized image and video sharing.',
|
||||||
|
},
|
||||||
|
assetDefaults: {
|
||||||
|
title : 'dev1 Spee.ch',
|
||||||
|
thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
|
||||||
|
description: 'Open-source, decentralized image and video sharing.',
|
||||||
|
},
|
||||||
|
session: {
|
||||||
|
sessionKey: 'default',
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,30 +0,0 @@
|
||||||
const speechConfig = {
|
|
||||||
analytics: {
|
|
||||||
googleId: 'UA-60403362-6', // google id for analytics tracking; leave `null` if not applicable
|
|
||||||
},
|
|
||||||
session: {
|
|
||||||
sessionKey: 'nans$#kfjanwe234rydns', // enter a secret key to be used for session encryption
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
uploadDirectory: '/home/lbry/Uploads', // enter file path to where uploads/publishes should be stored
|
|
||||||
},
|
|
||||||
site: {
|
|
||||||
title : 'dev1.Spee.ch',
|
|
||||||
name : 'dev1.Spee.ch',
|
|
||||||
host : 'https://dev1.spee.ch',
|
|
||||||
description: 'Open-source, decentralized image and video sharing.',
|
|
||||||
},
|
|
||||||
publish: {
|
|
||||||
primaryClaimAddress : 'bDZ2wPwtULUGxT7GXuNLpQhXmdPRUTUkcL',
|
|
||||||
additionalClaimAddresses: ['banpwixPosfVDWnGvXqU2af36Qpsd7buGd'],
|
|
||||||
thumbnailChannel : '@dev1thumbs', // create a channel to use for thumbnail images
|
|
||||||
thumbnailChannelId : 'aeb625ff6f66c3eeeb42885070f4e53876033626', // the channel_id (claim id) for the channel above
|
|
||||||
},
|
|
||||||
claim: {
|
|
||||||
defaultTitle : 'dev1 Spee.ch',
|
|
||||||
defaultThumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
|
|
||||||
defaultDescription: 'Open-source, decentralized image and video sharing.',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = speechConfig;
|
|
|
@ -2,7 +2,7 @@ const logger = require('winston');
|
||||||
const db = require('../models');
|
const db = require('../models');
|
||||||
const lbryApi = require('../helpers/lbryApi.js');
|
const lbryApi = require('../helpers/lbryApi.js');
|
||||||
const publishHelpers = require('../helpers/publishHelpers.js');
|
const publishHelpers = require('../helpers/publishHelpers.js');
|
||||||
const config = require('../config/speechConfig.js');
|
const { publishing: { primaryClaimAddress } } = require('../config/siteConfig.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
publish (publishParams, fileName, fileType) {
|
publish (publishParams, fileName, fileType) {
|
||||||
|
@ -91,10 +91,9 @@ module.exports = {
|
||||||
return db.File.findAll({ where: { name } })
|
return db.File.findAll({ where: { name } })
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.length >= 1) {
|
if (result.length >= 1) {
|
||||||
const claimAddress = config.wallet.lbryClaimAddress;
|
|
||||||
// filter out any results that were not published from spee.ch's wallet address
|
// filter out any results that were not published from spee.ch's wallet address
|
||||||
const filteredResult = result.filter((claim) => {
|
const filteredResult = result.filter((claim) => {
|
||||||
return (claim.address === claimAddress);
|
return (claim.address === primaryClaimAddress);
|
||||||
});
|
});
|
||||||
// return based on whether any non-spee.ch claims were left
|
// return based on whether any non-spee.ch claims were left
|
||||||
if (filteredResult.length >= 1) {
|
if (filteredResult.length >= 1) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const ua = require('universal-analytics');
|
const ua = require('universal-analytics');
|
||||||
const { analytics : { googleId }, site: { name: siteName } } = require('../config/speechConfig.js');
|
const { analytics : { googleId }, details: { name: siteName } } = require('../config/siteConfig.js');
|
||||||
|
|
||||||
function createServeEventParams (headers, ip, originalUrl) {
|
function createServeEventParams (headers, ip, originalUrl) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { site, wallet, publish } = require('../config/speechConfig.js');
|
const { details, publishing } = require('../config/siteConfig.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
parsePublishApiRequestBody ({name, nsfw, license, title, description, thumbnail}) {
|
parsePublishApiRequestBody ({name, nsfw, license, title, description, thumbnail}) {
|
||||||
|
@ -109,12 +109,12 @@ module.exports = {
|
||||||
metadata : {
|
metadata : {
|
||||||
description,
|
description,
|
||||||
title,
|
title,
|
||||||
author : site.title,
|
author : details.title,
|
||||||
language: 'en',
|
language: 'en',
|
||||||
license,
|
license,
|
||||||
nsfw,
|
nsfw,
|
||||||
},
|
},
|
||||||
claim_address: wallet.lbryClaimAddress,
|
claim_address: publishing.primaryClaimAddress,
|
||||||
};
|
};
|
||||||
// add thumbnail to channel if video
|
// add thumbnail to channel if video
|
||||||
if (thumbnail) {
|
if (thumbnail) {
|
||||||
|
@ -135,14 +135,14 @@ module.exports = {
|
||||||
metadata : {
|
metadata : {
|
||||||
title : `${claimName} thumbnail`,
|
title : `${claimName} thumbnail`,
|
||||||
description: `a thumbnail for ${claimName}`,
|
description: `a thumbnail for ${claimName}`,
|
||||||
author : site.title,
|
author : details.title,
|
||||||
language : 'en',
|
language : 'en',
|
||||||
license,
|
license,
|
||||||
nsfw,
|
nsfw,
|
||||||
},
|
},
|
||||||
claim_address: wallet.lbryClaimAddress,
|
claim_address: publishing.primaryClaimAddress,
|
||||||
channel_name : publish.thumbnailChannel,
|
channel_name : publishing.thumbnailChannel,
|
||||||
channel_id : publish.thumbnailChannelId,
|
channel_id : publishing.thumbnailChannelId,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
deleteTemporaryFile (filePath) {
|
deleteTemporaryFile (filePath) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const { returnShortId } = require('../helpers/sequelizeHelpers.js');
|
const { returnShortId } = require('../helpers/sequelizeHelpers.js');
|
||||||
const { claim, site } = require('../config/speechConfig.js');
|
const { assetDefaults: { thumbnail: defaultThumbnail }, details: { host } } = require('../config/siteConfig.js');
|
||||||
const { defaultThumbnail } = claim;
|
|
||||||
|
|
||||||
function determineFileExtensionFromContentType (contentType) {
|
function determineFileExtensionFromContentType (contentType) {
|
||||||
switch (contentType) {
|
switch (contentType) {
|
||||||
|
@ -31,7 +30,7 @@ function prepareClaimData (claim) {
|
||||||
// logger.debug('preparing claim data based on resolved data:', claim);
|
// logger.debug('preparing claim data based on resolved data:', claim);
|
||||||
claim['thumbnail'] = determineThumbnail(claim.thumbnail, defaultThumbnail);
|
claim['thumbnail'] = determineThumbnail(claim.thumbnail, defaultThumbnail);
|
||||||
claim['fileExt'] = determineFileExtensionFromContentType(claim.contentType);
|
claim['fileExt'] = determineFileExtensionFromContentType(claim.contentType);
|
||||||
claim['host'] = site.host;
|
claim['host'] = host;
|
||||||
return claim;
|
return claim;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
47653
public/bundle/bundle.js
47653
public/bundle/bundle.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
import Request from 'utils/request';
|
import Request from 'utils/request';
|
||||||
const { site: { host } } = require('../../config/speechConfig.js');
|
const { details: { host } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
export function getLongClaimId (name, modifier) {
|
export function getLongClaimId (name, modifier) {
|
||||||
let body = {};
|
let body = {};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Request from 'utils/request';
|
import Request from 'utils/request';
|
||||||
const { site: { host } } = require('../../config/speechConfig.js');
|
const { details: { host } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
export function getChannelData (name, id) {
|
export function getChannelData (name, id) {
|
||||||
if (!id) id = 'none';
|
if (!id) id = 'none';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Request from 'utils/request';
|
import Request from 'utils/request';
|
||||||
const { site: { host } } = require('../../config/speechConfig.js');
|
const { details: { host } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
export function checkFileAvailability (name, claimId) {
|
export function checkFileAvailability (name, claimId) {
|
||||||
const url = `${host}/api/file/availability/${name}/${claimId}`;
|
const url = `${host}/api/file/availability/${name}/${claimId}`;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
const { claim: { defaultThumbnail } } = require('../../../config/speechConfig.js');
|
const { assetDefaults: { thumbnail: defaultThumbnail } } = require('../../../config/siteConfig.js');
|
||||||
|
|
||||||
const AssetPreview = ({ claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
|
const AssetPreview = ({ claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
|
||||||
const directSourceLink = `${claimId}/${name}.${fileExt}`;
|
const directSourceLink = `${claimId}/${name}.${fileExt}`;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import NavBar from 'containers/NavBar';
|
import NavBar from 'containers/NavBar';
|
||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
const { site: { title, host } } = require('../../../config/speechConfig.js');
|
const { details: { title, host } } = require('../../../config/siteConfig.js');
|
||||||
|
|
||||||
class FourOhForPage extends React.Component {
|
class FourOhForPage extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import GoogleAnalytics from 'react-ga';
|
import GoogleAnalytics from 'react-ga';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
const config = require('../../../config/speechConfig.js');
|
const {analytics: googleId} = require('../../../config/siteConfig.js');
|
||||||
const googleApiKey = config.analytics.googleId;
|
|
||||||
|
|
||||||
GoogleAnalytics.initialize(googleApiKey);
|
GoogleAnalytics.initialize(googleId);
|
||||||
|
|
||||||
class GAListener extends React.Component {
|
class GAListener extends React.Component {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import * as actions from 'constants/publish_action_types';
|
import * as actions from 'constants/publish_action_types';
|
||||||
import { LOGIN } from 'constants/publish_channel_select_states';
|
import { LOGIN } from 'constants/publish_channel_select_states';
|
||||||
const { publish } = require('../../config/speechConfig.js');
|
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
publishInChannel : false,
|
publishInChannel : false,
|
||||||
|
@ -24,9 +23,7 @@ const initialState = {
|
||||||
license : '',
|
license : '',
|
||||||
nsfw : false,
|
nsfw : false,
|
||||||
},
|
},
|
||||||
thumbnailChannel : publish.thumbnailChannel,
|
thumbnail: null,
|
||||||
thumbnailChannelId: publish.thumbnailChannelId,
|
|
||||||
thumbnail : null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function (state = initialState, action) {
|
export default function (state = initialState, action) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const { site } = require('../../config/speechConfig.js');
|
const { details: { host } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
host: site.host,
|
host: host,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function (state = initialState, action) {
|
export default function (state = initialState, action) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { site: { host } } = require('../../config/speechConfig.js');
|
const { details: { host } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
const createBasicCanonicalLink = (page) => {
|
const createBasicCanonicalLink = (page) => {
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { site: { title, host, description }, claim: { defaultThumbnail, defaultDescription } } = require('../../config/speechConfig.js');
|
const { details: { title, host, description }, assetDefaults: { thumbnail: defaultThumbnail, description: defaultDescription } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
const determineOgThumbnailContentType = (thumbnail) => {
|
const determineOgThumbnailContentType = (thumbnail) => {
|
||||||
if (thumbnail) {
|
if (thumbnail) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { site: { title: siteTitle } } = require('../../config/speechConfig.js');
|
const { details: { title: siteTitle } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
export const createPageTitle = (pageTitle) => {
|
export const createPageTitle = (pageTitle) => {
|
||||||
if (!pageTitle) {
|
if (!pageTitle) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const multipart = require('connect-multiparty');
|
const multipart = require('connect-multiparty');
|
||||||
const { files, site } = require('../config/speechConfig.js');
|
const { publishing: { uploadDirectory }, details: { host } } = require('../config/siteConfig.js');
|
||||||
const multipartMiddleware = multipart({uploadDir: files.uploadDirectory});
|
const multipartMiddleware = multipart({uploadDir: uploadDirectory});
|
||||||
const db = require('../models');
|
const db = require('../models');
|
||||||
const { claimNameIsAvailable, checkChannelAvailability, publish } = require('../controllers/publishController.js');
|
const { claimNameIsAvailable, checkChannelAvailability, publish } = require('../controllers/publishController.js');
|
||||||
const { getClaimList, resolveUri, getClaim } = require('../helpers/lbryApi.js');
|
const { getClaimList, resolveUri, getClaim } = require('../helpers/lbryApi.js');
|
||||||
|
@ -170,7 +170,7 @@ module.exports = (app) => {
|
||||||
data : {
|
data : {
|
||||||
name,
|
name,
|
||||||
claimId: result.claim_id,
|
claimId: result.claim_id,
|
||||||
url : `${site.host}/${result.claim_id}/${name}`,
|
url : `${host}/${result.claim_id}/${name}`,
|
||||||
lbryTx : result,
|
lbryTx : result,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { site } = require('../config/speechConfig.js');
|
const { details: host } = require('../config/siteConfig.js');
|
||||||
const handlePageRender = require('../helpers/handlePageRender.jsx');
|
const handlePageRender = require('../helpers/handlePageRender.jsx');
|
||||||
|
|
||||||
module.exports = (app) => {
|
module.exports = (app) => {
|
||||||
|
@ -29,7 +29,6 @@ module.exports = (app) => {
|
||||||
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
||||||
const claimId = params.claimId;
|
const claimId = params.claimId;
|
||||||
const name = params.name;
|
const name = params.name;
|
||||||
const host = site.host;
|
|
||||||
// get and render the content
|
// get and render the content
|
||||||
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
|
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const chaiHttp = require('chai-http');
|
const chaiHttp = require('chai-http');
|
||||||
const { site: { host } } = require('../../config/speechConfig.js');
|
const { details: { host } } = require('../../config/siteConfig.js');
|
||||||
const { testChannel, testChannelId, testChannelPassword } = require('../../devConfig/testingConfig.js');
|
const { testChannel, testChannelId, testChannelPassword } = require('../../devConfig/testingConfig.js');
|
||||||
const requestTimeout = 20000;
|
const requestTimeout = 20000;
|
||||||
const publishTimeout = 120000;
|
const publishTimeout = 120000;
|
||||||
|
|
Loading…
Reference in a new issue