updated app to use siteconfig rather than speechconfig
This commit is contained in:
parent
0c1f81cced
commit
0e9455278e
25 changed files with 69 additions and 58489 deletions
|
@ -1,7 +1,7 @@
|
|||
# Spee.ch
|
||||
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
|
||||
* install mysql
|
||||
* 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
|
||||
* clone this repo
|
||||
* run `npm install`
|
||||
* create your `speechConfig.js` file
|
||||
* create your `
|
||||
speechConfig.js` file
|
||||
* copy `speechConfig.js.example` and name it `speechConfig.js`
|
||||
* replace the `null` values in the config file with the appropriate values for your environment
|
||||
* 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 lbryApi = require('../helpers/lbryApi.js');
|
||||
const publishHelpers = require('../helpers/publishHelpers.js');
|
||||
const config = require('../config/speechConfig.js');
|
||||
const { publishing: { primaryClaimAddress } } = require('../config/siteConfig.js');
|
||||
|
||||
module.exports = {
|
||||
publish (publishParams, fileName, fileType) {
|
||||
|
@ -91,10 +91,9 @@ module.exports = {
|
|||
return db.File.findAll({ where: { name } })
|
||||
.then(result => {
|
||||
if (result.length >= 1) {
|
||||
const claimAddress = config.wallet.lbryClaimAddress;
|
||||
// filter out any results that were not published from spee.ch's wallet address
|
||||
const filteredResult = result.filter((claim) => {
|
||||
return (claim.address === claimAddress);
|
||||
return (claim.address === primaryClaimAddress);
|
||||
});
|
||||
// return based on whether any non-spee.ch claims were left
|
||||
if (filteredResult.length >= 1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const logger = require('winston');
|
||||
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) {
|
||||
return {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const logger = require('winston');
|
||||
const fs = require('fs');
|
||||
const { site, wallet, publish } = require('../config/speechConfig.js');
|
||||
const { details, publishing } = require('../config/siteConfig.js');
|
||||
|
||||
module.exports = {
|
||||
parsePublishApiRequestBody ({name, nsfw, license, title, description, thumbnail}) {
|
||||
|
@ -109,12 +109,12 @@ module.exports = {
|
|||
metadata : {
|
||||
description,
|
||||
title,
|
||||
author : site.title,
|
||||
author : details.title,
|
||||
language: 'en',
|
||||
license,
|
||||
nsfw,
|
||||
},
|
||||
claim_address: wallet.lbryClaimAddress,
|
||||
claim_address: publishing.primaryClaimAddress,
|
||||
};
|
||||
// add thumbnail to channel if video
|
||||
if (thumbnail) {
|
||||
|
@ -135,14 +135,14 @@ module.exports = {
|
|||
metadata : {
|
||||
title : `${claimName} thumbnail`,
|
||||
description: `a thumbnail for ${claimName}`,
|
||||
author : site.title,
|
||||
author : details.title,
|
||||
language : 'en',
|
||||
license,
|
||||
nsfw,
|
||||
},
|
||||
claim_address: wallet.lbryClaimAddress,
|
||||
channel_name : publish.thumbnailChannel,
|
||||
channel_id : publish.thumbnailChannelId,
|
||||
claim_address: publishing.primaryClaimAddress,
|
||||
channel_name : publishing.thumbnailChannel,
|
||||
channel_id : publishing.thumbnailChannelId,
|
||||
};
|
||||
},
|
||||
deleteTemporaryFile (filePath) {
|
||||
|
|
10773
index.js
10773
index.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,6 @@
|
|||
const logger = require('winston');
|
||||
const { returnShortId } = require('../helpers/sequelizeHelpers.js');
|
||||
const { claim, site } = require('../config/speechConfig.js');
|
||||
const { defaultThumbnail } = claim;
|
||||
const { assetDefaults: { thumbnail: defaultThumbnail }, details: { host } } = require('../config/siteConfig.js');
|
||||
|
||||
function determineFileExtensionFromContentType (contentType) {
|
||||
switch (contentType) {
|
||||
|
@ -31,7 +30,7 @@ function prepareClaimData (claim) {
|
|||
// logger.debug('preparing claim data based on resolved data:', claim);
|
||||
claim['thumbnail'] = determineThumbnail(claim.thumbnail, defaultThumbnail);
|
||||
claim['fileExt'] = determineFileExtensionFromContentType(claim.contentType);
|
||||
claim['host'] = site.host;
|
||||
claim['host'] = host;
|
||||
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';
|
||||
const { site: { host } } = require('../../config/speechConfig.js');
|
||||
const { details: { host } } = require('../../config/siteConfig.js');
|
||||
|
||||
export function getLongClaimId (name, modifier) {
|
||||
let body = {};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Request from 'utils/request';
|
||||
const { site: { host } } = require('../../config/speechConfig.js');
|
||||
const { details: { host } } = require('../../config/siteConfig.js');
|
||||
|
||||
export function getChannelData (name, id) {
|
||||
if (!id) id = 'none';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Request from 'utils/request';
|
||||
const { site: { host } } = require('../../config/speechConfig.js');
|
||||
const { details: { host } } = require('../../config/siteConfig.js');
|
||||
|
||||
export function checkFileAvailability (name, claimId) {
|
||||
const url = `${host}/api/file/availability/${name}/${claimId}`;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
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 directSourceLink = `${claimId}/${name}.${fileExt}`;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import NavBar from 'containers/NavBar';
|
||||
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 {
|
||||
render () {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import React from 'react';
|
||||
import GoogleAnalytics from 'react-ga';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
const config = require('../../../config/speechConfig.js');
|
||||
const googleApiKey = config.analytics.googleId;
|
||||
const {analytics: googleId} = require('../../../config/siteConfig.js');
|
||||
|
||||
GoogleAnalytics.initialize(googleApiKey);
|
||||
GoogleAnalytics.initialize(googleId);
|
||||
|
||||
class GAListener extends React.Component {
|
||||
componentDidMount () {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import * as actions from 'constants/publish_action_types';
|
||||
import { LOGIN } from 'constants/publish_channel_select_states';
|
||||
const { publish } = require('../../config/speechConfig.js');
|
||||
|
||||
const initialState = {
|
||||
publishInChannel : false,
|
||||
|
@ -24,9 +23,7 @@ const initialState = {
|
|||
license : '',
|
||||
nsfw : false,
|
||||
},
|
||||
thumbnailChannel : publish.thumbnailChannel,
|
||||
thumbnailChannelId: publish.thumbnailChannelId,
|
||||
thumbnail : null,
|
||||
thumbnail: null,
|
||||
};
|
||||
|
||||
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 = {
|
||||
host: site.host,
|
||||
host: host,
|
||||
};
|
||||
|
||||
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) => {
|
||||
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) => {
|
||||
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) => {
|
||||
if (!pageTitle) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const logger = require('winston');
|
||||
const multipart = require('connect-multiparty');
|
||||
const { files, site } = require('../config/speechConfig.js');
|
||||
const multipartMiddleware = multipart({uploadDir: files.uploadDirectory});
|
||||
const { publishing: { uploadDirectory }, details: { host } } = require('../config/siteConfig.js');
|
||||
const multipartMiddleware = multipart({uploadDir: uploadDirectory});
|
||||
const db = require('../models');
|
||||
const { claimNameIsAvailable, checkChannelAvailability, publish } = require('../controllers/publishController.js');
|
||||
const { getClaimList, resolveUri, getClaim } = require('../helpers/lbryApi.js');
|
||||
|
@ -170,7 +170,7 @@ module.exports = (app) => {
|
|||
data : {
|
||||
name,
|
||||
claimId: result.claim_id,
|
||||
url : `${site.host}/${result.claim_id}/${name}`,
|
||||
url : `${host}/${result.claim_id}/${name}`,
|
||||
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');
|
||||
|
||||
module.exports = (app) => {
|
||||
|
@ -29,7 +29,6 @@ module.exports = (app) => {
|
|||
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
||||
const claimId = params.claimId;
|
||||
const name = params.name;
|
||||
const host = site.host;
|
||||
// get and render the content
|
||||
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const chai = require('chai');
|
||||
const expect = chai.expect;
|
||||
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 requestTimeout = 20000;
|
||||
const publishTimeout = 120000;
|
||||
|
|
Loading…
Reference in a new issue