mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
closes #73
This commit is contained in:
@@ -38,7 +38,7 @@ marked.setOptions({
|
||||
post.username = userData.username || 'anonymous';
|
||||
post.userslug = userData.userslug || '';
|
||||
post.user_rep = userData.reputation || 0;
|
||||
post.picture = userData.picture || 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e';
|
||||
post.picture = userData.picture || require('gravatar').url('', {}, https=global.config.https);
|
||||
post.signature = marked(userData.signature || '');
|
||||
|
||||
callback();
|
||||
|
||||
17
src/user.js
17
src/user.js
@@ -338,16 +338,19 @@ var utils = require('./../public/src/utils.js'),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
User.createGravatarURLFromEmail = function(email) {
|
||||
var forceDefault = ''
|
||||
var options = {
|
||||
size: '128',
|
||||
default: 'identicon',
|
||||
rating: 'pg'
|
||||
};
|
||||
|
||||
if (!email) {
|
||||
email = '0000',
|
||||
forceDefault = '&forceDefault=y';
|
||||
email = '';
|
||||
options.forcedefault = 'y';
|
||||
}
|
||||
var emailHash = crypto.createHash('md5').update(email.toLowerCase().trim()).digest('hex');
|
||||
// @todo: https asset support?
|
||||
return 'http://www.gravatar.com/avatar/' + emailHash + '?default=identicon&s=128' + forceDefault;
|
||||
|
||||
return require('gravatar').url(email, options, https=global.config.https);
|
||||
}
|
||||
|
||||
User.hashPassword = function(password, callback) {
|
||||
|
||||
@@ -63,6 +63,9 @@ var express = require('express'),
|
||||
auth.initialize(app);
|
||||
|
||||
app.use(function(req, res, next) {
|
||||
|
||||
global.config.https = req.connection.encrypted !== undefined;
|
||||
|
||||
// Don't bother with session handling for API requests
|
||||
if (/^\/api\//.test(req.url)) return next();
|
||||
|
||||
@@ -261,9 +264,13 @@ var express = require('express'),
|
||||
app.get('/test', function(req, res) {
|
||||
|
||||
console.log('derp');
|
||||
user.get_userslugs_by_uids([1,2], function(data) {
|
||||
/*user.get_userslugs_by_uids([1,2], function(data) {
|
||||
res.send(data);
|
||||
});
|
||||
});*/
|
||||
var gravatar= require('gravatar');
|
||||
var img = gravatar.url('', {}, https=false);
|
||||
res.send(img);
|
||||
// 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e'
|
||||
|
||||
/* categories.getCategoryById(1,1, function(data) {
|
||||
res.send(data);
|
||||
|
||||
@@ -146,7 +146,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
uid:0,
|
||||
username: "Anonymous User",
|
||||
email: '',
|
||||
picture: 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?s=24'
|
||||
picture: require('gravatar').url('', {s:'24'}, https=global.config.https)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user