summaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
Diffstat (limited to 'src/node')
-rw-r--r--src/node/handler/ExportHandler.js15
-rw-r--r--src/node/handler/PadMessageHandler.js7
-rwxr-xr-xsrc/node/server.js15
3 files changed, 32 insertions, 5 deletions
diff --git a/src/node/handler/ExportHandler.js b/src/node/handler/ExportHandler.js
index 0a808977..5e7d6de4 100644
--- a/src/node/handler/ExportHandler.js
+++ b/src/node/handler/ExportHandler.js
@@ -105,7 +105,7 @@ exports.doExport = function(req, res, padId, type)
//if this is a html export, we can send this from here directly
if(type == "html")
{
- // do any final changes the plugin might want to make cake
+ // do any final changes the plugin might want to make
hooks.aCallFirst("exportHTMLSend", html, function(err, newHTML){
if(newHTML.length) html = newHTML;
res.send(html);
@@ -133,7 +133,18 @@ exports.doExport = function(req, res, padId, type)
function(callback)
{
destFile = tempDirectory + "/etherpad_export_" + randNum + "." + type;
- convertor.convertFile(srcFile, destFile, type, callback);
+
+ // Allow plugins to overwrite the convert in export process
+ hooks.aCallAll("exportConvert", {srcFile: srcFile, destFile: destFile}, function(err, result){
+ if(!err && result.length > 0){
+ // console.log("export handled by plugin", destFile);
+ handledByPlugin = true;
+ callback();
+ }else{
+ convertor.convertFile(srcFile, destFile, type, callback);
+ }
+ });
+
},
//send the file
function(callback)
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js
index 9481889f..bf8737fc 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -566,6 +566,13 @@ function handleUserInfoUpdate(client, message)
//Find out the author name of this session
var author = session.author;
+ // Check colorId is a Hex color
+ var isColor = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(message.data.userInfo.colorId) // for #f00 (Thanks Smamatti)
+ if(!isColor){
+ messageLogger.warn("Dropped message, USERINFO_UPDATE Color is malformed." + message.data);
+ return;
+ }
+
//Tell the authorManager about the new attributes
authorManager.setAuthorColorId(author, message.data.userInfo.colorId);
authorManager.setAuthorName(author, message.data.userInfo.name);
diff --git a/src/node/server.js b/src/node/server.js
index 2952da54..3cca9912 100755
--- a/src/node/server.js
+++ b/src/node/server.js
@@ -45,7 +45,7 @@ async.waterfall([
callback(er)
})
},
-
+
// load everything
function(callback) {
settings = require('./utils/Settings');
@@ -55,7 +55,7 @@ async.waterfall([
hooks.plugins = plugins;
callback();
},
-
+
//initalize the database
function (callback)
{
@@ -74,6 +74,15 @@ async.waterfall([
// Call loadSettings hook
hooks.aCallAll("loadSettings", { settings: settings });
+ // Call applySettings hook
+ hooks.aCallAll("applySettings", settings, function(err, newSettings){
+ if(!newSettings) return;
+ newSettings.forEach(function (settingsBlob){
+ for (var setting in settingsBlob){
+ settings[setting] = settingsBlob[setting];
+ };
+ });
+ });
callback();
},
@@ -81,6 +90,6 @@ async.waterfall([
function (callback)
{
hooks.callAll("createServer", {});
- callback(null);
+ callback(null);
}
]);