diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..cc592ac143 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,12 @@ +Please include the following information when submitting a bug report/issue: + +* NodeBB version and git hash (to find your git hash, execute `git rev-parse HEAD` from the main NodeBB directory) +* Exact steps to cause this issue + 1. First I did this... + 2. Then, I clicked on this item... +* What you expected + * e.g. I expected *abc* to *xyz* +* What happened instead + * e.g. Instead, I got *zyx* and NodeBB set fire to my house + +Thank you! \ No newline at end of file diff --git a/.gitignore b/.gitignore index 144cfe268a..a8ea9cb1eb 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,7 @@ pidfile ## Transifex tx.exe -.transifexrc \ No newline at end of file +.transifexrc + +##Coverage output +coverage \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index a6aca2083a..eb3cdc7417 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,15 +7,16 @@ var fork = require('child_process').fork, module.exports = function(grunt) { + var args = []; + if (!grunt.option('verbose')) { + args.push('--log-level=info'); + } + function update(action, filepath, target) { - var args = [], + var updateArgs = args.slice(), fromFile = '', compiling = '', time = Date.now(); - - if (!grunt.option('verbose')) { - args.push('--log-level=info'); - } if (target === 'lessUpdated_Client') { fromFile = ['js', 'tpl', 'acpLess']; @@ -37,11 +38,11 @@ module.exports = function(grunt) { return incomplete.indexOf(ext) === -1; }); - args.push('--from-file=' + fromFile.join(',')); + updateArgs.push('--from-file=' + fromFile.join(',')); incomplete.push(compiling); worker.kill(); - worker = fork('app.js', args, { env: env }); + worker = fork('app.js', updateArgs, { env: env }); worker.on('message', function() { if (incomplete.length) { @@ -101,6 +102,6 @@ module.exports = function(grunt) { env.NODE_ENV = 'development'; - worker = fork('app.js', [], { env: env }); + worker = fork('app.js', args, { env: env }); grunt.event.on('watch', update); }; \ No newline at end of file diff --git a/app.js b/app.js index fa8964fb35..1fd183757f 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ if (nconf.get('config')) { configFile = path.resolve(__dirname, nconf.get('config')); } -var configExists = file.existsSync(configFile); +var configExists = file.existsSync(configFile) || (nconf.get('url') && nconf.get('secret') && nconf.get('database')); loadConfig(); @@ -117,7 +117,7 @@ function start() { var urlObject = url.parse(nconf.get('url')); var relativePath = urlObject.pathname !== '/' ? urlObject.pathname : ''; nconf.set('base_url', urlObject.protocol + '//' + urlObject.host); - nconf.set('secure', urlObject.protocol === 'https'); + nconf.set('secure', urlObject.protocol === 'https:'); nconf.set('use_port', !!urlObject.port); nconf.set('relative_path', relativePath); nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || 4567); @@ -180,7 +180,12 @@ function start() { require('./src/meta').configs.init(next); }, function(next) { - require('./src/meta').dependencies.check(next); + if (nconf.get('dep-check') === undefined || nconf.get('dep-check') !== false) { + require('./src/meta').dependencies.check(next); + } else { + winston.warn('[init] Dependency checking skipped!'); + setImmediate(next); + } }, function(next) { require('./src/upgrade').check(next); diff --git a/install/data/defaults.json b/install/data/defaults.json index 5041ff83ea..c471db6b89 100644 --- a/install/data/defaults.json +++ b/install/data/defaults.json @@ -9,6 +9,8 @@ "maximumPostLength": 32767, "minimumTagsPerTopic": 0, "maximumTagsPerTopic": 5, + "minimumTagLength": 3, + "maximumTagLength": 15, "allowGuestSearching": 0, "allowTopicsThumbnail": 0, "registrationType": "normal", @@ -29,6 +31,9 @@ "profileImageDimension": 128, "requireEmailConfirmation": 0, "allowProfileImageUploads": 1, - "teaserPost": "last", - "allowPrivateGroups": 1 -} \ No newline at end of file + "teaserPost": "last-reply", + "allowPrivateGroups": 1, + "unreadCutoff": 2, + "bookmarkThreshold": 5, + "topicsPerList": 20 +} diff --git a/install/data/footer.json b/install/data/footer.json index 7c71cad648..12528110c6 100644 --- a/install/data/footer.json +++ b/install/data/footer.json @@ -2,7 +2,7 @@ { "widget": "html", "data" : { - "html": "", + "html": "", "title":"", "container":"" } diff --git a/loader.js b/loader.js index b78abdc4a1..e853fa562c 100644 --- a/loader.js +++ b/loader.js @@ -171,7 +171,7 @@ function forkWorker(index, isPrimary) { } process.env.isPrimary = isPrimary; - process.env.isCluster = true; + process.env.isCluster = ports.length > 1 ? true : false; process.env.port = ports[index]; var worker = fork('app.js', [], { diff --git a/nodebb b/nodebb index 3e3aac5890..53ae28db22 100755 --- a/nodebb +++ b/nodebb @@ -1,14 +1,25 @@ #!/usr/bin/env node -var colors = require('colors'), - cproc = require('child_process'), - argv = require('minimist')(process.argv.slice(2)), - fs = require('fs'), - path = require('path'), - request = require('request'), - semver = require('semver'), - prompt = require('prompt'), - async = require('async'); +try { + var colors = require('colors'), + cproc = require('child_process'), + argv = require('minimist')(process.argv.slice(2)), + fs = require('fs'), + path = require('path'), + request = require('request'), + semver = require('semver'), + prompt = require('prompt'), + async = require('async'); +} catch (e) { + if (e.code === 'MODULE_NOT_FOUND') { + process.stdout.write('NodeBB could not be started because it\'s dependencies have not been installed.\n'); + process.stdout.write('Please ensure that you have executed "npm install --production" prior to running NodeBB.\n\n'); + process.stdout.write('For more information, please see: https://docs.nodebb.org/en/latest/installing/os.html\n\n'); + process.stdout.write('Could not start: ' + e.code + '\n'); + + process.exit(1); + } +} var getRunningPid = function(callback) { fs.readFile(__dirname + '/pidfile', { @@ -196,7 +207,7 @@ var getRunningPid = function(callback) { description: 'Proceed with upgrade (y|n)?'.reset, type: 'string' }, function(err, result) { - if (result.upgrade === 'y' || result.upgrade === 'yes') { + if (['y', 'Y', 'yes', 'YES'].indexOf(result.upgrade) !== -1) { process.stdout.write('\nUpgrading packages...'); var args = ['npm', 'i']; found.forEach(function(suggestObj) { diff --git a/package.json b/package.json index 68da7bd634..f940092b18 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "main": "app.js", "scripts": { "start": "node loader.js", - "test": "mocha ./tests -t 10000" + "test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- ./tests -t 10000" }, "dependencies": { "async": "~1.5.0", @@ -36,6 +36,7 @@ "html-to-text": "2.0.0", "ip": "1.1.2", "jimp": "0.2.21", + "json-2-csv": "^2.0.22", "less": "^2.0.0", "logrotate-stream": "^0.2.3", "lru-cache": "4.0.0", @@ -46,19 +47,19 @@ "morgan": "^1.3.2", "mousetrap": "^1.5.3", "nconf": "~0.8.2", - "nodebb-plugin-composer-default": "3.0.22", - "nodebb-plugin-dbsearch": "1.0.1", - "nodebb-plugin-emoji-one": "1.1.0", + "nodebb-plugin-composer-default": "4.0.5", + "nodebb-plugin-dbsearch": "1.0.2", "nodebb-plugin-emoji-extended": "1.1.0", - "nodebb-plugin-markdown": "5.0.1", - "nodebb-plugin-mentions": "1.0.21", + "nodebb-plugin-emoji-one": "1.1.5", + "nodebb-plugin-markdown": "6.0.0", + "nodebb-plugin-mentions": "1.1.2", "nodebb-plugin-soundpack-default": "0.1.6", - "nodebb-plugin-spam-be-gone": "0.4.6", - "nodebb-rewards-essentials": "0.0.8", - "nodebb-theme-lavender": "3.0.9", - "nodebb-theme-persona": "4.0.118", - "nodebb-theme-vanilla": "5.0.63", - "nodebb-widget-essentials": "2.0.9", + "nodebb-plugin-spam-be-gone": "0.4.9", + "nodebb-rewards-essentials": "0.0.9", + "nodebb-theme-lavender": "3.0.13", + "nodebb-theme-persona": "4.1.7", + "nodebb-theme-vanilla": "5.1.3", + "nodebb-widget-essentials": "2.0.10", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", "nodemailer-smtp-transport": "^2.4.1", @@ -88,9 +89,10 @@ "xregexp": "~3.1.0" }, "devDependencies": { - "mocha": "~1.13.0", "grunt": "~0.4.5", - "grunt-contrib-watch": "^1.0.0" + "grunt-contrib-watch": "^1.0.0", + "istanbul": "^0.4.2", + "mocha": "~1.13.0" }, "bugs": { "url": "https://github.com/NodeBB/NodeBB/issues" @@ -115,4 +117,4 @@ "url": "https://github.com/barisusakli" } ] -} \ No newline at end of file +} diff --git a/public/503.html b/public/503.html index 124e92ef26..8907525ec4 100644 --- a/public/503.html +++ b/public/503.html @@ -2,6 +2,7 @@