summaryrefslogtreecommitdiff
path: root/src/node/hooks
diff options
context:
space:
mode:
authorMatthias Bartelmeß <mba@fourplusone.de>2012-04-04 15:10:27 +0200
committerMatthias Bartelmeß <mba@fourplusone.de>2012-04-04 15:10:27 +0200
commitf34e13f761646bf75d7f41a4d8958bb6033a48a8 (patch)
treef2fc4170d2a9164819c0e747586019a9825007d3 /src/node/hooks
parent4acbb11fd57f8306e5c9e87bfff189f80be43d81 (diff)
downloadetherpad-lite-f34e13f761646bf75d7f41a4d8958bb6033a48a8.zip
on plugin definitions, only expose plugins with client_hooks registered. dont expose 'package' property
Diffstat (limited to 'src/node/hooks')
-rw-r--r--src/node/hooks/express/static.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/node/hooks/express/static.js b/src/node/hooks/express/static.js
index 9209967c..f284e478 100644
--- a/src/node/hooks/express/static.js
+++ b/src/node/hooks/express/static.js
@@ -6,6 +6,7 @@ var settings = require("../../utils/Settings");
var Yajsml = require('yajsml');
var fs = require("fs");
var ERR = require("async-stacktrace");
+var _ = require("underscore");
exports.expressCreateServer = function (hook_name, args, cb) {
// Cache both minified and static.
@@ -35,8 +36,22 @@ exports.expressCreateServer = function (hook_name, args, cb) {
// serve plugin definitions
// not very static, but served here so that client can do require("pluginfw/static/js/plugin-definitions.js");
args.app.get('/pluginfw/plugin-definitions.json', function (req, res, next) {
+
+ var clientParts = _(plugins.parts)
+ .filter(function(part){ return _(part).has('client_hooks') });
+
+ var clientPlugins = {};
+
+ _(clientParts).chain()
+ .map(function(part){ return part.plugin })
+ .uniq()
+ .each(function(name){
+ clientPlugins[name] = _(plugins.plugins[name]).clone();
+ delete clientPlugins[name]['package'];
+ });
+
res.header("Content-Type","application/json; charset=utf-8");
- res.write(JSON.stringify({"plugins": plugins.plugins, "parts": plugins.parts}));
+ res.write(JSON.stringify({"plugins": clientPlugins, "parts": clientParts}));
res.end();
});
}