From c7061e47db8aa7828461fc3344e69a6b4dc6d319 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 4 Nov 2014 17:06:47 +0000 Subject: [PATCH 1/3] use request and a remote ep plugin only endpoint --- src/static/js/pluginfw/installer.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index 9f7ac939f..7480e152d 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -1,6 +1,7 @@ var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins"); var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks"); var npm = require("npm"); +var request = require("request"); var npmIsLoaded = false; var withNpm = function (npmfn) { @@ -60,17 +61,16 @@ exports.availablePlugins = null; var cacheTimestamp = 0; exports.getAvailablePlugins = function(maxCacheAge, cb) { - withNpm(function (er) { + request("http://etherpad.org/plugins.json", function(er, response, plugins){ if (er) return cb && cb(er); if(exports.availablePlugins && maxCacheAge && Math.round(+new Date/1000)-cacheTimestamp <= maxCacheAge) { return cb && cb(null, exports.availablePlugins) } - npm.commands.search(['ep_'], /*silent?*/true, function(er, results) { - if(er) return cb && cb(er); - exports.availablePlugins = results; + console.log("plugins", plugins); + plugins = JSON.parse(plugins); + exports.availablePlugins = plugins; cacheTimestamp = Math.round(+new Date/1000); - cb && cb(null, results) - }) + cb && cb(null, plugins) }); }; From fc5152c2f3199ec6056fc97a04eda3afd733eae0 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 6 Nov 2014 17:38:38 +0000 Subject: [PATCH 2/3] remove logging --- src/static/js/pluginfw/installer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index 7480e152d..c1a9adad2 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -66,7 +66,6 @@ exports.getAvailablePlugins = function(maxCacheAge, cb) { if(exports.availablePlugins && maxCacheAge && Math.round(+new Date/1000)-cacheTimestamp <= maxCacheAge) { return cb && cb(null, exports.availablePlugins) } - console.log("plugins", plugins); plugins = JSON.parse(plugins); exports.availablePlugins = plugins; cacheTimestamp = Math.round(+new Date/1000); From e5d77c3763d28baa26b07d9cc7a1bdc59384f7f0 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 12 Nov 2014 21:39:03 +0000 Subject: [PATCH 3/3] indentation --- src/static/js/pluginfw/installer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index c1a9adad2..bf779d7ac 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -67,9 +67,9 @@ exports.getAvailablePlugins = function(maxCacheAge, cb) { return cb && cb(null, exports.availablePlugins) } plugins = JSON.parse(plugins); - exports.availablePlugins = plugins; - cacheTimestamp = Math.round(+new Date/1000); - cb && cb(null, plugins) + exports.availablePlugins = plugins; + cacheTimestamp = Math.round(+new Date/1000); + cb && cb(null, plugins) }); };