added torCheck to middleware
This commit is contained in:
parent
536dfc9ccd
commit
67601ea97f
3 changed files with 12 additions and 2 deletions
9
server/middleware/torCheckMiddleware.js
Normal file
9
server/middleware/torCheckMiddleware.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
const logger = require('winston');
|
||||||
|
|
||||||
|
const torCheck = (req, res, next) => { // custom logging middleware to log all incoming http requests
|
||||||
|
const { ip } = req;
|
||||||
|
logger.debug(`tor check for ${ip}`);
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = torCheck;
|
|
@ -15,7 +15,8 @@ const fileAvailability = require('../../controllers/api/file/availability');
|
||||||
const userPassword = require('../../controllers/api/user/password');
|
const userPassword = require('../../controllers/api/user/password');
|
||||||
const publishingConfig = require('../../controllers/api/config/site/publishing');
|
const publishingConfig = require('../../controllers/api/config/site/publishing');
|
||||||
|
|
||||||
const multipartMiddleware = require('../utils/multipartMiddleware');
|
const multipartMiddleware = require('../../middleware/multipartMiddleware');
|
||||||
|
const torCheckMiddleware = require('../../middleware/torCheckMiddleware');
|
||||||
|
|
||||||
module.exports = (app) => {
|
module.exports = (app) => {
|
||||||
// channel routes
|
// channel routes
|
||||||
|
@ -30,7 +31,7 @@ module.exports = (app) => {
|
||||||
app.get('/api/claim/get/:name/:claimId', claimGet);
|
app.get('/api/claim/get/:name/:claimId', claimGet);
|
||||||
app.get('/api/claim/list/:name', claimList);
|
app.get('/api/claim/list/:name', claimList);
|
||||||
app.post('/api/claim/long-id', claimLongId); // should be a get
|
app.post('/api/claim/long-id', claimLongId); // should be a get
|
||||||
app.post('/api/claim/publish', multipartMiddleware, claimPublish);
|
app.post('/api/claim/publish', torCheckMiddleware, multipartMiddleware, claimPublish);
|
||||||
app.get('/api/claim/resolve/:name/:claimId', claimResolve);
|
app.get('/api/claim/resolve/:name/:claimId', claimResolve);
|
||||||
app.get('/api/claim/short-id/:longId/:name', claimShortId);
|
app.get('/api/claim/short-id/:longId/:name', claimShortId);
|
||||||
// file routes
|
// file routes
|
||||||
|
|
Loading…
Reference in a new issue