mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 20:45:58 +01:00
spaces vs tabs ugh
This commit is contained in:
@@ -16,21 +16,21 @@ var async = require('async'),
|
|||||||
SocketPosts = {},
|
SocketPosts = {},
|
||||||
|
|
||||||
// a shy request-wannabe build from a socket for spam detection purposes
|
// a shy request-wannabe build from a socket for spam detection purposes
|
||||||
reqFromSocket = function(socket) {
|
reqFromSocket = function(socket) {
|
||||||
var headers = socket.handshake.headers,
|
var headers = socket.handshake.headers,
|
||||||
host = headers['host'],
|
host = headers['host'],
|
||||||
referer = headers['referer'];
|
referer = headers['referer'];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'ip': headers['x-forwarded-for'] || socket.handshake.address.address,
|
'ip': headers['x-forwarded-for'] || socket.handshake.address.address,
|
||||||
'host': host,
|
'host': host,
|
||||||
'protocol': headers['secure'] ? 'https' : 'http',
|
'protocol': headers['secure'] ? 'https' : 'http',
|
||||||
'secure': !!headers['secure'],
|
'secure': !!headers['secure'],
|
||||||
'url': referer,
|
'url': referer,
|
||||||
'path': referer.substr(referer.indexOf(host) + host.length),
|
'path': referer.substr(referer.indexOf(host) + host.length),
|
||||||
'headers': headers
|
'headers': headers
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketPosts.reply = function(socket, data, callback) {
|
SocketPosts.reply = function(socket, data, callback) {
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ SocketPosts.reply = function(socket, data, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.uid = socket.uid;
|
data.uid = socket.uid;
|
||||||
data.req = reqFromSocket(socket);
|
data.req = reqFromSocket(socket);
|
||||||
|
|
||||||
topics.reply(data, function(err, postData) {
|
topics.reply(data, function(err, postData) {
|
||||||
if(err) {
|
if(err) {
|
||||||
|
|||||||
@@ -141,16 +141,16 @@ module.exports = function(Topics) {
|
|||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
plugins.fireHook('filter:topic.reply', data, function(err, filteredData) {
|
plugins.fireHook('filter:topic.reply', data, function(err, filteredData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
content = filteredData.content || data.content;
|
content = filteredData.content || data.content;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
threadTools.exists(tid, next);
|
threadTools.exists(tid, next);
|
||||||
},
|
},
|
||||||
function(topicExists, next) {
|
function(topicExists, next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user