mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
more read only mode fixes andadd support for handleMessageSecurity hook
This commit is contained in:
parent
fe7ab21c84
commit
3944a0e79b
2 changed files with 14 additions and 0 deletions
|
@ -190,6 +190,16 @@ exports.handleMessage = function(client, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
var handleMessageHook = function(callback){
|
var handleMessageHook = function(callback){
|
||||||
|
// Allow plugins to bypass the readonly message blocker
|
||||||
|
hooks.aCallAll("handleMessageSecurity", { client: client, message: message }, function ( err, messages ) {
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
_.each(messages, function(newMessage){
|
||||||
|
if ( newMessage === true ) {
|
||||||
|
thisSession.readonly = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var dropMessage = false;
|
var dropMessage = false;
|
||||||
// Call handleMessage hook. If a plugin returns null, the message will be dropped. Note that for all messages
|
// Call handleMessage hook. If a plugin returns null, the message will be dropped. Note that for all messages
|
||||||
// handleMessage will be called, even if the client is not authorized
|
// handleMessage will be called, even if the client is not authorized
|
||||||
|
@ -204,6 +214,7 @@ 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 () {
|
||||||
|
|
|
@ -325,6 +325,9 @@ function handshake()
|
||||||
if(clientVars.readonly){
|
if(clientVars.readonly){
|
||||||
$('#myusernameedit').attr("disabled", true);
|
$('#myusernameedit').attr("disabled", true);
|
||||||
$('#chatinput').attr("disabled", true);
|
$('#chatinput').attr("disabled", true);
|
||||||
|
$('#chaticon').hide();
|
||||||
|
$('#options-chatandusers').parent().hide();
|
||||||
|
$('#options-stickychat').parent().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("body").addClass(clientVars.readonly ? "readonly" : "readwrite")
|
$("body").addClass(clientVars.readonly ? "readonly" : "readwrite")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue