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:
parent
20470aa852
commit
c517baac1c
6 changed files with 3 additions and 11 deletions
|
@ -3,6 +3,7 @@ User
|
|||
password Text maxlen=79
|
||||
fullName Text maxlen=500
|
||||
email Text maxlen=190
|
||||
avatar Text maxlen=190
|
||||
note Text sqltype=mediumtext
|
||||
UniqueUser username
|
||||
UniqueEmail email
|
||||
|
|
|
@ -51,7 +51,6 @@ dependencies:
|
|||
- conduit-combinators >= 1.1 && <1.2
|
||||
- friendly-time >=0.4 && <0.5
|
||||
- foreign-store >=0.2 && <0.3
|
||||
- libravatar >=0.4 && <0.5
|
||||
- slug >=0.1 && <0.2
|
||||
- split >=0.2 && <0.3
|
||||
- yesod-auth-hashdb >=1.6.2 && <1.7
|
||||
|
|
|
@ -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] []
|
||||
|
|
|
@ -39,8 +39,7 @@ packages:
|
|||
- .
|
||||
# Dependency packages to be pulled from upstream that are not in the resolver
|
||||
# (e.g., acme-missiles-0.3)
|
||||
extra-deps:
|
||||
- libravatar-0.4.0.1
|
||||
extra-deps: []
|
||||
|
||||
# Override default flag values for local packages and extra-deps
|
||||
flags: {}
|
||||
|
|
BIN
static/img/dewdrop wink.png
Normal file
BIN
static/img/dewdrop wink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -2,8 +2,7 @@
|
|||
$maybe route <- mcurrentRoute
|
||||
<a .u-uid.u-url itemprop="url" href=@{route} hidden>
|
||||
|
||||
$maybe avatar <- maybeAvatar
|
||||
<img .card-img-top.u-photo itemprop="image" src=#{avatar} alt="Avatar for #{userFullName user}">
|
||||
<img .card-img-top.u-photo itemprop="image" src=@{staticR ["img", userAvatar user]} alt="Avatar for #{userFullName user}">
|
||||
|
||||
<div .card-body>
|
||||
<h4 .card-title.p-name itemprop="name">#{userFullName user}
|
||||
|
|
Loading…
Reference in a new issue