working handling of setting client ip and anonymizing etc
This commit is contained in:
parent
f418dfa205
commit
9fa77cdea2
|
@ -37,6 +37,7 @@ var _ = require('underscore');
|
|||
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js");
|
||||
var channels = require("channels");
|
||||
var stats = require('../stats');
|
||||
var remoteAddress = require("../utils/RemoteAddress").remoteAddress;
|
||||
|
||||
/**
|
||||
* A associative array that saves informations about a session
|
||||
|
@ -115,16 +116,18 @@ exports.handleDisconnect = function(client)
|
|||
//if this connection was already etablished with a handshake, send a disconnect message to the others
|
||||
if(session && session.author)
|
||||
{
|
||||
/*
|
||||
client.get('remoteAddress', function(er, ip) {
|
||||
|
||||
console.log(remoteAddress);
|
||||
|
||||
// Get the IP address from our persistant object
|
||||
var ip = remoteAddress[client.id];
|
||||
|
||||
// Anonymize the IP address if IP logging is disabled
|
||||
if(settings.disableIPlogging) {
|
||||
ip = 'ANONYMOUS';
|
||||
}
|
||||
|
||||
accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad')
|
||||
})
|
||||
*/
|
||||
|
||||
//get the author color out of the db
|
||||
authorManager.getAuthorColorId(session.author, function(err, color)
|
||||
|
|
|
@ -24,6 +24,7 @@ var log4js = require('log4js');
|
|||
var messageLogger = log4js.getLogger("message");
|
||||
var securityManager = require("../db/SecurityManager");
|
||||
var readOnlyManager = require("../db/ReadOnlyManager");
|
||||
var remoteAddress = require("../utils/RemoteAddress").remoteAddress;
|
||||
var settings = require('../utils/Settings');
|
||||
|
||||
/**
|
||||
|
@ -58,11 +59,13 @@ exports.setSocketIO = function(_socket) {
|
|||
{
|
||||
|
||||
// Broken: See http://stackoverflow.com/questions/4647348/send-message-to-specific-client-with-socket-io-and-node-js
|
||||
// Fixed by having a persistant object, ideally this would actually be in the database layer
|
||||
// TODO move to database layer
|
||||
if(settings.trustProxy && client.handshake.headers['x-forwarded-for'] !== undefined){
|
||||
// client.set('remoteAddress', client.handshake.headers['x-forwarded-for']);
|
||||
remoteAddress[client.id] = client.handshake.headers['x-forwarded-for'];
|
||||
}
|
||||
else{
|
||||
// client.set('remoteAddress', client.handshake.address);
|
||||
remoteAddress[client.id] = client.handshake.address;
|
||||
}
|
||||
var clientAuthorized = false;
|
||||
|
||||
|
|
|
@ -51,8 +51,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
// This debug logging environment is set in Settings.js
|
||||
|
||||
//minify socket.io javascript
|
||||
if(settings.minify)
|
||||
// io.enable('browser client minification');
|
||||
// Due to a shitty decision by the SocketIO team minification is
|
||||
// no longer available, details available at:
|
||||
// http://stackoverflow.com/questions/23981741/minify-socket-io-socket-io-js-with-1-0
|
||||
// if(settings.minify) io.enable('browser client minification');
|
||||
|
||||
//Initalize the Socket.IO Router
|
||||
socketIORouter.setSocketIO(io);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
exports.remoteAddress = {};
|
Loading…
Reference in New Issue