diff options
author | John McLear <john@mclear.co.uk> | 2014-11-15 15:37:44 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2014-11-15 15:37:44 +0000 |
commit | 12914e68ffac7d949887035af36f9867525b79ec (patch) | |
tree | deab5acc5769d0984b95544df7cef008f8ae70d7 /src | |
parent | 8d2fa35b3f3d2a064395dff4a83a56237a3c4235 (diff) | |
parent | e5d77c3763d28baa26b07d9cc7a1bdc59384f7f0 (diff) | |
download | etherpad-lite-12914e68ffac7d949887035af36f9867525b79ec.zip |
Merge pull request #2294 from ether/go-away-npm
Use request and a remote ep plugin only endpoint
Diffstat (limited to 'src')
-rw-r--r-- | src/static/js/pluginfw/installer.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index 9f7ac939..bf779d7a 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,15 @@ 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; - cacheTimestamp = Math.round(+new Date/1000); - cb && cb(null, results) - }) + plugins = JSON.parse(plugins); + exports.availablePlugins = plugins; + cacheTimestamp = Math.round(+new Date/1000); + cb && cb(null, plugins) }); }; |