summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-08-06 11:58:40 +0200
committerTor Andersson <tor@ccxvii.net>2022-08-06 11:59:32 +0200
commit7dfe4ebbf43d16f8ecc36b8ec8100b840dd96148 (patch)
treebbd032aba2ec31f18b0aa3ed5bf8bafded42b96c /server.js
parent6a72d2b30417c68e74b77d8dc6699573f9e033d5 (diff)
downloadserver-7dfe4ebbf43d16f8ecc36b8ec8100b840dd96148.tar.gz
Zap gravatars!
Diffstat (limited to 'server.js')
-rw-r--r--server.js17
1 files changed, 2 insertions, 15 deletions
diff --git a/server.js b/server.js
index d95b33c..48310d8 100644
--- a/server.js
+++ b/server.js
@@ -216,13 +216,6 @@ function hash_password(password, salt) {
return hash.digest('hex')
}
-function get_avatar(mail) {
- if (!mail)
- mail = "foo@example.com"
- let digest = crypto.createHash('md5').update(mail.trim().toLowerCase()).digest('hex')
- return '//www.gravatar.com/avatar/' + digest + '?d=mp'
-}
-
/*
* USER AUTHENTICATION
*/
@@ -377,7 +370,7 @@ app.get('/about', function (req, res) {
res.render('about.pug', { user: req.user })
})
-app.get('/logout', function (req, res) {
+app.post('/logout', function (req, res) {
let sid = login_cookie(req)
if (sid)
login_delete(res, sid)
@@ -590,7 +583,6 @@ app.post('/change-about', must_be_logged_in, function (req, res) {
app.get('/user/:who_name', function (req, res) {
let who = SQL_SELECT_USER_PROFILE.get(req.params.who_name)
if (who) {
- who.avatar = get_avatar(who.mail)
who.ctime = human_date(who.ctime)
who.atime = human_date(who.atime)
let games = QUERY_LIST_ACTIVE_GAMES_OF_USER.all({ user_id: who.user_id })
@@ -604,7 +596,6 @@ app.get('/user/:who_name', function (req, res) {
app.get('/users', function (req, res) {
let rows = SQL("SELECT * FROM user_profile_view ORDER BY atime DESC").all()
rows.forEach(row => {
- row.avatar = get_avatar(row.mail)
row.ctime = human_date(row.ctime)
row.atime = human_date(row.atime)
})
@@ -1123,11 +1114,7 @@ function annotate_games(games, user_id) {
app.get('/profile', must_be_logged_in, function (req, res) {
req.user.notify = SQL_SELECT_USER_NOTIFY.get(req.user.user_id)
- let avatar = get_avatar(req.user.mail)
- res.render('profile.pug', {
- user: req.user,
- avatar: avatar,
- })
+ res.render('profile.pug', { user: req.user })
})
app.get('/games', function (req, res) {