mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	* Revert "Revert "feat: cross origin opener policy options (#10710)"" This reverts commit46050ace1a. * Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced"" This reverts commit9f291c07d3. * feat: closes #10719, don't trim children if category is marked section * feat: fire hook to allow plugins to filter the pids returned in a user profile /cc julianlam/nodebb-plugin-support-forum#14 * fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints * feat: Allow defining active plugins in config resolves #10766 * fix: assign the db result to files properly * test: add tests with plugins in config * feat: better theme change handling * feat: add visual indication that plugins can't be activated * test: correct hooks * test: fix test definitions * test: remove instead of resetting nconf to avoid affecting other tests * test: ... I forgot how nconf worked * fix: remove negation * docs: improve wording of error message * feat: reduce code duplication * style: remove a redundant space * fix: remove unused imports * fix: use nconf instead of requiring config.json * fix: await... * fix: second missed await * fix: move back from getActiveIds to getActive * fix: use paths again? * fix: typo * fix: move require into the function * fix: forgot to change back to getActive * test: getActive returns only id * test: accedently commented out some stuff * feat: added note to top of plugins page if \!canChangeState Co-authored-by: Julian Lam <julian@nodebb.org> Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
		
			
				
	
	
		
			83 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/*
 | 
						|
	NodeBB - A better forum platform for the modern web
 | 
						|
	https://github.com/NodeBB/NodeBB/
 | 
						|
	Copyright (C) 2013-2021  NodeBB Inc.
 | 
						|
 | 
						|
	This program is free software: you can redistribute it and/or modify
 | 
						|
	it under the terms of the GNU General Public License as published by
 | 
						|
	the Free Software Foundation, either version 3 of the License, or
 | 
						|
	(at your option) any later version.
 | 
						|
 | 
						|
	This program is distributed in the hope that it will be useful,
 | 
						|
	but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						|
	GNU General Public License for more details.
 | 
						|
 | 
						|
	You should have received a copy of the GNU General Public License
 | 
						|
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
						|
*/
 | 
						|
 | 
						|
'use strict';
 | 
						|
 | 
						|
require('./require-main');
 | 
						|
 | 
						|
const nconf = require('nconf');
 | 
						|
 | 
						|
nconf.argv().env({
 | 
						|
	separator: '__',
 | 
						|
});
 | 
						|
 | 
						|
const winston = require('winston');
 | 
						|
const path = require('path');
 | 
						|
 | 
						|
const file = require('./src/file');
 | 
						|
 | 
						|
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
 | 
						|
global.env = process.env.NODE_ENV || 'production';
 | 
						|
 | 
						|
// Alternate configuration file support
 | 
						|
const configFile = path.resolve(__dirname, nconf.any(['config', 'CONFIG']) || 'config.json');
 | 
						|
 | 
						|
const configExists = file.existsSync(configFile) || (nconf.get('url') && nconf.get('secret') && nconf.get('database'));
 | 
						|
 | 
						|
const prestart = require('./src/prestart');
 | 
						|
 | 
						|
prestart.loadConfig(configFile);
 | 
						|
prestart.setupWinston();
 | 
						|
prestart.versionCheck();
 | 
						|
winston.verbose('* using configuration stored in: %s', configFile);
 | 
						|
 | 
						|
if (!process.send) {
 | 
						|
	// If run using `node app`, log GNU copyright info along with server info
 | 
						|
	winston.info(`NodeBB v${nconf.get('version')} Copyright (C) 2013-${(new Date()).getFullYear()} NodeBB Inc.`);
 | 
						|
	winston.info('This program comes with ABSOLUTELY NO WARRANTY.');
 | 
						|
	winston.info('This is free software, and you are welcome to redistribute it under certain conditions.');
 | 
						|
	winston.info('');
 | 
						|
}
 | 
						|
 | 
						|
if (nconf.get('setup') || nconf.get('install')) {
 | 
						|
	require('./src/cli/setup').setup();
 | 
						|
} else if (!configExists) {
 | 
						|
	require('./install/web').install(nconf.get('port'));
 | 
						|
} else if (nconf.get('upgrade')) {
 | 
						|
	require('./src/cli/upgrade').upgrade(true);
 | 
						|
} else if (nconf.get('reset')) {
 | 
						|
	require('./src/cli/reset').reset({
 | 
						|
		theme: nconf.get('t'),
 | 
						|
		plugin: nconf.get('p'),
 | 
						|
		widgets: nconf.get('w'),
 | 
						|
		settings: nconf.get('s'),
 | 
						|
		all: nconf.get('a'),
 | 
						|
	});
 | 
						|
} else if (nconf.get('activate')) {
 | 
						|
	require('./src/cli/manage').activate(nconf.get('activate'));
 | 
						|
} else if (nconf.get('plugins') && typeof nconf.get('plugins') !== 'object') {
 | 
						|
	require('./src/cli/manage').listPlugins();
 | 
						|
} else if (nconf.get('build')) {
 | 
						|
	require('./src/cli/manage').build(nconf.get('build'));
 | 
						|
} else if (nconf.get('events')) {
 | 
						|
	require('./src/cli/manage').listEvents();
 | 
						|
} else {
 | 
						|
	require('./src/start').start();
 | 
						|
}
 |