Merge branch 'master' of https://github.com/designcreateplay/NodeBB into pagination

v1.18.x
Baris Soner Usakli 11 years ago
commit 8744013013

@ -106,11 +106,9 @@
upgrade.check(function(schema_ok) {
if (schema_ok || nconf.get('check-schema') === false) {
sockets.init();
sockets.init(webserver.server);
plugins.init();
global.templates = {};
global.translator = translator;
translator.loadServer();

@ -79,7 +79,7 @@
template.prototype.parse = parse;
template.prototype.html = String(html);
global.templates[file] = new template;
templates[file] = new template;
loaded--;
if (loaded === 0) {
@ -396,7 +396,7 @@
namespace = '';
} else {
// clean up all undefined conditionals
template = template.replace(/<!-- IF([^@]*?)ENDIF([^@]*?)-->/gi, '');
template = template.replace(/<!-- IF([^@]*?)ENDIF([^@]*?)-->/gi, '');
}
return template;

@ -5,6 +5,7 @@ var db = require('./database.js'),
topics = require('./topics.js'),
plugins = require('./plugins'),
CategoryTools = require('./categoryTools'),
meta = require('./meta'),
async = require('async'),
winston = require('winston'),

@ -1,16 +1,18 @@
var User = require('./user'),
var fs = require('fs'),
async = require('async'),
path = require('path'),
User = require('./user'),
Plugins = require('./plugins'),
Meta = require('./meta'),
Translator = require('../public/src/translator'),
fs = require('fs'),
async = require('async'),
path = require('path'),
templates = require('../public/src/templates'),
Emailer = {};
var render = function(template, params, callback) {
if (templates[template] !== null) {
if (templates[template]) {
Translator.translate(templates[template].parse(params), function(template) {
callback(null, template);
});

@ -1,7 +1,7 @@
var db = require('./database'),
async = require('async'),
user = require('./user'),
plugins = require('./plugins');
plugins = require('./plugins'),
meta = require('./meta');

@ -255,7 +255,7 @@ var fs = require('fs'),
},
minFile: function (next) {
if (!fs.existsSync(Meta.js.minFile)) {
winston.warn('No minified client-side library found');
winston.info('No minified client-side library found');
return next(null, 0);
}

@ -194,7 +194,7 @@ var db = require('./database'),
post.user_rep = userData.reputation || 0;
post.user_postcount = userData.postcount || 0;
post.user_banned = parseInt(userData.banned, 10) === 1;
post.picture = userData.picture || gravatar.url('', {}, https = nconf.get('https'));
post.picture = userData.picture || gravatar.url('', {}, true);
if(meta.config.disableSignatures === undefined || parseInt(meta.config.disableSignatures, 10) === 0) {
post.signature = signature;

@ -7,13 +7,14 @@ var nconf = require('nconf'),
user = require('./../user'),
groups = require('../groups'),
topics = require('./../topics'),
pkg = require('./../../package.json'),
pkg = require('./../../package'),
categories = require('./../categories'),
meta = require('../meta'),
plugins = require('../plugins'),
Languages = require('../languages'),
events = require('./../events'),
utils = require('./../../public/src/utils.js');
utils = require('./../../public/src/utils'),
templates = require('./../../public/src/templates');
(function (Admin) {
Admin.isAdmin = function (req, res, next) {

@ -30,9 +30,9 @@ Sockets.userSockets = {};
Sockets.rooms = {};
Sockets.init = function() {
Sockets.init = function(server) {
io = socketioWildcard(SocketIO).listen(global.server, {
io = socketioWildcard(SocketIO).listen(server, {
log: false,
transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'],
'browser client minification': true

@ -58,7 +58,7 @@ SocketMeta.updateHeader = function(socket, data, callback) {
email: '',
picture: gravatar.url('', {
s: '24'
}, nconf.get('https')),
}, true),
config: {
allowGuestSearching: meta.config.allowGuestSearching
}

@ -738,14 +738,14 @@ var async = require('async'),
topicData.unreplied = parseInt(topicData.postcount, 10) === 1;
topicData.username = topicInfo.username || 'anonymous';
topicData.userslug = topicInfo.userslug || '';
topicData.picture = topicInfo.picture || gravatar.url('', {}, https = nconf.get('https'));
topicData.picture = topicInfo.picture || gravatar.url('', {}, true);
topicData.categoryIcon = topicInfo.categoryData.icon;
topicData.categoryName = topicInfo.categoryData.name;
topicData.categorySlug = topicInfo.categoryData.slug;
topicData.badgeclass = (topicInfo.hasread && parseInt(current_user, 10) !== 0) ? '' : 'badge-important';
topicData.teaser_username = topicInfo.teaserInfo.username || '';
topicData.teaser_userslug = topicInfo.teaserInfo.userslug || '';
topicData.teaser_userpicture = topicInfo.teaserInfo.picture || gravatar.url('', {}, https = nconf.get('https'));
topicData.teaser_userpicture = topicInfo.teaserInfo.picture || gravatar.url('', {}, true);
topicData.teaser_pid = topicInfo.teaserInfo.pid;
topicData.teaser_timestamp = utils.toISOString(topicInfo.teaserInfo.timestamp);
@ -1053,7 +1053,7 @@ var async = require('async'),
pid: postData.pid,
username: userData.username || 'anonymous',
userslug: userData.userslug,
picture: userData.picture || gravatar.url('', {}, https = nconf.get('https')),
picture: userData.picture || gravatar.url('', {}, true),
timestamp: postData.timestamp
});
});

@ -17,7 +17,7 @@ var db = require('./database'),
Upgrade.check = function(callback) {
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
var latestSchema = new Date(2014, 0, 23, 16, 5).getTime();
var latestSchema = new Date(2014, 0, 25, 0, 0).getTime();
db.get('schemaDate', function(err, value) {
if (parseInt(value, 10) >= latestSchema) {
@ -318,11 +318,46 @@ Upgrade.upgrade = function(callback) {
winston.info('[2014/1/23] Updating Administrators Group');
next();
});
})
});
} else {
winston.info('[2014/1/23] Updating Administrators Group -- skipped');
next();
}
},
function(next) {
thisSchemaDate = new Date(2014, 0, 25, 0, 0).getTime();
if (schemaDate < thisSchemaDate) {
updatesMade = true;
db.getSortedSetRange('users:joindate', 0, -1, function(err, uids) {
if(err) {
return next(err);
}
if(!uids || !uids.length) {
winston.info('[2014/1/25] Updating User Gravatars to HTTPS -- skipped');
return next();
}
var gravatar = require('gravatar');
function updateGravatar(uid, next) {
User.getUserFields(uid, ['email', 'picture', 'gravatarpicture'], function(err, userData) {
var gravatarPicture = User.createGravatarURLFromEmail(userData.email);
if(userData.picture === userData.gravatarpicture) {
User.setUserField(uid, 'picture', gravatarPicture);
}
User.setUserField(uid, 'gravatarpicture', gravatarPicture, next);
});
}
winston.info('[2014/1/25] Updating User Gravatars to HTTPS');
async.each(uids, updateGravatar, next);
});
} else {
winston.info('[2014/1/25] Updating User Gravatars to HTTPS -- skipped');
next();
}
}
// Add new schema updates here
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!

@ -442,15 +442,14 @@ var bcrypt = require('bcrypt'),
size: '128',
default: 'identicon',
rating: 'pg'
},
https = nconf.get('https');
};
if (!email) {
email = '';
options.forcedefault = 'y';
}
return gravatar.url(email, options, https);
return gravatar.url(email, options, true);
};
User.hashPassword = function(password, callback) {

@ -28,7 +28,9 @@ var path = require('path'),
meta = require('./meta'),
feed = require('./feed'),
plugins = require('./plugins'),
logger = require('./logger');
logger = require('./logger'),
templates = require('./../public/src/templates'),
translator = require('./../public/src/translator');
if(nconf.get('ssl')) {
server = require('https').createServer({
@ -39,13 +41,12 @@ if(nconf.get('ssl')) {
server = require('http').createServer(WebServer);
}
module.exports.server = server;
(function (app) {
"use strict";
var templates = null,
clientScripts;
var clientScripts;
plugins.ready(function() {
// Minify client-side libraries
@ -60,9 +61,6 @@ if(nconf.get('ssl')) {
});
});
server.app = app;
/**
* `options` object requires: req, res
* accepts: metaTags, linkTags
@ -200,7 +198,6 @@ if(nconf.get('ssl')) {
// Local vars, other assorted setup
app.use(function (req, res, next) {
nconf.set('https', req.secure);
res.locals.csrf_token = req.session._csrf;
// Disable framing
@ -376,8 +373,6 @@ if(nconf.get('ssl')) {
});
module.exports.init = function () {
templates = global.templates;
// translate all static templates served by webserver here. ex. footer, logout
plugins.fireHook('filter:footer.build', '', function(err, appendHTML) {
var footer = templates.footer.parse({
@ -932,6 +927,3 @@ if(nconf.get('ssl')) {
});
}(WebServer));
global.server = server;

Loading…
Cancel
Save