summaryrefslogtreecommitdiff
path: root/development/cgit/config/email-libravatar-korg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'development/cgit/config/email-libravatar-korg.lua')
-rw-r--r--development/cgit/config/email-libravatar-korg.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/development/cgit/config/email-libravatar-korg.lua b/development/cgit/config/email-libravatar-korg.lua
new file mode 100644
index 0000000000..2d67991d5e
--- /dev/null
+++ b/development/cgit/config/email-libravatar-korg.lua
@@ -0,0 +1,15 @@
+local md5 = require("md5")
+
+function filter_open(email, page)
+ buffer = ""
+ hexdigest = md5.sumhexa(email:sub(2, -2):lower())
+end
+
+function filter_close()
+ html("<span class='libravatar'><img class='inline' src='//seccdn.libravatar.org/avatar/" .. hexdigest .. "?s=13&d=retro' /><img class='onhover' src='//seccdn.libravatar.org/avatar/" .. hexdigest .. "?s=128&d=retro' /></span>" .. buffer)
+ return 0
+end
+
+function filter_write(str)
+ buffer = buffer .. str
+end