cleaned up errors and updated build scripts
This commit is contained in:
parent
dc558e9b9c
commit
60ffe5de95
28 changed files with 139 additions and 127 deletions
|
@ -1,6 +1,5 @@
|
||||||
node_modules/
|
|
||||||
exports/
|
|
||||||
index.js
|
|
||||||
test/
|
|
||||||
server/render/build
|
|
||||||
client/build
|
client/build
|
||||||
|
node_modules/
|
||||||
|
public/bundle
|
||||||
|
server/render/build
|
||||||
|
test/
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -16,4 +16,6 @@ config/siteConfig.json
|
||||||
|
|
||||||
public/bundle/bundle.js
|
public/bundle/bundle.js
|
||||||
public/bundle/bundle.js.map
|
public/bundle/bundle.js.map
|
||||||
|
public/bundle/Lekton-*
|
||||||
|
public/bundle/style.css
|
||||||
|
|
||||||
|
|
26
README.md
26
README.md
|
@ -2,15 +2,30 @@
|
||||||
This repo packages the spee.ch server for use with spee.ch implementations.
|
This repo packages the spee.ch server for use with spee.ch implementations.
|
||||||
|
|
||||||
### Quick start
|
### Quick start
|
||||||
To get started running your own version of spee.ch, visit [lbryio/www.spee.ch](https://github.com/lbryio/www.spee.ch)
|
|
||||||
|
|
||||||
### Install
|
Install dependencies
|
||||||
```
|
```
|
||||||
npm install spee.ch --save
|
npm install
|
||||||
|
```
|
||||||
|
create config file
|
||||||
|
```
|
||||||
|
npm run configure
|
||||||
|
```
|
||||||
|
build from source code
|
||||||
|
```
|
||||||
|
npm run transpile
|
||||||
|
```
|
||||||
|
create client bundle with webpack
|
||||||
|
```
|
||||||
|
npm run bundle
|
||||||
|
```
|
||||||
|
start the sever
|
||||||
|
```
|
||||||
|
npm run start
|
||||||
```
|
```
|
||||||
|
|
||||||
### Dependenceis
|
### System dependencies
|
||||||
Make sure the following are installed
|
Spee.ch relies on the following programs being installed on your server:
|
||||||
* [imagemagick](https://www.imagemagick.org/script/download.php)
|
* [imagemagick](https://www.imagemagick.org/script/download.php)
|
||||||
* [ffmpeg](https://www.ffmpeg.org/download.html)
|
* [ffmpeg](https://www.ffmpeg.org/download.html)
|
||||||
|
|
||||||
|
@ -19,6 +34,7 @@ Make sure the following are installed
|
||||||
* `index.js` is the entry point for the server. It creates the [express app](https://expressjs.com/), requires the routes, syncs the database, and starts the server listening on the `PORT` designated in the config file.
|
* `index.js` is the entry point for the server. It creates the [express app](https://expressjs.com/), requires the routes, syncs the database, and starts the server listening on the `PORT` designated in the config file.
|
||||||
* the `server/routes` folder contains all of the routes for the express app
|
* the `server/routes` folder contains all of the routes for the express app
|
||||||
* the `server/models` folder contains all of the models which the app uses to interact with the `mysql` database. Note: this app uses the [sequelize](http://docs.sequelizejs.com/) ORM.
|
* the `server/models` folder contains all of the models which the app uses to interact with the `mysql` database. Note: this app uses the [sequelize](http://docs.sequelizejs.com/) ORM.
|
||||||
|
* the `client/` folder contains all of the client code
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
* This package uses `mocha` with `chai` for testing.
|
* This package uses `mocha` with `chai` for testing.
|
||||||
|
|
|
@ -166,7 +166,7 @@ inquirer
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('\nYou\'re all done!');
|
console.log('\nYou\'re all done!');
|
||||||
console.log('Next step: run "npm run start:dev" to start your server!');
|
console.log('Next step: run "npm run build" to build your server, then "npm run start" to start your server!');
|
||||||
console.log('If you want to change any settings, you can edit the files in the "/config" folder.');
|
console.log('If you want to change any settings, you can edit the files in the "/config" folder.');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,4 +4,4 @@ import { onHandleShowPageUri } from './show';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
onHandleShowPageUri,
|
onHandleShowPageUri,
|
||||||
}
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
updateChannelAvailability,
|
updateChannelAvailability,
|
||||||
updateChannelCreateName,
|
updateChannelCreateName,
|
||||||
updateChannelCreatePassword,
|
updateChannelCreatePassword,
|
||||||
createChannel
|
createChannel,
|
||||||
} from '../../actions/channelCreate';
|
} from '../../actions/channelCreate';
|
||||||
|
|
||||||
const mapStateToProps = ({channelCreate: { name, password, error, status }}) => {
|
const mapStateToProps = ({channelCreate: { name, password, error, status }}) => {
|
||||||
|
@ -13,7 +13,7 @@ const mapStateToProps = ({channelCreate: {name, password, error, status }}) => {
|
||||||
password,
|
password,
|
||||||
error,
|
error,
|
||||||
status,
|
status,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
|
|
|
@ -4,4 +4,4 @@ import { handleShowPageUri } from './show_uri';
|
||||||
export default {
|
export default {
|
||||||
rootSaga,
|
rootSaga,
|
||||||
handleShowPageUri,
|
handleShowPageUri,
|
||||||
}
|
};
|
||||||
|
|
24
package.json
24
package.json
|
@ -4,24 +4,26 @@
|
||||||
"description": "an npm package that exports a customizeable spee.ch server",
|
"description": "an npm package that exports a customizeable spee.ch server",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"bundle": "webpack --config webpack.config.js",
|
||||||
|
"bundle:dev": "webpack --config webpack.config.js --watch",
|
||||||
|
"configure": "node cli/configure.js",
|
||||||
|
"fix": "eslint . --fix",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"precommit": "eslint .",
|
||||||
|
"start": "npm run server",
|
||||||
|
"start:dev": "builder concurrent transpile:dev bundle:dev bundle:dev",
|
||||||
|
"server": "node server.js",
|
||||||
|
"server:dev": "nodemon server.js",
|
||||||
"test": "mocha --recursive",
|
"test": "mocha --recursive",
|
||||||
"test:no-lbc": "npm test -- --grep @usesLbc --invert",
|
"test:no-lbc": "npm test -- --grep @usesLbc --invert",
|
||||||
"lint": "eslint .",
|
"transpile": "builder concurrent transpile:server transpile:client transpile:client_custom",
|
||||||
"fix": "eslint . --fix",
|
"transpile:dev": "builder concurrent transpile:server:dev transpile:client:dev transpile:client_custom:dev",
|
||||||
"precommit": "eslint .",
|
|
||||||
"build": "builder concurrent transpile:server transpile:client transpile:client_custom webpack",
|
|
||||||
"build:dev": "builder concurrent transpile:server:dev transpile:client:dev transpile:client_custom:dev webpack:dev",
|
|
||||||
"start": "node server.js",
|
|
||||||
"start:dev": "builder concurrent build:dev server:dev",
|
|
||||||
"server:dev": "nodemon server.js",
|
|
||||||
"transpile:server": "babel server/render/src -d server/render/build",
|
"transpile:server": "babel server/render/src -d server/render/build",
|
||||||
"transpile:server:dev": "babel server/render/src -w -d server/render/build",
|
"transpile:server:dev": "babel server/render/src -w -d server/render/build",
|
||||||
"transpile:client": "babel client/src -d client/build",
|
"transpile:client": "babel client/src -d client/build",
|
||||||
"transpile:client:dev": "babel client/src -w -d client/build",
|
"transpile:client:dev": "babel client/src -w -d client/build",
|
||||||
"transpile:client_custom": "babel client_custom/src -d client_custom/build",
|
"transpile:client_custom": "babel client_custom/src -d client_custom/build",
|
||||||
"transpile:client_custom:dev": "babel client_custom/src -w -d client_custom/build",
|
"transpile:client_custom:dev": "babel client_custom/src -w -d client_custom/build"
|
||||||
"webpack": "webpack --config webpack.config.js",
|
|
||||||
"webpack:dev": "webpack --config webpack.config.js --watch"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -21,9 +21,9 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const SpeechServer = require('./server');
|
const Server = require('./server/index.js');
|
||||||
const server = new SpeechServer();
|
const speech = new Server();
|
||||||
server.start();
|
speech.start();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('server startup error:', error);
|
console.log('server startup error:', error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
|
@ -25,9 +25,9 @@ const channelAvailability = ({ ip, originalUrl, params: { name } }, res) => {
|
||||||
data : isAvailable,
|
data : isAvailable,
|
||||||
};
|
};
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
responseObject['message'] = `${name} is available`
|
responseObject['message'] = `${name} is available`;
|
||||||
} else {
|
} else {
|
||||||
responseObject['message'] = `${name} is already in use`
|
responseObject['message'] = `${name} is already in use`;
|
||||||
}
|
}
|
||||||
res.status(200).json(responseObject);
|
res.status(200).json(responseObject);
|
||||||
sendGATimingEvent('end-to-end', 'channel name availability', name, gaStartTime, Date.now());
|
sendGATimingEvent('end-to-end', 'channel name availability', name, gaStartTime, Date.now());
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
|
const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
|
||||||
const getChannelClaims = require('./getChannelClaims.js');
|
const getChannelClaims = require('./getChannelClaims.js');
|
||||||
const logger = require('winston');
|
|
||||||
|
|
||||||
const NO_CHANNEL = 'NO_CHANNEL';
|
const NO_CHANNEL = 'NO_CHANNEL';
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ const channelData = ({ ip, originalUrl, body, params }, res) => {
|
||||||
.then(data => {
|
.then(data => {
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|
|
@ -17,9 +17,9 @@ const claimAvailability = ({ ip, originalUrl, params: { name } }, res) => {
|
||||||
data : isAvailable,
|
data : isAvailable,
|
||||||
};
|
};
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
responseObject['message'] = `That claim name is available`
|
responseObject['message'] = `That claim name is available`;
|
||||||
} else {
|
} else {
|
||||||
responseObject['message'] = `That url is already in use`
|
responseObject['message'] = `That url is already in use`;
|
||||||
}
|
}
|
||||||
res.status(200).json(responseObject);
|
res.status(200).json(responseObject);
|
||||||
sendGATimingEvent('end-to-end', 'claim name availability', name, gaStartTime, Date.now());
|
sendGATimingEvent('end-to-end', 'claim name availability', name, gaStartTime, Date.now());
|
||||||
|
|
|
@ -16,12 +16,12 @@ const claimData = ({ ip, originalUrl, body, params }, res) => {
|
||||||
if (!claimInfo) {
|
if (!claimInfo) {
|
||||||
return res.status(404).json({
|
return res.status(404).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: 'No claim could be found'
|
message: 'No claim could be found',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
data: claimInfo
|
data : claimInfo,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|
|
@ -29,7 +29,7 @@ const claimGet = ({ ip, originalUrl, params }, res) => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const fileData = createFileRecordDataAfterGet(resolveResult, getResult);
|
const fileData = createFileRecordDataAfterGet(resolveResult, getResult);
|
||||||
const upsertCriteria = { name, claimId };
|
const upsertCriteria = { name, claimId };
|
||||||
return db.upsert(db.File, fileData, upsertCriteria, 'File')
|
return db.upsert(db.File, fileData, upsertCriteria, 'File');
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const { message, completed } = getResult;
|
const { message, completed } = getResult;
|
||||||
|
|
|
@ -35,7 +35,7 @@ const claimPublish = ({ body, files, headers, ip, originalUrl, user, tor }, res)
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return res.status(503).json({
|
return res.status(503).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: disabledMessage
|
message: disabledMessage,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// define variables
|
// define variables
|
||||||
|
@ -58,14 +58,15 @@ const claimPublish = ({ body, files, headers, ip, originalUrl, user, tor }, res)
|
||||||
checkClaimAvailability(name),
|
checkClaimAvailability(name),
|
||||||
createPublishParams(filePath, name, title, description, license, nsfw, thumbnail, channelName, channelClaimId),
|
createPublishParams(filePath, name, title, description, license, nsfw, thumbnail, channelName, channelClaimId),
|
||||||
createThumbnailPublishParams(thumbnailFilePath, name, license, nsfw),
|
createThumbnailPublishParams(thumbnailFilePath, name, license, nsfw),
|
||||||
])
|
]);
|
||||||
})
|
})
|
||||||
.then(([ claimAvailable, publishParams, thumbnailPublishParams ]) => {
|
.then(([ claimAvailable, publishParams, thumbnailPublishParams ]) => {
|
||||||
if (!claimAvailable) {
|
if (!claimAvailable) {
|
||||||
throw {
|
const error = {
|
||||||
name : CLAIM_TAKEN,
|
name : CLAIM_TAKEN,
|
||||||
message: 'That claim name is already taken'
|
message: 'That claim name is already taken',
|
||||||
};
|
};
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
// publish the thumbnail, if one exists
|
// publish the thumbnail, if one exists
|
||||||
if (thumbnailPublishParams) {
|
if (thumbnailPublishParams) {
|
||||||
|
@ -91,7 +92,7 @@ const claimPublish = ({ body, files, headers, ip, originalUrl, user, tor }, res)
|
||||||
sendGATimingEvent('end-to-end', 'publish', fileType, gaStartTime, Date.now());
|
sendGATimingEvent('end-to-end', 'publish', fileType, gaStartTime, Date.now());
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.name = CLAIM_TAKEN) {
|
if (error.name === CLAIM_TAKEN) {
|
||||||
res.status(400).json({
|
res.status(400).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: error.message,
|
message: error.message,
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { publishing: {
|
||||||
thumbnailChannelId,
|
thumbnailChannelId,
|
||||||
additionalClaimAddresses,
|
additionalClaimAddresses,
|
||||||
disabled,
|
disabled,
|
||||||
disabledMessage
|
disabledMessage,
|
||||||
} } = require('@config/siteConfig');
|
} } = require('@config/siteConfig');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -22,7 +22,7 @@ const publishingConfig = (req, res) => {
|
||||||
thumbnailChannelId,
|
thumbnailChannelId,
|
||||||
additionalClaimAddresses,
|
additionalClaimAddresses,
|
||||||
disabled,
|
disabled,
|
||||||
disabledMessage
|
disabledMessage,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ const getOEmbedDataForAsset = require('./getOEmbedDataForAsset');
|
||||||
const parseSpeechUrl = require('./parseSpeechUrl');
|
const parseSpeechUrl = require('./parseSpeechUrl');
|
||||||
|
|
||||||
const getOEmbedData = (req, res) => {
|
const getOEmbedData = (req, res) => {
|
||||||
|
|
||||||
const { query: { url, format } } = req;
|
const { query: { url, format } } = req;
|
||||||
logger.debug('req url', url);
|
logger.debug('req url', url);
|
||||||
logger.debug('req format', format);
|
logger.debug('req format', format);
|
||||||
|
@ -32,7 +31,7 @@ const getOEmbedData = (req, res) => {
|
||||||
return res.status(503).json({
|
return res.status(503).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: 'xml format is not implemented yet',
|
message: 'xml format is not implemented yet',
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
}
|
}
|
||||||
|
@ -42,8 +41,7 @@ const getOEmbedData = (req, res) => {
|
||||||
success: false,
|
success: false,
|
||||||
message: error,
|
message: error,
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
getOEmbedDataForAsset(channelName, channelClaimId, claimName, claimId)
|
getOEmbedDataForAsset(channelName, channelClaimId, claimName, claimId)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
@ -51,7 +49,7 @@ const getOEmbedData = (req, res) => {
|
||||||
return res.status(503).json({
|
return res.status(503).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: 'xml format is not implemented yet',
|
message: 'xml format is not implemented yet',
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +59,7 @@ const getOEmbedData = (req, res) => {
|
||||||
success: false,
|
success: false,
|
||||||
message: error,
|
message: error,
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ const getTorList = (req, res) => {
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
success: false,
|
success: false,
|
||||||
error,
|
error,
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,9 @@ const serveByClaim = (req, res) => {
|
||||||
getClaimIdAndServeAsset(null, null, claimName, null, originalUrl, ip, res);
|
getClaimIdAndServeAsset(null, null, claimName, null, originalUrl, ip, res);
|
||||||
|
|
||||||
sendGAServeEvent(headers, ip, originalUrl);
|
sendGAServeEvent(headers, ip, originalUrl);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return res.status(400).json({success: false, message: error.message});
|
return res.status(400).json({success: false, message: error.message});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = serveByClaim;
|
module.exports = serveByClaim;
|
||||||
|
|
|
@ -41,11 +41,9 @@ const serverByIdentifierAndClaim = (req, res) => {
|
||||||
getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res);
|
getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res);
|
||||||
|
|
||||||
sendGAServeEvent(headers, ip, originalUrl);
|
sendGAServeEvent(headers, ip, originalUrl);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return res.status(400).json({success: false, message: error.message});
|
return res.status(400).json({success: false, message: error.message});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = serverByIdentifierAndClaim;
|
module.exports = serverByIdentifierAndClaim;
|
||||||
|
|
|
@ -2,7 +2,7 @@ const logout = (req, res) => {
|
||||||
req.logout();
|
req.logout();
|
||||||
const responseObject = {
|
const responseObject = {
|
||||||
success: true,
|
success: true,
|
||||||
message: 'you successfully logged out'
|
message: 'you successfully logged out',
|
||||||
};
|
};
|
||||||
res.status(200).json(responseObject);
|
res.status(200).json(responseObject);
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,7 +86,7 @@ function Server () {
|
||||||
dataType : 'text',
|
dataType : 'text',
|
||||||
defaultLayout: 'embed',
|
defaultLayout: 'embed',
|
||||||
partialsDir : Path.join(viewsPath, '/partials'),
|
partialsDir : Path.join(viewsPath, '/partials'),
|
||||||
layoutsDir: Path.join(viewsPath, '/layouts')
|
layoutsDir : Path.join(viewsPath, '/layouts'),
|
||||||
}));
|
}));
|
||||||
app.set('views', viewsPath);
|
app.set('views', viewsPath);
|
||||||
app.set('view engine', 'handlebars');
|
app.set('view engine', 'handlebars');
|
||||||
|
@ -110,7 +110,7 @@ function Server () {
|
||||||
this.server.listen(PORT, () => {
|
this.server.listen(PORT, () => {
|
||||||
logger.info(`Server is listening on PORT ${PORT}`);
|
logger.info(`Server is listening on PORT ${PORT}`);
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
this.syncDatabase = () => {
|
this.syncDatabase = () => {
|
||||||
|
@ -118,7 +118,7 @@ function Server () {
|
||||||
return createDatabaseIfNotExists()
|
return createDatabaseIfNotExists()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
db.sequelize.sync();
|
db.sequelize.sync();
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
this.performChecks = () => {
|
this.performChecks = () => {
|
||||||
if (!performChecks) {
|
if (!performChecks) {
|
||||||
|
@ -130,7 +130,7 @@ function Server () {
|
||||||
])
|
])
|
||||||
.then(([walletBalance]) => {
|
.then(([walletBalance]) => {
|
||||||
logger.info('Starting LBC balance:', walletBalance);
|
logger.info('Starting LBC balance:', walletBalance);
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
this.performUpdates = () => {
|
this.performUpdates = () => {
|
||||||
if (!performUpdates) {
|
if (!performUpdates) {
|
||||||
|
@ -144,7 +144,7 @@ function Server () {
|
||||||
.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 = () => {
|
||||||
this.initialize();
|
this.initialize();
|
||||||
|
@ -158,14 +158,14 @@ function Server () {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
this.performChecks(),
|
this.performChecks(),
|
||||||
this.performUpdates(),
|
this.performUpdates(),
|
||||||
])
|
]);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info('Spee.ch startup is complete');
|
logger.info('Spee.ch startup is complete');
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.code === 'ECONNREFUSED') {
|
if (error.code === 'ECONNREFUSED') {
|
||||||
return logger.error('Connection refused. The daemon may not be running.')
|
return logger.error('Connection refused. The daemon may not be running.');
|
||||||
} else if (error.code === 'EADDRINUSE') {
|
} else if (error.code === 'EADDRINUSE') {
|
||||||
return logger.error('Server could not start listening. The port is already in use.');
|
return logger.error('Server could not start listening. The port is already in use.');
|
||||||
} else if (error.message) {
|
} else if (error.message) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ const sequelize = new Sequelize(database, username, password, {
|
||||||
host : 'localhost',
|
host : 'localhost',
|
||||||
dialect : 'mysql',
|
dialect : 'mysql',
|
||||||
dialectOptions: {
|
dialectOptions: {
|
||||||
decimalNumbers: true
|
decimalNumbers: true,
|
||||||
},
|
},
|
||||||
logging: false,
|
logging: false,
|
||||||
pool : {
|
pool : {
|
||||||
|
|
|
@ -21,7 +21,6 @@ const getTorList = require('../../controllers/api/tor');
|
||||||
const getBlockedList = require('../../controllers/api/blocked');
|
const getBlockedList = require('../../controllers/api/blocked');
|
||||||
const getOEmbedData = require('../../controllers/api/oEmbed');
|
const getOEmbedData = require('../../controllers/api/oEmbed');
|
||||||
|
|
||||||
|
|
||||||
module.exports = (app) => {
|
module.exports = (app) => {
|
||||||
// channel routes
|
// channel routes
|
||||||
app.get('/api/channel/availability/:name', torCheckMiddleware, channelAvailability);
|
app.get('/api/channel/availability/:name', torCheckMiddleware, channelAvailability);
|
||||||
|
@ -48,5 +47,5 @@ module.exports = (app) => {
|
||||||
// blocked
|
// blocked
|
||||||
app.get('/api/blocked', torCheckMiddleware, getBlockedList);
|
app.get('/api/blocked', torCheckMiddleware, getBlockedList);
|
||||||
// open embed
|
// open embed
|
||||||
app.get('/api/oembed', torCheckMiddleware, getOEmbedData)
|
app.get('/api/oembed', torCheckMiddleware, getOEmbedData);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue