From 461af60c1657d83656b864faf2ca351e5f71ab8e Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 29 Jun 2017 12:35:36 -0700 Subject: [PATCH] commented out change address --- helpers/libraries/publishHelpers.js | 4 ++-- routes/home-routes.js | 5 +++-- routes/serve-routes.js | 14 ++++++++------ server.js | 2 ++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/helpers/libraries/publishHelpers.js b/helpers/libraries/publishHelpers.js index 1d943054..045f5ee6 100644 --- a/helpers/libraries/publishHelpers.js +++ b/helpers/libraries/publishHelpers.js @@ -8,7 +8,7 @@ module.exports = { // const payAddress = config.get('WalletConfig.LbryPayAddress'); const claimAddress = config.get('WalletConfig.LbryClaimAddress'); // const changeAddress = config.get('WalletConfig.LbryChangeAddress'); - // ensure nsfw is a boolean + // filter nsfw and ensure it is a boolean if (nsfw === false) { nsfw = false; } else if (nsfw.toLowerCase === 'false') { @@ -35,7 +35,7 @@ module.exports = { nsfw, }, claim_address: claimAddress, - //change_address: changeAddress, + // change_address: changeAddress, }; logger.debug('publishParams:', publishParams); return publishParams; diff --git a/routes/home-routes.js b/routes/home-routes.js index 1d747edf..d36d8f6c 100644 --- a/routes/home-routes.js +++ b/routes/home-routes.js @@ -3,8 +3,9 @@ const { postToAnalytics } = require('../helpers/libraries/analytics'); module.exports = app => { // route for the home page - app.get('/', ({ originalUrl, ip }, res) => { - logger.debug(`GET request on ${originalUrl} from ${ip}`); + app.get('/', ({ originalUrl, ip, headers }, res) => { + logger.verbose(`GET request on ${originalUrl} from ${ip}`); + logger.debug(`headers ${JSON.stringify(headers)}`); res.status(200).render('index'); }); // a catch-all route if someone visits a page that does not exist diff --git a/routes/serve-routes.js b/routes/serve-routes.js index d4ef52ab..16025638 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -34,9 +34,10 @@ function serveFile ({ fileName, fileType, filePath }, res) { module.exports = (app) => { // route to fetch one free public claim - app.get('/:name/:claim_id', ({ originalUrl, params, ips, headers }, res) => { - logger.debug(`GET request on ${originalUrl} from ${ips}`); - logger.debug(`headers ${headers}`); + app.get('/:name/:claim_id', ({ originalUrl, params, ip, ips, headers }, res) => { + logger.verbose(`GET request on ${originalUrl} from ${ip}`); + logger.debug(`ips >> ${JSON.stringify(ips)}`); + logger.debug(`headers >> ${JSON.stringify(headers)}`); // begin image-serve processes serveController .getClaimByClaimId(params.name, params.claim_id) @@ -49,9 +50,10 @@ module.exports = (app) => { }); }); // route to fetch one free public claim - app.get('/:name', ({ originalUrl, params, ips, headers }, res) => { - logger.debug(`GET request on ${originalUrl} from ${ips}`); - logger.debug(`headers ${headers}`); + app.get('/:name', ({ originalUrl, params, ip, ips, headers }, res) => { + logger.verbose(`GET request on ${originalUrl} from ${ip}`); + logger.debug(`ips >> ${JSON.stringify(ips)}`); + logger.debug(`headers >> ${JSON.stringify(headers)}`); // begin image-serve processes serveController .getClaimByName(params.name) diff --git a/server.js b/server.js index 23e3a442..6d7e9102 100644 --- a/server.js +++ b/server.js @@ -25,6 +25,7 @@ const db = require('./models'); app.use(express.static(`${__dirname}/public`)); // configure express app +app.enable('trust proxy'); // trust the proxy to get ip address for us app.use(bodyParser.json()); // for parsing application/json app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded app.use(siofu.router); @@ -68,6 +69,7 @@ const http = require('./routes/sockets-routes.js')(app, siofu, hostedContentPath // start server db.sequelize.sync().then(() => { http.listen(PORT, () => { + winston.info('Trusting proxy?', app.get('trust proxy')); winston.info(`Server is listening on PORT ${PORT}`); }); });