diff options
author | Wu Cheng-Han | 2015-07-04 22:19:09 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-07-04 22:19:09 +0800 |
commit | 85c67212ad5f5a0d5ceb9104d4ed22d8e8e54457 (patch) | |
tree | a2b8efa65663f21e530ebfe32fb649e392e582be /lib | |
parent | 01685c255fda6e13f1cd2980130d2e388d52125c (diff) |
Added profile image on onlineList
Diffstat (limited to 'lib')
-rw-r--r-- | lib/realtime.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/realtime.js b/lib/realtime.js index 2f648c11..ca9cecd8 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -348,6 +348,7 @@ function buildUserOutData(user) { id: user.id, login: user.login, userid: user.userid, + photo: user.photo, color: user.color, cursor: user.cursor, name: user.name, @@ -361,24 +362,23 @@ function updateUserData(socket, user) { //retrieve user data from passport if (socket.request.user && socket.request.user.logged_in) { var profile = JSON.parse(socket.request.user.profile); - /* var photo = null; switch(profile.provider) { case "facebook": - console.log(profile); + photo = 'https://graph.facebook.com/' + profile.id + '/picture'; break; case "twitter": - photo = profile.photos[0]; + photo = profile.photos[0].value; break; case "github": - photo = profile.avatar_url; + photo = 'https://avatars.githubusercontent.com/u/' + profile.id + '?s=48'; break; case "dropbox": - //not image api provided + //no image api provided, use gravatar + photo = 'https://www.gravatar.com/avatar/' + md5(profile.emails[0].value); break; } user.photo = photo; - */ user.name = profile.displayName || profile.username; user.userid = socket.request.user._id; user.login = true; |