mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 12:01:17 +01:00
Merge branch 'master' of https://github.com/NodeBB/NodeBB
Conflicts: src/upgrade.js
This commit is contained in:
@@ -9,7 +9,7 @@ First, install the following programs:
|
||||
* https://windows.github.com/
|
||||
* http://nodejs.org/
|
||||
* http://sourceforge.net/projects/redis/files/redis-2.6.10/
|
||||
* http://http://imagemagick.org/script/binary-releases.php#windows/
|
||||
* http://imagemagick.org/script/binary-releases.php#windows/
|
||||
|
||||
You may have to restart your computer.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Minifier.js.minify = function (scripts, minify, callback) {
|
||||
options.outSourceMap = 'nodebb.min.js.map';
|
||||
options.mangle = false;
|
||||
options.compress = false;
|
||||
options.prefix = __dirname.split(path.sep).length;
|
||||
options.prefix = 1;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
"nodebb-plugin-markdown": "~0.5.0",
|
||||
"nodebb-plugin-mentions": "~0.5.0",
|
||||
"nodebb-plugin-soundpack-default": "~0.1.1",
|
||||
"nodebb-theme-lavender": "~0.0.26",
|
||||
"nodebb-theme-vanilla": "~0.0.21",
|
||||
"nodebb-theme-lavender": "~0.0.74",
|
||||
"nodebb-theme-vanilla": "~0.0.111",
|
||||
"nodebb-widget-essentials": "~0.1.0",
|
||||
"npm": "^1.4.6",
|
||||
"passport": "~0.2.0",
|
||||
|
||||
@@ -191,7 +191,7 @@ define('navigator', ['forum/topic/pagination'], function(pagination) {
|
||||
scrollTo.parent().find('.topic-item').addClass('highlight');
|
||||
setTimeout(function() {
|
||||
scrollTo.parent().find('.topic-item').removeClass('highlight');
|
||||
}, 5000);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.relative_path = serverConfig.relative_path;
|
||||
config.version = pkg.version;
|
||||
config.siteTitle = meta.config.title || meta.config.browserTitle || 'NodeBB';
|
||||
config.showSiteTitle = meta.config.showSiteTitle === '1';
|
||||
config.postDelay = meta.config.postDelay;
|
||||
config.minimumTitleLength = meta.config.minimumTitleLength;
|
||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||
|
||||
@@ -5,6 +5,7 @@ var winston = require('winston'),
|
||||
path = require('path'),
|
||||
async = require('async'),
|
||||
_ = require('underscore'),
|
||||
os = require('os'),
|
||||
|
||||
plugins = require('../plugins'),
|
||||
emitter = require('../emitter'),
|
||||
@@ -74,30 +75,30 @@ module.exports = function(Meta) {
|
||||
Meta.js.prepare = function (callback) {
|
||||
plugins.fireHook('filter:scripts.get', Meta.js.scripts, function(err, scripts) {
|
||||
var jsPaths = scripts.map(function (jsPath) {
|
||||
jsPath = path.normalize(jsPath);
|
||||
jsPath = path.normalize(jsPath);
|
||||
|
||||
if (jsPath.substring(0, 7) === 'plugins') {
|
||||
var matches = _.map(plugins.staticDirs, function(realPath, mappedPath) {
|
||||
if (jsPath.match(mappedPath)) {
|
||||
return mappedPath;
|
||||
if (jsPath.substring(0, 7) === 'plugins') {
|
||||
var matches = _.map(plugins.staticDirs, function(realPath, mappedPath) {
|
||||
if (jsPath.match(mappedPath)) {
|
||||
return mappedPath;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}).filter(function(a) { return a; });
|
||||
|
||||
if (matches.length) {
|
||||
var relPath = jsPath.slice(('plugins/' + matches[0]).length),
|
||||
pluginId = matches[0].split(path.sep)[0];
|
||||
|
||||
return plugins.staticDirs[matches[0]] + relPath;
|
||||
} else {
|
||||
winston.warn('[meta.scripts.get] Could not resolve mapped path: ' + jsPath + '. Are you sure it is defined by a plugin?');
|
||||
return null;
|
||||
}
|
||||
}).filter(function(a) { return a; });
|
||||
|
||||
if (matches.length) {
|
||||
var relPath = jsPath.slice(('plugins/' + matches[0]).length),
|
||||
pluginId = matches[0].split(path.sep)[0];
|
||||
|
||||
return plugins.staticDirs[matches[0]] + relPath;
|
||||
} else {
|
||||
winston.warn('[meta.scripts.get] Could not resolve mapped path: ' + jsPath + '. Are you sure it is defined by a plugin?');
|
||||
return null;
|
||||
return path.join(__dirname, '../..', '/public', jsPath);
|
||||
}
|
||||
} else {
|
||||
return path.join(__dirname, '../..', '/public', jsPath);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Meta.js.scripts = jsPaths.filter(function(path) {
|
||||
return path !== null;
|
||||
@@ -123,6 +124,11 @@ module.exports = function(Meta) {
|
||||
next(err);
|
||||
});
|
||||
}, function(err) {
|
||||
// Translate into relative paths
|
||||
Meta.js.scripts = Meta.js.scripts.map(function(script) {
|
||||
return path.relative(path.resolve(__dirname, '../..'), script).replace(/\\/g, '/');
|
||||
});
|
||||
|
||||
Meta.js.prepared = true;
|
||||
callback(err);
|
||||
});
|
||||
@@ -163,4 +169,11 @@ module.exports = function(Meta) {
|
||||
Meta.js.minifierProc.kill('SIGTERM');
|
||||
}
|
||||
};
|
||||
|
||||
// OS detection and handling
|
||||
// if (os.platform() === 'win32') {
|
||||
// Meta.js.scripts = Meta.js.scripts.map(function(script) {
|
||||
// return script.replace(/\//g, '\\');
|
||||
// });
|
||||
// }
|
||||
};
|
||||
@@ -27,34 +27,38 @@ module.exports = function(User) {
|
||||
var password = userData.password;
|
||||
userData.password = null;
|
||||
|
||||
async.parallel([
|
||||
function(next) {
|
||||
async.parallel({
|
||||
emailValid: function(next) {
|
||||
if (userData.email) {
|
||||
next(!utils.isEmailValid(userData.email) ? new Error('[[error:invalid-email]]') : null);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
userNameValid: function(next) {
|
||||
next((!utils.isUserNameValid(userData.username) || !userData.userslug) ? new Error('[[error:invalid-username]]') : null);
|
||||
},
|
||||
function(next) {
|
||||
passwordValid: function(next) {
|
||||
if (password) {
|
||||
next(!utils.isPasswordValid(password) ? new Error('[[error:invalid-password]]') : null);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
renamedUsername: function(next) {
|
||||
meta.userOrGroupExists(userData.userslug, function(err, exists) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
var newUsername = '';
|
||||
async.forever(function(next) {
|
||||
var newUsername = userData.username + (Math.floor(Math.random() * 255) + 1);
|
||||
newUsername = userData.username + (Math.floor(Math.random() * 255) + 1);
|
||||
User.exists(newUsername, function(err, exists) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
if (!exists) {
|
||||
next(newUsername);
|
||||
} else {
|
||||
@@ -69,7 +73,7 @@ module.exports = function(User) {
|
||||
}
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
emailAvailable: function(next) {
|
||||
if (userData.email) {
|
||||
User.email.available(userData.email, function(err, available) {
|
||||
if (err) {
|
||||
@@ -81,28 +85,34 @@ module.exports = function(User) {
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
customFields: function(next) {
|
||||
plugins.fireHook('filter:user.custom_fields', userData, function(err, fields) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
delete fields.username;
|
||||
delete fields.userslug;
|
||||
customFields = fields;
|
||||
next(err);
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
userData: function(next) {
|
||||
plugins.fireHook('filter:user.create', userData, function(err, filteredUserData){
|
||||
next(err, utils.merge(userData, filteredUserData));
|
||||
});
|
||||
}
|
||||
], function(err, results) {
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
userData = results[results.length - 1];
|
||||
var userNameChanged = !!results[3];
|
||||
userData = results.userData;
|
||||
var userNameChanged = !!results.renamedUsername;
|
||||
|
||||
// If a new username was picked...
|
||||
if (userNameChanged) {
|
||||
userData.username = results[3];
|
||||
userData.userslug = utils.slugify(results[3]);
|
||||
userData.username = results.renamedUsername;
|
||||
userData.userslug = utils.slugify(results.renamedUsername);
|
||||
}
|
||||
|
||||
db.incrObjectField('global', 'nextUid', function(err, uid) {
|
||||
|
||||
Reference in New Issue
Block a user