Serve avatar locally rather than through Libravatar, it'll perform better and doesn't require the image's size to be messed with

This commit is contained in:
Danielle McLean 2017-10-09 23:34:56 +11:00
parent 20470aa852
commit c517baac1c
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
6 changed files with 3 additions and 11 deletions

View file

@ -7,11 +7,6 @@ import Import
import Data.Maybe (fromJust)
import qualified Data.Map as M
import qualified Data.Text as T
import qualified Network.Libravatar as L
libravatar :: (MonadIO m) => User -> m (Maybe Text)
libravatar = liftIO . flip L.avatarUrl opts . L.Email . userEmail
where opts = def { L.optSecure = True, L.optSize = L.Size 512, L.optTryGravatar = False }
entityToTuple :: Entity t -> (Key t, t)
entityToTuple (Entity key value) = (key, value)
@ -30,7 +25,6 @@ routeFromPgp PgpKey { pgpKeyFingerprint = f } = staticR ["pgp", T.takeEnd 8 f ++
hCard :: Entity User -> Widget
hCard (Entity userId user) = do
maybeAvatar <- libravatar user
mcurrentRoute <- getCurrentRoute
userProfiles <- handlerToWidget . runDB $ do
profiles <- map entityVal <$> selectList [ProfileUserId ==. userId] []