This commit is contained in:
Manuel Knitza 2013-03-23 17:36:55 -07:00
commit 13109789ed
4 changed files with 30 additions and 30 deletions

View file

@ -117,7 +117,7 @@ exports.doExport = function(req, res, padId, type)
], function(err) ], function(err)
{ {
if(err && err != "stop") ERR(err); if(err && err != "stop") ERR(err);
}) });
} }
else if(type == 'dokuwiki') else if(type == 'dokuwiki')
{ {
@ -214,6 +214,6 @@ exports.doExport = function(req, res, padId, type)
], function(err) ], function(err)
{ {
if(err && err != "stop") ERR(err); if(err && err != "stop") ERR(err);
}) });
} }
}; };

View file

@ -178,5 +178,5 @@ exports.doImport = function(req, res, padId)
//close the connection //close the connection
res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script></head><script>$(window).load(function(){if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.padimpexp.handleFrameCall('" + status + "');})</script>", 200); res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script></head><script>$(window).load(function(){if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.padimpexp.handleFrameCall('" + status + "');})</script>", 200);
}); });
} };

View file

@ -60,7 +60,7 @@ var socketio;
exports.setSocketIO = function(socket_io) exports.setSocketIO = function(socket_io)
{ {
socketio=socket_io; socketio=socket_io;
} };
/** /**
* Handles the connection of a new user * Handles the connection of a new user
@ -70,7 +70,7 @@ exports.handleConnect = function(client)
{ {
//Initalize sessioninfos for this new session //Initalize sessioninfos for this new session
sessioninfos[client.id]={}; sessioninfos[client.id]={};
} };
/** /**
* Kicks all sessions from a pad * Kicks all sessions from a pad
@ -84,7 +84,7 @@ exports.kickSessionsFromPad = function(padID)
//disconnect everyone from this pad //disconnect everyone from this pad
socketio.sockets.in(padID).json.send({disconnect:"deleted"}); socketio.sockets.in(padID).json.send({disconnect:"deleted"});
} };
/** /**
* Handles the disconnection of a user * Handles the disconnection of a user
@ -123,12 +123,12 @@ exports.handleDisconnect = function(client)
} }
client.get('remoteAddress', function(er, ip) { client.get('remoteAddress', function(er, ip) {
accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad') accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad');
}) })
//Delete the sessioninfos entrys of this session //Delete the sessioninfos entrys of this session
delete sessioninfos[client.id]; delete sessioninfos[client.id];
} };
/** /**
* Handles a message from a user * Handles a message from a user
@ -164,9 +164,9 @@ exports.handleMessage = function(client, message)
}); });
// If no plugins explicitly told us to drop the message, its ok to proceed // If no plugins explicitly told us to drop the message, its ok to proceed
if(!dropMessage){ callback() }; if(!dropMessage){ callback(); }
}); });
} };
var finalHandler = function () { var finalHandler = function () {
//Check what type of message we get and delegate to the other methodes //Check what type of message we get and delegate to the other methodes
@ -227,14 +227,14 @@ exports.handleMessage = function(client, message)
//no access, send the client a message that tell him why //no access, send the client a message that tell him why
else else
{ {
client.json.send({accessStatus: statusObject.accessStatus}) client.json.send({accessStatus: statusObject.accessStatus});
} }
}); });
}, },
finalHandler finalHandler
]); ]);
} }
} };
/** /**
@ -272,7 +272,7 @@ exports.handleCustomMessage = function (padID, msg, cb) {
socketio.sockets.in(padID).json.send(msg); socketio.sockets.in(padID).json.send(msg);
cb(null, {}); cb(null, {});
} };
/** /**
* Handles a Chat Message * Handles a Chat Message
@ -553,16 +553,16 @@ function handleUserChanges(client, message)
// Validate all added 'author' attribs to be the same value as the current user // Validate all added 'author' attribs to be the same value as the current user
var iterator = Changeset.opIterator(Changeset.unpack(changeset).ops) var iterator = Changeset.opIterator(Changeset.unpack(changeset).ops)
, op , op;
while(iterator.hasNext()) { while(iterator.hasNext()) {
op = iterator.next() op = iterator.next();
if(op.opcode != '+') continue; if(op.opcode != '+') continue;
op.attribs.split('*').forEach(function(attr) { op.attribs.split('*').forEach(function(attr) {
if(!attr) return if(!attr) return;
attr = wireApool.getAttrib(attr) attr = wireApool.getAttrib(attr);
if(!attr) return if(!attr) return;
if('author' == attr[0] && attr[1] != thisSession.author) throw "Trying to submit changes as another author" if('author' == attr[0] && attr[1] != thisSession.author) throw "Trying to submit changes as another author";
}) });
} }
} }
catch(e) catch(e)
@ -677,7 +677,7 @@ exports.updatePadClients = function(pad, callback)
//https://github.com/caolan/async#whilst //https://github.com/caolan/async#whilst
//send them all new changesets //send them all new changesets
async.whilst( async.whilst(
function (){ return sessioninfos[sid] && sessioninfos[sid].rev < pad.getHeadRevisionNumber()}, function (){ return sessioninfos[sid] && sessioninfos[sid].rev < pad.getHeadRevisionNumber();},
function(callback) function(callback)
{ {
var r = sessioninfos[sid].rev + 1; var r = sessioninfos[sid].rev + 1;
@ -731,7 +731,7 @@ exports.updatePadClients = function(pad, callback)
callback callback
); );
},callback); },callback);
} };
/** /**
* Copied from the Etherpad Source Code. Don't know what this methode does excatly... * Copied from the Etherpad Source Code. Don't know what this methode does excatly...
@ -848,7 +848,7 @@ function handleClientReady(client, message)
//no access, send the client a message that tell him why //no access, send the client a message that tell him why
else else
{ {
client.json.send({accessStatus: statusObject.accessStatus}) client.json.send({accessStatus: statusObject.accessStatus});
} }
}); });
}, },
@ -944,7 +944,7 @@ function handleClientReady(client, message)
else if(pad.head == 0) { else if(pad.head == 0) {
accessLogger.info('[CREATE] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" created the pad'); accessLogger.info('[CREATE] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" created the pad');
} }
}) });
//If this is a reconnect, we don't have to send the client the ClientVars again //If this is a reconnect, we don't have to send the client the ClientVars again
if(message.reconnect == true) if(message.reconnect == true)
@ -1007,7 +1007,7 @@ function handleClientReady(client, message)
"parts": plugins.parts, "parts": plugins.parts,
}, },
"initialChangesets": [] // FIXME: REMOVE THIS SHIT "initialChangesets": [] // FIXME: REMOVE THIS SHIT
} };
//Add a username to the clientVars if one avaiable //Add a username to the clientVars if one avaiable
if(authorName != null) if(authorName != null)
@ -1454,7 +1454,7 @@ exports.padUsersCount = function (padID, callback) {
callback(null, { callback(null, {
padUsersCount: socketio.sockets.clients(padID).length padUsersCount: socketio.sockets.clients(padID).length
}); });
} };
/** /**
* Get the list of users in a pad * Get the list of users in a pad
@ -1477,4 +1477,4 @@ exports.padUsers = function (padID, callback) {
callback(null, {padUsers: result}); callback(null, {padUsers: result});
}); });
} };

View file

@ -43,7 +43,7 @@ exports.addComponent = function(moduleName, module)
//give the module the socket //give the module the socket
module.setSocketIO(socket); module.setSocketIO(socket);
} };
/** /**
* sets the socket.io and adds event functions for routing * sets the socket.io and adds event functions for routing
@ -64,7 +64,7 @@ exports.setSocketIO = function(_socket)
{ {
messageLogger.debug("to " + client.id + ": " + stringifyWithoutPassword(message)); messageLogger.debug("to " + client.id + ": " + stringifyWithoutPassword(message));
client._send(message); client._send(message);
} };
//tell all components about this connect //tell all components about this connect
for(var i in components) for(var i in components)
@ -144,7 +144,7 @@ exports.setSocketIO = function(_socket)
} }
}); });
}); });
} };
//returns a stringified representation of a message, removes the password //returns a stringified representation of a message, removes the password
//this ensures there are no passwords in the log //this ensures there are no passwords in the log