diff options
Diffstat (limited to 'src/node/hooks/express/adminplugins.js')
-rw-r--r-- | src/node/hooks/express/adminplugins.js | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/node/hooks/express/adminplugins.js b/src/node/hooks/express/adminplugins.js index a3fbc2af..d3884acb 100644 --- a/src/node/hooks/express/adminplugins.js +++ b/src/node/hooks/express/adminplugins.js @@ -7,28 +7,39 @@ exports.expressCreateServer = function (hook_name, args, cb) { var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins"); var render_args = { plugins: plugins.plugins, - query: req.query, search_results: {}, errors: [], }; - var render = function () { - res.send(eejs.require( - "ep_etherpad-lite/templates/admin/plugins.html", - render_args), {}); - }; + res.send(eejs.require( + "ep_etherpad-lite/templates/admin/plugins.html", + render_args), {}); + }); +} - if (req.query.search && req.query.search != "") { - installer.search(req.query.search, function (er, data) { +exports.socketio = function (hook_name, args, cb) { + var io = args.io.of("/pluginfw/installer"); + io.on('connection', function (socket) { + socket.on("search", function (query) { + socket.emit("progress", {progress:0, message:'Fetching results...'}); + installer.search(query, function (er, data) { if (er) { - render_args.errors.push(er); - return render(); + socket.emit("progress", {progress:1, error:er}); + } else { + socket.emit("search-result", {results: data}); + socket.emit("progress", {progress:1, message:'Done.'}); } - render_args.search_results = data; - render(); }); - } else { - render(); - } + }); + + socket.on("install", function (query) { + }); + + socket.on("uninstall", function (query) { + }); + + + + }); -}
\ No newline at end of file +} |