Changeset 5f3f9ec in Klonkt for src/views/partials/post-card.ejs


Ignore:
Timestamp:
06/30/2026 11:06:00 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
86fa2d2
Parents:
e091add
Message:

fix(cirkel): render a federated video cover as <video>, not a broken <img>

An animated cover that federates as an MP4 (Video attachment) put the video URL into cover_image_url
— circle.js's mediaImage fell back to media[0] even when it was the video — so the Cirkel feed
rendered <img src=...mp4> = a broken image. Now the video is extracted separately (never used as the
cover image) and post-tile/post-card render a muted looping <video> for a video-only cover.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/partials/post-card.ejs

    re091add r5f3f9ec  
    1616const _ext       = !!_external;
    1717const _src       = post.source_name || '';
    18 const _hasCover  = !!post.cover_image_url;
     18const _hasCover  = !!post.cover_image_url || !!post.cover_video_url;
    1919const _typeLabel = (post.type && post.type !== 'overig' && post.type !== 'post') ? post.type : '';
    2020const _isPinned  = !!post.pinned;
     
    4949       <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"<% } %>
    5050       aria-label="<%= post.title || '(zonder titel)' %>" tabindex="-1">
    51       <img src="<%= thumb(post.cover_image_url, 480) %>"
     51      <% if (post.cover_image_url) { %><img src="<%= thumb(post.cover_image_url, 480) %>"
    5252           srcset="<%= thumb(post.cover_image_url, 320) %> 320w, <%= thumb(post.cover_image_url, 640) %> 640w, <%= thumb(post.cover_image_url, 1280) %> 1280w"
    5353           sizes="(min-width: 768px) 120px, 100vw"
    5454           alt="" loading="lazy" decoding="async"<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>>
     55      <% } else if (post.cover_video_url) { %><video src="<%= post.cover_video_url %>" autoplay loop muted playsinline></video><% } %>
    5556      <% if (post.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= post.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %>
    5657    </a>
Note: See TracChangeset for help on using the changeset viewer.