|
|
|
@ -269,17 +269,39 @@ adminController.postCache.get = function(req, res, next) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
adminController.plugins.get = function(req, res, next) {
|
|
|
|
|
plugins.getAll(function(err, plugins) {
|
|
|
|
|
if (err || !Array.isArray(plugins)) {
|
|
|
|
|
plugins = [];
|
|
|
|
|
async.parallel({
|
|
|
|
|
compatible: function(next) {
|
|
|
|
|
plugins.list(function(err, plugins) {
|
|
|
|
|
if (err || !Array.isArray(plugins)) {
|
|
|
|
|
plugins = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next(null, plugins);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
all: function(next) {
|
|
|
|
|
plugins.list(false, function(err, plugins) {
|
|
|
|
|
if (err || !Array.isArray(plugins)) {
|
|
|
|
|
plugins = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next(null, plugins);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, function(err, payload) {
|
|
|
|
|
var compatiblePkgNames = payload.compatible.map(function(pkgData) {
|
|
|
|
|
return pkgData.name;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
res.render('admin/extend/plugins' , {
|
|
|
|
|
installed: plugins.filter(function(plugin) {
|
|
|
|
|
installed: payload.compatible.filter(function(plugin) {
|
|
|
|
|
return plugin.installed;
|
|
|
|
|
}),
|
|
|
|
|
download: plugins.filter(function(plugin) {
|
|
|
|
|
download: payload.compatible.filter(function(plugin) {
|
|
|
|
|
return !plugin.installed;
|
|
|
|
|
}),
|
|
|
|
|
incompatible: payload.all.filter(function(plugin) {
|
|
|
|
|
return compatiblePkgNames.indexOf(plugin.name) === -1;
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|