Skip to content

Commit

Permalink
Merge commit '6aec61d7227b73b49f30ea912dcab5f299f240f9' into v1.x.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nodebb-misty committed Sep 30, 2016
2 parents 9cc13aa + 6aec61d commit fda10ea
Show file tree
Hide file tree
Showing 578 changed files with 11,313 additions and 4,390 deletions.
20 changes: 20 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
node_modules/
public/src/nodebb.min.js
*.sublime-project
*.sublime-workspace
.project
.vagrant
.DS_Store
logs/
/public/templates
/public/uploads
/public/sounds
/public/vendor
/public/nodebb.min.js
/public/acp.min.js
/public/src/modules/string.js
.idea/
.vscode/
*.ipr
*.iws
/coverage
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
"handle-callback-err": [ "error", "^(e$|(e|(.*(_e|E)))rr)" ]
}
}

3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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)
* Database (mongo or redis) and it's version.
* Exact steps to cause this issue
1. First I did this...
2. Then, I clicked on this item...
Expand All @@ -9,4 +10,4 @@ Please include the following information when submitting a bug report/issue:
* What happened instead
* e.g. Instead, I got *zyx* and NodeBB set fire to my house

Thank you!
Thank you!
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ npm-debug.log
node_modules/
sftp-config.json
config.json
jsconfig.json
public/src/nodebb.min.js
!src/views/config.json
public/css/*.css
Expand All @@ -15,6 +16,7 @@ provision.sh
*.komodoproject
.DS_Store
feeds/recent.rss
.eslintcache

logs/

Expand Down Expand Up @@ -50,4 +52,4 @@ tx.exe
.transifexrc

##Coverage output
coverage
coverage
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ before_install:
- "echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list"
- "sudo apt-get update"
- "sudo apt-get install mongodb-org-server"
- npm i --production
- node app --setup="{\"url\":\"http://127.0.0.1:4567/\",\"secret\":\"abcdef\",\"database\":\"mongo\",\"mongo:host\":\"127.0.0.1\",\"mongo:port\":27017,\"mongo:username\":\"\",\"mongo:password\":\"\",\"mongo:database\":0,\"redis:host\":\"127.0.0.1\",\"redis:port\":6379,\"redis:password\":\"\",\"redis:database\":0,\"admin:username\":\"admin\",\"admin:email\":\"test@example.org\",\"admin:password\":\"abcdef\",\"admin:password:confirm\":\"abcdef\"}" --ci="{\"host\":\"127.0.0.1\",\"port\":27017,\"database\":0}"
before_script:
- "npm i --production"
- sh -c "if [ '$DB' = 'mongodb' ]; then node app --setup=\"{\\\"url\\\":\\\"http://127.0.0.1:4567/\\\",\\\"secret\\\":\\\"abcdef\\\",\\\"database\\\":\\\"mongo\\\",\\\"mongo:host\\\":\\\"127.0.0.1\\\",\\\"mongo:port\\\":27017,\\\"mongo:username\\\":\\\"\\\",\\\"mongo:password\\\":\\\"\\\",\\\"mongo:database\\\":0,\\\"redis:host\\\":\\\"127.0.0.1\\\",\\\"redis:port\\\":6379,\\\"redis:password\\\":\\\"\\\",\\\"redis:database\\\":0,\\\"admin:username\\\":\\\"admin\\\",\\\"admin:email\\\":\\\"test@example.org\\\",\\\"admin:password\\\":\\\"abcdef\\\",\\\"admin:password:confirm\\\":\\\"abcdef\\\"}\" --ci=\"{\\\"host\\\":\\\"127.0.0.1\\\",\\\"port\\\":27017,\\\"database\\\":0}\"; fi"
- sh -c "if [ '$DB' = 'redis' ]; then node app --setup=\"{\\\"url\\\":\\\"http://127.0.0.1:4567/\\\",\\\"secret\\\":\\\"abcdef\\\",\\\"database\\\":\\\"redis\\\",\\\"mongo:host\\\":\\\"127.0.0.1\\\",\\\"mongo:port\\\":27017,\\\"mongo:username\\\":\\\"\\\",\\\"mongo:password\\\":\\\"\\\",\\\"mongo:database\\\":0,\\\"redis:host\\\":\\\"127.0.0.1\\\",\\\"redis:port\\\":6379,\\\"redis:password\\\":\\\"\\\",\\\"redis:database\\\":0,\\\"admin:username\\\":\\\"admin\\\",\\\"admin:email\\\":\\\"test@example.org\\\",\\\"admin:password\\\":\\\"abcdef\\\",\\\"admin:password:confirm\\\":\\\"abcdef\\\"}\" --ci=\"{\\\"host\\\":\\\"127.0.0.1\\\",\\\"port\\\":6379,\\\"database\\\":0}\"; fi"
before_script:
- "until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done"
language: node_js
env:
- CXX=g++-4.8
- CXX=g++-4.8 DB=mongodb
- CXX=g++-4.8 DB=redis
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
node_js:
- "4.2"
- "4.1"
- "4.0"
- "0.11"
- "0.10"
- "6"
- "5"
- "4"
branches:
only:
- master
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ Additional functionality is enabled through the use of third-party plugins.
[![](http://i.imgur.com/LmHtPhob.png)](http://i.imgur.com/LmHtPho.png)
[![](http://i.imgur.com/paiJPJkb.jpg)](http://i.imgur.com/paiJPJk.jpg)

[![](http://i.imgur.com/8OLssij.png)](http://i.imgur.com/8OLssij.png)
[![](http://i.imgur.com/JKOc0LZ.png)](http://i.imgur.com/JKOc0LZ.png)
[![](http://i.imgur.com/HwNEXGu.png)](http://i.imgur.com/HwNEXGu.png)
[![](http://i.imgur.com/II1byYs.png)](http://i.imgur.com/II1byYs.png)



## How can I follow along/contribute?

Expand Down
41 changes: 38 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
NodeBB - A better forum platform for the modern web
https://github.com/NodeBB/NodeBB/
Copyright (C) 2013-2014 NodeBB Inc.
Copyright (C) 2013-2016 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
Expand Down Expand Up @@ -54,10 +54,11 @@ if (nconf.get('config')) {
var configExists = file.existsSync(configFile) || (nconf.get('url') && nconf.get('secret') && nconf.get('database'));

loadConfig();
versionCheck();

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-2014 NodeBB Inc.');
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('');
Expand Down Expand Up @@ -103,6 +104,10 @@ function loadConfig() {
nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path')));
nconf.set('core_templates_path', path.join(__dirname, 'src/views'));
nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-persona/templates'));

if (nconf.get('url')) {
nconf.set('url_parsed', url.parse(nconf.get('url')));
}
}


Expand All @@ -113,14 +118,17 @@ function start() {
if (!nconf.get('upload_path')) {
nconf.set('upload_path', '/public/uploads');
}
if (!nconf.get('sessionKey')) {
nconf.set('sessionKey', 'express.sid');
}
// Parse out the relative_url and other goodies from the configured URL
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('use_port', !!urlObject.port);
nconf.set('relative_path', relativePath);
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || 4567);
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
nconf.set('upload_url', nconf.get('upload_path').replace(/^\/public/, ''));

if (nconf.get('isPrimary') === 'true') {
Expand Down Expand Up @@ -285,6 +293,11 @@ function upgrade() {

function activate() {
require('./src/database').init(function(err) {
if (err) {
winston.error(err.stack);
process.exit(1);
}

var plugin = nconf.get('_')[1] ? nconf.get('_')[1] : nconf.get('activate'),
db = require('./src/database');

Expand All @@ -296,9 +309,19 @@ function activate() {

function listPlugins() {
require('./src/database').init(function(err) {
if (err) {
winston.error(err.stack);
process.exit(1);
}

var db = require('./src/database');

db.getSortedSetRange('plugins:active', 0, -1, function(err, plugins) {
if (err) {
winston.error(err.stack);
process.exit(1);
}

winston.info('Active plugins: \n\t - ' + plugins.join('\n\t - '));
process.exit();
});
Expand Down Expand Up @@ -328,3 +351,15 @@ function restart() {
shutdown(1);
}
}

function versionCheck() {
var version = process.version.slice(1);
var range = pkg.engines.node;
var semver = require('semver');
var compatible = semver.satisfies(version, range);

if (!compatible) {
winston.warn('Your version of Node.js is too outdated for NodeBB. Please update your version of Node.js.');
winston.warn('Recommended ' + range.green + ', '.reset + version.yellow + ' provided\n'.reset);
}
}
64 changes: 34 additions & 30 deletions install/web.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"use strict";

var winston = require('winston'),
express = require('express'),
bodyParser = require('body-parser'),
fs = require('fs'),
path = require('path'),
less = require('less'),
async = require('async'),
uglify = require('uglify-js'),
nconf = require('nconf'),
app = express(),
server;
var winston = require('winston');
var express = require('express');
var bodyParser = require('body-parser');
var fs = require('fs');
var path = require('path');
var less = require('less');
var async = require('async');
var uglify = require('uglify-js');
var nconf = require('nconf');
var app = express();
var server;

winston.add(winston.transports.File, {
filename: 'logs/webinstall.log',
Expand All @@ -22,13 +22,13 @@ winston.add(winston.transports.File, {
level: 'verbose'
});

var web = {},
scripts = [
'public/vendor/xregexp/xregexp.js',
'public/vendor/xregexp/unicode/unicode-base.js',
'public/src/utils.js',
'public/src/installer/install.js'
];
var web = {};
var scripts = [
'public/vendor/xregexp/xregexp.js',
'public/vendor/xregexp/unicode/unicode-base.js',
'public/src/utils.js',
'public/src/installer/install.js'
];

web.install = function(port) {
port = port || 4567;
Expand Down Expand Up @@ -62,22 +62,23 @@ function setupRoutes() {
}

function welcome(req, res) {
var dbs = ['redis', 'mongo'],
databases = [];

dbs.forEach(function(el) {
databases.push({
var dbs = ['redis', 'mongo'];
var databases = dbs.map(function(el) {
return {
name: el,
questions: require('../src/database/' + el).questions
});
};
});

var defaults = require('./data/defaults');

res.render('install/index', {
databases: databases,
skipDatabaseSetup: !!nconf.get('database'),
error: res.locals.error ? true : false,
success: res.locals.success ? true : false,
values: req.body
values: req.body,
minimumPasswordLength: defaults.minimumPasswordLength
});
}

Expand All @@ -104,7 +105,6 @@ function install(req, res) {
}

function launch(req, res) {
var pidFilePath = __dirname + '../pidfile';
res.json({});
server.close();

Expand All @@ -130,6 +130,10 @@ function compileLess(callback) {
}

fs.readFile(path.join(__dirname, '../public/less/install.less'), function(err, style) {
if (err) {
return winston.error('Unable to read LESS install file: ', err);
}

less.render(style.toString(), function(err, css) {
if(err) {
return winston.error('Unable to compile LESS: ', err);
Expand All @@ -146,10 +150,10 @@ function compileJS(callback) {
return callback(false);
}

var scriptPath = path.join(__dirname, '..'),
result = uglify.minify(scripts.map(function(script) {
return path.join(scriptPath, script);
}));
var scriptPath = path.join(__dirname, '..');
var result = uglify.minify(scripts.map(function(script) {
return path.join(scriptPath, script);
}));


fs.writeFile(path.join(__dirname, '../public/nodebb.min.js'), result.code, callback);
Expand Down
3 changes: 2 additions & 1 deletion loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ function getPorts() {

Loader.restart = function() {
killWorkers();

nconf.remove('file');
nconf.use('file', { file: path.join(__dirname, '/config.json') });
Loader.start();
};

Expand Down

0 comments on commit fda10ea

Please sign in to comment.