Changeset 74c5abc in Klonkt for src/views/partials/fedi-node.ejs


Ignore:
Timestamp:
06/28/2026 04:46:38 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
99989f9
Parents:
f79a471
Message:

feat(images): downscale remote (fediverse) avatars via a signed proxy

Remote avatars live on other servers, so the browser shrank full-res line-art to ~44px
(jagged). Fetch them once (SSRF-safe via safeFetch), downscale identically (lanczos -> WebP),
cache, serve. HMAC-signed proxy URLs → not an open resizer.

  • services/ActivityPubService.js — export safeFetch
  • services/ThumbnailService.js — getRemoteThumbnail + signed imgProxyUrl/verifyImg; +128px size
  • server.js — GET /img/a/:w signed proxy route
  • middleware/render.js — avatar(url,w) helper (local thumb / remote proxy)
  • views: news.ejs, fedi-node.ejs, following.ejs avatars -> avatar()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/partials/fedi-node.ejs

    rf79a471 r74c5abc  
    11<%# Renders one fediverse thread node (n). Expects: n, t, canManageSite, _base, siteAvatar, formatDateTime, postSlug %>
    22<div class="comment-avatar">
    3   <% if (n.actor_icon) { %><img src="<%= n.actor_icon %>" alt="" loading="lazy">
     3  <% if (n.actor_icon) { %><img src="<%= avatar(n.actor_icon, 128) %>" alt="" loading="lazy">
    44  <% } else { %><span><%= (n.actor_name || '?').charAt(0).toUpperCase() %></span><% } %>
    55</div>
Note: See TracChangeset for help on using the changeset viewer.