mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
moving pluginRoutes to top of route stack (like others), put app.load hook behind plugins' ready callback
This commit is contained in:
@@ -80,7 +80,7 @@ function compileTemplates(pluginTemplates) {
|
||||
winston.info('[themes] Compiling templates');
|
||||
rimraf.sync(nconf.get('views_dir'));
|
||||
mkdirp.sync(nconf.get('views_dir'));
|
||||
|
||||
|
||||
utils.walk(nconf.get('base_templates_path'), function(err, baseTpls) {
|
||||
utils.walk(nconf.get('theme_templates_path'), function (err, themeTpls) {
|
||||
var paths = pluginTemplates;
|
||||
@@ -123,7 +123,7 @@ function compileTemplates(pluginTemplates) {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handleErrors(err, req, res, next) {
|
||||
|
||||
@@ -305,11 +305,11 @@ var fs = require('fs'),
|
||||
if (callback) {
|
||||
args.pop();
|
||||
}
|
||||
|
||||
|
||||
hookList = Plugins.loadedHooks[hook];
|
||||
|
||||
if (hookList && Array.isArray(hookList)) {
|
||||
//if (global.env === 'development') winston.info('[plugins] Firing hook: \'' + hook + '\'');
|
||||
// if (global.env === 'development') winston.info('[plugins] Firing hook: \'' + hook + '\'');
|
||||
var hookType = hook.split(':')[0];
|
||||
switch (hookType) {
|
||||
case 'filter':
|
||||
|
||||
@@ -18,7 +18,8 @@ module.exports = function(app, middleware) {
|
||||
metaRoutes(app, middleware, controllers);
|
||||
apiRoutes(app, middleware, controllers);
|
||||
feedRoutes(app, middleware, controllers);
|
||||
|
||||
pluginRoutes(app, middleware, controllers);
|
||||
|
||||
/**
|
||||
* Every view has an associated API route.
|
||||
*
|
||||
@@ -119,10 +120,11 @@ module.exports = function(app, middleware) {
|
||||
app.get('/api/users/latest', middleware.checkGlobalPrivacySettings, controllers.users.getUsersSortedByJoinDate);
|
||||
|
||||
app.get('/users/search', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.users.getUsersForSearch);
|
||||
app.get('/api/users/search', middleware.checkGlobalPrivacySettings, controllers.users.getUsersForSearch);
|
||||
app.get('/api/users/search', middleware.checkGlobalPrivacySettings, controllers.users.getUsersForSearch);
|
||||
|
||||
pluginRoutes(app, middleware, controllers);
|
||||
plugins.fireHook('action:app.load', app, middleware, controllers);
|
||||
plugins.ready(function() {
|
||||
plugins.fireHook('action:app.load', app, middleware, controllers);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
require('./debug')(app, middleware, controllers);
|
||||
|
||||
Reference in New Issue
Block a user