mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
added username mentions plugin to default, and tweaked admin panel to show
plugins installed via npm
This commit is contained in:
@@ -34,7 +34,8 @@
|
|||||||
"cheerio": "~0.12.0",
|
"cheerio": "~0.12.0",
|
||||||
"request": "~2.25.0",
|
"request": "~2.25.0",
|
||||||
"reds": "~0.2.4",
|
"reds": "~0.2.4",
|
||||||
"winston": "~0.7.2"
|
"winston": "~0.7.2",
|
||||||
|
"nodebb-plugin-mentions": "~0.1.0"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/designcreateplay/NodeBB/issues"
|
"url": "https://github.com/designcreateplay/NodeBB/issues"
|
||||||
|
|||||||
@@ -156,26 +156,49 @@ var fs = require('fs'),
|
|||||||
showInstalled: function(callback) {
|
showInstalled: function(callback) {
|
||||||
// TODO: Also check /node_modules
|
// TODO: Also check /node_modules
|
||||||
var _self = this;
|
var _self = this;
|
||||||
moduleBasePath = path.join(__dirname, '../plugins');
|
localPluginPath = path.join(__dirname, '../plugins'),
|
||||||
|
npmPluginPath = path.join(__dirname, '../node_modules');
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
fs.readdir(moduleBasePath, next);
|
async.parallel([
|
||||||
|
function(next) {
|
||||||
|
fs.readdir(localPluginPath, next);
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
fs.readdir(npmPluginPath, next);
|
||||||
|
}
|
||||||
|
], function(err, dirs) {
|
||||||
|
if (err) return next(err);
|
||||||
|
|
||||||
|
dirs[0] = dirs[0].map(function(file) {
|
||||||
|
return path.join(localPluginPath, file);
|
||||||
|
}).filter(function(file) {
|
||||||
|
var stats = fs.statSync(file);
|
||||||
|
if (stats.isDirectory()) return true;
|
||||||
|
else return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
dirs[1] = dirs[1].map(function(file) {
|
||||||
|
return path.join(npmPluginPath, file);
|
||||||
|
}).filter(function(file) {
|
||||||
|
var stats = fs.statSync(file);
|
||||||
|
if (stats.isDirectory() && file.substr(npmPluginPath.length+1, 14) === 'nodebb-plugin-') return true;
|
||||||
|
else return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
next(err, dirs[0].concat(dirs[1]));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function(files, next) {
|
function(files, next) {
|
||||||
var plugins = [];
|
var plugins = [];
|
||||||
|
|
||||||
async.each(files, function(file, next) {
|
async.each(files, function(file, next) {
|
||||||
var modulePath = path.join(moduleBasePath, file),
|
var configPath;
|
||||||
configPath;
|
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
fs.stat(path.join(moduleBasePath, file), next);
|
fs.readFile(path.join(file, 'plugin.json'), next);
|
||||||
},
|
|
||||||
function(stats, next) {
|
|
||||||
if (stats.isDirectory()) fs.readFile(path.join(modulePath, 'plugin.json'), next);
|
|
||||||
else next(new Error('not-a-directory'));
|
|
||||||
},
|
},
|
||||||
function(configJSON, next) {
|
function(configJSON, next) {
|
||||||
var config = JSON.parse(configJSON);
|
var config = JSON.parse(configJSON);
|
||||||
|
|||||||
Reference in New Issue
Block a user