mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	* chore(deps): update dependency eslint-config-airbnb-base to v13 * chore: #6599, linting 😬
		
			
				
	
	
		
			32 lines
		
	
	
		
			780 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			780 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| var plugins = require('../../plugins');
 | |
| 
 | |
| var hooksController = module.exports;
 | |
| 
 | |
| hooksController.get = function (req, res) {
 | |
| 	var hooks = [];
 | |
| 	Object.keys(plugins.loadedHooks).forEach(function (key, hookIndex) {
 | |
| 		var current = {
 | |
| 			hookName: key,
 | |
| 			methods: [],
 | |
| 			index: 'hook-' + hookIndex,
 | |
| 			count: plugins.loadedHooks[key].length,
 | |
| 		};
 | |
| 
 | |
| 		plugins.loadedHooks[key].forEach(function (hookData, methodIndex) {
 | |
| 			current.methods.push({
 | |
| 				id: hookData.id,
 | |
| 				priority: hookData.priority,
 | |
| 				method: hookData.method ? hookData.method.toString() : 'No plugin function!',
 | |
| 				index: hookIndex + '-code-' + methodIndex,
 | |
| 			});
 | |
| 		});
 | |
| 		hooks.push(current);
 | |
| 	});
 | |
| 
 | |
| 	hooks.sort((a, b) => b.count - a.count);
 | |
| 
 | |
| 	res.render('admin/advanced/hooks', { hooks: hooks });
 | |
| };
 |