[Config Change] Various Gravatar-related changes (#467)

* Add config option to enable/disable gravatar

This is useful when running a development instance behind a firewall
or NAT, where gravatar cannot reach you to serve up the default user
avatar.

* Pregenerate Gravatar default image URLs

If possible (i.e. SERVER_NAME is set), we can pregenerate the constant
gravatar default URL once at application startup, and re-use that,
as url_for calls are surprisingly expensive.

Especially on torrent view pages with lots of comments, this cuts down
on url_for calls massively, saving on my system about 0.3 ms per call.
This commit is contained in:
Nicolas F
2018-07-10 07:20:26 +02:00
committed by Arylide
parent e892f358e8
commit 56a670977e
3 changed files with 31 additions and 13 deletions

View File

@@ -152,3 +152,7 @@ ES_INDEX_NAME = SITE_FLAVOR
# Time limit for editing a comment after it has been posted (seconds)
# Set to 0 to disable
EDITING_TIME_LIMIT = 0
# Whether to use Gravatar or just always use the default avatar
# (Useful if run as development instance behind NAT/firewall)
ENABLE_GRAVATAR = True