Merge pull request #644 from lbryio/tempban

Fix ban config file path
This commit is contained in:
Shawn K 2018-10-20 03:47:25 -05:00 committed by GitHub
commit 3bcb37433a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,7 @@ const getBlockedList = require('../../controllers/api/blocked');
const getOEmbedData = require('../../controllers/api/oEmbed'); const getOEmbedData = require('../../controllers/api/oEmbed');
const logger = require('winston'); const logger = require('winston');
const ipBanFile = '../../../config/ipBan.txt'; const ipBanFile = './config/ipBan.txt';
const forbiddenMessage = '<h1>Forbidden</h1>If you are seeing this by mistake, please contact us using <a href="https://chat.lbry.io/">https://chat.lbry.io/</a>'; const forbiddenMessage = '<h1>Forbidden</h1>If you are seeing this by mistake, please contact us using <a href="https://chat.lbry.io/">https://chat.lbry.io/</a>';
let ipCounts = {}; let ipCounts = {};
@ -46,7 +46,6 @@ const autoblockPublishMiddleware = (req, res, next) => {
let ip = (req.headers['x-forwarded-for'] || req.connection.remoteAddress).split(/,\s?/)[0]; let ip = (req.headers['x-forwarded-for'] || req.connection.remoteAddress).split(/,\s?/)[0];
if(blockedAddresses.indexOf(ip) !== -1) { if(blockedAddresses.indexOf(ip) !== -1) {
logger.warn(`Banned IP publish attempt: ${ip}`);
res.status(403).send(forbiddenMessage); res.status(403).send(forbiddenMessage);
res.end(); res.end();