From 0f3ad5a7d9125909e72337b121da58361091d9e2 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 22:07:35 -1000 Subject: Offer avatars at twice the size to dense screens The 13 pixel icon came out blurred on the high density screens most phones and laptops have. --- custom/extensions/email-libravatar.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'custom/extensions/email-libravatar.lua') diff --git a/custom/extensions/email-libravatar.lua b/custom/extensions/email-libravatar.lua index e04c2c2..cc726de 100644 --- a/custom/extensions/email-libravatar.lua +++ b/custom/extensions/email-libravatar.lua @@ -34,10 +34,11 @@ local has_digest, digest = pcall(require, "openssl.digest") --- The size is in pixels and serves both as the image asked of the service --- and as the width and height attributes. The default image is what --- Libravatar draws for an address it has never seen. The endpoint is the --- secure CDN so the icon is not blocked as mixed content on an https page. +-- The size is in pixels and serves both as the image asked of the service and +-- as the width and height attributes, while a screen of double density is +-- offered an image twice the size. The default image is what Libravatar draws +-- for an address it has never seen. The endpoint is the secure CDN so the icon +-- is not blocked as mixed content on an https page. local avatar_size = 13 local default_image = "retro" local base_url = "https://seccdn.libravatar.org/avatar/" @@ -107,6 +108,10 @@ function filter_write(text) buffer = buffer .. text end +local function avatar_url(size) + return base_url .. avatar_hash .. "?s=" .. size .. "&d=" .. default_image +end + -- A log page can carry one icon per commit, so the attributes let the -- browser defer the fetches for icons still off screen and keep decoding -- off the critical path. The icon only decorates the name beside it, so its @@ -115,9 +120,8 @@ function filter_close() if avatar_hash == nil then html(buffer) else - html(" " .. buffer) -- cgit