Skip to content

Commit

Permalink
start gravatar url tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfaerman committed Jan 31, 2024
1 parent c9a3098 commit 368e54f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/views/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package views

import (
"bytes"
"crypto/sha256"
"encoding/gob"
"strings"
"sync"

"github.com/essentialkaos/branca/v2"
Expand Down Expand Up @@ -58,3 +60,9 @@ func DecodeInputAttrs(encoded string) (InputAttrs, error) {
}
return i, nil
}

func gravatarURL(email string) string {
h := sha256.New()
h.Write([]byte(strings.TrimSpace(strings.ToLower(email))))
return "https://www.gravatar.com/avatar/" + string(h.Sum(nil)) + "?s=80"
}

0 comments on commit 368e54f

Please sign in to comment.