mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	
							
								
								
									
										1
									
								
								.husky/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.husky/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | _ | ||||||
							
								
								
									
										4
									
								
								.husky/commit-msg
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										4
									
								
								.husky/commit-msg
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | . "$(dirname "$0")/_/husky.sh" | ||||||
|  |  | ||||||
|  | npx --no-install commitlint --edit $1 | ||||||
							
								
								
									
										4
									
								
								.husky/pre-commit
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										4
									
								
								.husky/pre-commit
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | . "$(dirname "$0")/_/husky.sh" | ||||||
|  |  | ||||||
|  | npx --no-install lint-staged | ||||||
| @@ -11,8 +11,8 @@ | |||||||
|     "main": "app.js", |     "main": "app.js", | ||||||
|     "scripts": { |     "scripts": { | ||||||
|         "start": "node loader.js", |         "start": "node loader.js", | ||||||
|         "lint": "npx eslint --cache ./nodebb .", |         "lint": "eslint --cache ./nodebb .", | ||||||
|         "test": "npx nyc --reporter=html --reporter=text-summary npx mocha", |         "test": "nyc --reporter=html --reporter=text-summary mocha", | ||||||
|         "coverage": "nyc report --reporter=text-lcov > ./coverage/lcov.info", |         "coverage": "nyc report --reporter=text-lcov > ./coverage/lcov.info", | ||||||
|         "coveralls": "nyc report --reporter=text-lcov | coveralls && rm -r coverage" |         "coveralls": "nyc report --reporter=text-lcov | coveralls && rm -r coverage" | ||||||
|     }, |     }, | ||||||
| @@ -22,22 +22,15 @@ | |||||||
|             "test/*" |             "test/*" | ||||||
|         ] |         ] | ||||||
|     }, |     }, | ||||||
|     "husky": { |  | ||||||
|         "hooks": { |  | ||||||
|             "pre-commit": "npx lint-staged", |  | ||||||
|             "commit-msg": "npx commitlint -E HUSKY_GIT_PARAMS" |  | ||||||
|         } |  | ||||||
|     }, |  | ||||||
|     "lint-staged": { |     "lint-staged": { | ||||||
|         "*.js": [ |         "*.js": [ | ||||||
|             "eslint --fix", |             "eslint --fix" | ||||||
|             "git add" |  | ||||||
|         ] |         ] | ||||||
|     }, |     }, | ||||||
|     "dependencies": { |     "dependencies": { | ||||||
|         "@adactive/bootstrap-tagsinput": "^0.8.2", |         "@adactive/bootstrap-tagsinput": "^0.8.2", | ||||||
|         "ace-builds": "^1.4.9", |         "ace-builds": "^1.4.12", | ||||||
|         "archiver": "^5.0.0", |         "archiver": "^5.2.0", | ||||||
|         "async": "^3.2.0", |         "async": "^3.2.0", | ||||||
|         "autoprefixer": "10.2.4", |         "autoprefixer": "10.2.4", | ||||||
|         "bcryptjs": "2.4.3", |         "bcryptjs": "2.4.3", | ||||||
| @@ -45,31 +38,31 @@ | |||||||
|         "body-parser": "^1.19.0", |         "body-parser": "^1.19.0", | ||||||
|         "bootbox": "5.5.2", |         "bootbox": "5.5.2", | ||||||
|         "bootstrap": "^3.4.1", |         "bootstrap": "^3.4.1", | ||||||
|         "chart.js": "^2.9.3", |         "chart.js": "^2.9.4", | ||||||
|         "cli-graph": "^3.2.2", |         "cli-graph": "^3.2.2", | ||||||
|         "clipboard": "^2.0.6", |         "clipboard": "^2.0.6", | ||||||
|         "colors": "^1.4.0", |         "colors": "^1.4.0", | ||||||
|         "commander": "^6.0.0", |         "commander": "^7.1.0", | ||||||
|         "compare-versions": "3.6.0", |         "compare-versions": "3.6.0", | ||||||
|         "compression": "^1.7.4", |         "compression": "^1.7.4", | ||||||
|         "connect-ensure-login": "^0.1.1", |         "connect-ensure-login": "^0.1.1", | ||||||
|         "connect-flash": "^0.1.1", |         "connect-flash": "^0.1.1", | ||||||
|         "connect-mongo": "3.2.0", |         "connect-mongo": "4.2.0", | ||||||
|         "connect-multiparty": "^2.2.0", |         "connect-multiparty": "^2.2.0", | ||||||
|         "connect-pg-simple": "^6.1.0", |         "connect-pg-simple": "^6.2.1", | ||||||
|         "connect-redis": "5.1.0", |         "connect-redis": "5.1.0", | ||||||
|         "cookie-parser": "^1.4.5", |         "cookie-parser": "^1.4.5", | ||||||
|         "cron": "^1.8.2", |         "cron": "^1.8.2", | ||||||
|         "cropperjs": "^1.5.6", |         "cropperjs": "^1.5.11", | ||||||
|         "csurf": "^1.11.0", |         "csurf": "^1.11.0", | ||||||
|         "daemon": "^1.1.0", |         "daemon": "^1.1.0", | ||||||
|         "diff": "^5.0.0", |         "diff": "^5.0.0", | ||||||
|         "express": "^4.17.1", |         "express": "^4.17.1", | ||||||
|         "express-session": "^1.17.0", |         "express-session": "^1.17.1", | ||||||
|         "express-useragent": "^1.0.13", |         "express-useragent": "^1.0.15", | ||||||
|         "graceful-fs": "^4.2.3", |         "graceful-fs": "^4.2.6", | ||||||
|         "helmet": "^4.0.0", |         "helmet": "^4.4.1", | ||||||
|         "html-to-text": "6.0.0", |         "html-to-text": "7.0.0", | ||||||
|         "ipaddr.js": "^2.0.0", |         "ipaddr.js": "^2.0.0", | ||||||
|         "jquery": "3.5.1", |         "jquery": "3.5.1", | ||||||
|         "jquery-deserialize": "2.0.0-rc1", |         "jquery-deserialize": "2.0.0-rc1", | ||||||
| @@ -80,20 +73,20 @@ | |||||||
|         "json2csv": "5.0.6", |         "json2csv": "5.0.6", | ||||||
|         "jsonwebtoken": "^8.5.1", |         "jsonwebtoken": "^8.5.1", | ||||||
|         "less": "^3.11.1", |         "less": "^3.11.1", | ||||||
|         "lodash": "^4.17.15", |         "lodash": "^4.17.21", | ||||||
|         "logrotate-stream": "^0.2.6", |         "logrotate-stream": "^0.2.7", | ||||||
|         "lru-cache": "6.0.0", |         "lru-cache": "6.0.0", | ||||||
|         "material-design-lite": "^1.3.0", |         "material-design-lite": "^1.3.0", | ||||||
|         "mime": "^2.4.4", |         "mime": "^2.5.2", | ||||||
|         "mkdirp": "^1.0.4", |         "mkdirp": "^1.0.4", | ||||||
|         "mongodb": "3.6.4", |         "mongodb": "3.6.4", | ||||||
|         "morgan": "^1.10.0", |         "morgan": "^1.10.0", | ||||||
|         "mousetrap": "^1.6.5", |         "mousetrap": "^1.6.5", | ||||||
|         "@nodebb/bootswatch": "3.4.2", |         "@nodebb/bootswatch": "3.4.2", | ||||||
|         "nconf": "^0.11.0", |         "nconf": "^0.11.2", | ||||||
|         "nodebb-plugin-composer-default": "6.5.12", |         "nodebb-plugin-composer-default": "6.5.12", | ||||||
|         "nodebb-plugin-dbsearch": "4.2.0", |         "nodebb-plugin-dbsearch": "4.2.0", | ||||||
|         "nodebb-plugin-emoji": "^3.3.0", |         "nodebb-plugin-emoji": "^3.5.0", | ||||||
|         "nodebb-plugin-emoji-android": "2.0.5", |         "nodebb-plugin-emoji-android": "2.0.5", | ||||||
|         "nodebb-plugin-markdown": "8.12.6", |         "nodebb-plugin-markdown": "8.12.6", | ||||||
|         "nodebb-plugin-mentions": "2.13.7", |         "nodebb-plugin-mentions": "2.13.7", | ||||||
| @@ -104,35 +97,35 @@ | |||||||
|         "nodebb-theme-slick": "1.4.3", |         "nodebb-theme-slick": "1.4.3", | ||||||
|         "nodebb-theme-vanilla": "11.4.5", |         "nodebb-theme-vanilla": "11.4.5", | ||||||
|         "nodebb-widget-essentials": "5.0.3", |         "nodebb-widget-essentials": "5.0.3", | ||||||
|         "nodemailer": "^6.4.6", |         "nodemailer": "^6.5.0", | ||||||
|         "nprogress": "0.2.0", |         "nprogress": "0.2.0", | ||||||
|         "passport": "^0.4.1", |         "passport": "^0.4.1", | ||||||
|         "passport-http-bearer": "^1.0.1", |         "passport-http-bearer": "^1.0.1", | ||||||
|         "passport-local": "1.0.0", |         "passport-local": "1.0.0", | ||||||
|         "pg": "^8.0.2", |         "pg": "^8.5.1", | ||||||
|         "pg-cursor": "^2.1.9", |         "pg-cursor": "^2.5.2", | ||||||
|         "postcss": "8.2.6", |         "postcss": "8.2.6", | ||||||
|         "postcss-clean": "1.2.0", |         "postcss-clean": "1.2.0", | ||||||
|         "promise-polyfill": "^8.1.3", |         "promise-polyfill": "^8.2.0", | ||||||
|         "prompt": "^1.0.0", |         "prompt": "^1.1.0", | ||||||
|         "redis": "3.0.2", |         "redis": "3.0.2", | ||||||
|         "request": "2.88.2", |         "request": "2.88.2", | ||||||
|         "request-promise-native": "^1.0.8", |         "request-promise-native": "^1.0.9", | ||||||
|         "requirejs": "2.3.6", |         "requirejs": "2.3.6", | ||||||
|         "rimraf": "3.0.2", |         "rimraf": "3.0.2", | ||||||
|         "rss": "^1.2.2", |         "rss": "^1.2.2", | ||||||
|         "sanitize-html": "^2.0.0", |         "sanitize-html": "^2.3.2", | ||||||
|         "semver": "^7.2.1", |         "semver": "^7.3.4", | ||||||
|         "serve-favicon": "^2.5.0", |         "serve-favicon": "^2.5.0", | ||||||
|         "sharp": "0.27.2", |         "sharp": "0.27.2", | ||||||
|         "sitemap": "^6.1.0", |         "sitemap": "^6.4.0", | ||||||
|         "slideout": "1.0.1", |         "slideout": "1.0.1", | ||||||
|         "socket.io": "3.1.2", |         "socket.io": "3.1.2", | ||||||
|         "socket.io-adapter-cluster": "^1.0.1", |         "socket.io-adapter-cluster": "^1.0.1", | ||||||
|         "socket.io-client": "3.1.2", |         "socket.io-client": "3.1.2", | ||||||
|         "socket.io-redis": "6.0.1", |         "socket.io-redis": "6.0.1", | ||||||
|         "sortablejs": "1.13.0", |         "sortablejs": "1.13.0", | ||||||
|         "spdx-license-list": "^6.1.0", |         "spdx-license-list": "^6.4.0", | ||||||
|         "spider-detector": "2.0.0", |         "spider-detector": "2.0.0", | ||||||
|         "textcomplete": "^0.17.1", |         "textcomplete": "^0.17.1", | ||||||
|         "textcomplete.contenteditable": "^0.1.1", |         "textcomplete.contenteditable": "^0.1.1", | ||||||
|   | |||||||
| @@ -116,7 +116,7 @@ program | |||||||
| 	.command('start') | 	.command('start') | ||||||
| 	.description('Start the NodeBB server') | 	.description('Start the NodeBB server') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		require('./running').start(program); | 		require('./running').start(program.opts()); | ||||||
| 	}); | 	}); | ||||||
| program | program | ||||||
| 	.command('slog', null, { | 	.command('slog', null, { | ||||||
| @@ -124,8 +124,7 @@ program | |||||||
| 	}) | 	}) | ||||||
| 	.description('Start the NodeBB server and view the live output log') | 	.description('Start the NodeBB server and view the live output log') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		program.log = true; | 		require('./running').start({ ...program.opts(), log: true }); | ||||||
| 		require('./running').start(program); |  | ||||||
| 	}); | 	}); | ||||||
| program | program | ||||||
| 	.command('dev', null, { | 	.command('dev', null, { | ||||||
| @@ -133,34 +132,33 @@ program | |||||||
| 	}) | 	}) | ||||||
| 	.description('Start NodeBB in verbose development mode') | 	.description('Start NodeBB in verbose development mode') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		program.dev = true; |  | ||||||
| 		process.env.NODE_ENV = 'development'; | 		process.env.NODE_ENV = 'development'; | ||||||
| 		global.env = 'development'; | 		global.env = 'development'; | ||||||
| 		require('./running').start(program); | 		require('./running').start({ ...program.opts(), dev: true }); | ||||||
| 	}); | 	}); | ||||||
| program | program | ||||||
| 	.command('stop') | 	.command('stop') | ||||||
| 	.description('Stop the NodeBB server') | 	.description('Stop the NodeBB server') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		require('./running').stop(program); | 		require('./running').stop(program.opts()); | ||||||
| 	}); | 	}); | ||||||
| program | program | ||||||
| 	.command('restart') | 	.command('restart') | ||||||
| 	.description('Restart the NodeBB server') | 	.description('Restart the NodeBB server') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		require('./running').restart(program); | 		require('./running').restart(program.opts()); | ||||||
| 	}); | 	}); | ||||||
| program | program | ||||||
| 	.command('status') | 	.command('status') | ||||||
| 	.description('Check the running status of the NodeBB server') | 	.description('Check the running status of the NodeBB server') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		require('./running').status(program); | 		require('./running').status(program.opts()); | ||||||
| 	}); | 	}); | ||||||
| program | program | ||||||
| 	.command('log') | 	.command('log') | ||||||
| 	.description('Open the output log (useful for debugging)') | 	.description('Open the output log (useful for debugging)') | ||||||
| 	.action(() => { | 	.action(() => { | ||||||
| 		require('./running').log(program); | 		require('./running').log(program.opts()); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| // management commands | // management commands | ||||||
| @@ -193,7 +191,7 @@ program | |||||||
| 	.description(`Compile static assets ${'(JS, CSS, templates, languages)'.red}`) | 	.description(`Compile static assets ${'(JS, CSS, templates, languages)'.red}`) | ||||||
| 	.option('-s, --series', 'Run builds in series without extra processes') | 	.option('-s, --series', 'Run builds in series without extra processes') | ||||||
| 	.action((targets, options) => { | 	.action((targets, options) => { | ||||||
| 		if (program.dev) { | 		if (program.opts().dev) { | ||||||
| 			process.env.NODE_ENV = 'development'; | 			process.env.NODE_ENV = 'development'; | ||||||
| 			global.env = 'development'; | 			global.env = 'development'; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ | |||||||
|  |  | ||||||
| const winston = require('winston'); | const winston = require('winston'); | ||||||
| const nconf = require('nconf'); | const nconf = require('nconf'); | ||||||
| const session = require('express-session'); |  | ||||||
| const semver = require('semver'); | const semver = require('semver'); | ||||||
| const prompt = require('prompt'); | const prompt = require('prompt'); | ||||||
| const utils = require('../utils'); | const utils = require('../utils'); | ||||||
| @@ -66,11 +65,11 @@ mongoModule.init = async function () { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| mongoModule.createSessionStore = async function (options) { | mongoModule.createSessionStore = async function (options) { | ||||||
| 	const client = await connection.connect(options); | 	const { default: MongoStore } = require('connect-mongo'); | ||||||
| 	const meta = require('../meta'); | 	const meta = require('../meta'); | ||||||
| 	const sessionStore = require('connect-mongo')(session); |  | ||||||
| 	const store = new sessionStore({ | 	const store = MongoStore.create({ | ||||||
| 		client: client, | 		clientPromise: connection.connect(options), | ||||||
| 		ttl: meta.getSessionTTLSeconds(), | 		ttl: meta.getSessionTTLSeconds(), | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user