diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Draw no avatar when luaossl is missing
The require at the top raised as cgit loaded the filter, so every page
that lists an author stopped at its first author cell with an error.
Diffstat (limited to '')
| -rw-r--r-- | custom/extensions/email-libravatar.lua | 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 4 insertions, 3 deletions
diff --git a/custom/extensions/email-libravatar.lua b/custom/extensions/email-libravatar.lua index 1fb979d..2b1fecd 100644 --- a/custom/extensions/email-libravatar.lua +++ b/custom/extensions/email-libravatar.lua @@ -11,7 +11,8 @@ -- The one dependency is luaossl, the OpenSSL binding that provides -- openssl.digest, from <https://github.com/wahern/luaossl>. The reliable -- cross-platform install is LuaRocks, matched to the Lua version cgit is built --- against, and it needs the OpenSSL development headers present. +-- against, and it needs the OpenSSL development headers present. Without it +-- the filter draws no icons and leaves the names as they are. -- -- # Debian and Ubuntu -- sudo apt install luarocks libssl-dev @@ -29,7 +30,7 @@ -- committer's email to a third-party service, so leave this filter off if -- that is not acceptable for your instance. Addresses are hashed with MD5. -local digest = require("openssl.digest") +local has_digest, digest = pcall(require, "openssl.digest") -- The size is in pixels and serves both as the image asked of the service @@ -92,7 +93,7 @@ end function filter_open(email, page) buffer = "" local address = normalize_email(email) - if address == nil then + if address == nil or not has_digest then avatar_hash = nil else avatar_hash = hash_hex(address) |
