Changeset 907a013 in Klonkt


Ignore:
Timestamp:
06/28/2026 09:59:33 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
2e62848
Parents:
d2b7247
Message:

fix(news): blur NSFW media in the News feed

  • views/pages/news.ejs — sensitive (nsfw) posts from followed accounts now wrap their media in .nsfw-media + a click-to-reveal veil, matching posts/grid/Circle. The timeline already carries p.nsfw / p.cw (ap_timeline SELECT *); only the view wasn't blurring.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/news.ejs

    rd2b7247 r907a013  
    3131            var vids = media.filter(function(m){ return m && m.url && m.type && /^video\//.test(m.type); });
    3232            var auds = media.filter(function(m){ return m && m.url && m.type && /^audio\//.test(m.type); });
     33            var _nsfwVisual = !!p.nsfw && (imgs.length || vids.length || auds.length);
    3334          %>
     35          <% if (_nsfwVisual) { %><div class="nsfw-media"><% } %>
    3436          <% if (imgs.length) { %>
    3537            <div class="tl-media">
     
    4143          <% vids.forEach(function(m){ %><video class="tl-media-video" src="<%= m.url %>" controls preload="metadata" playsinline></video><% }); %>
    4244          <% auds.forEach(function(m){ %><audio class="tl-media-audio" src="<%= m.url %>" controls preload="none"></audio><% }); %>
     45          <% if (_nsfwVisual) { %><div class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= p.cw || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></div></div><% } %>
    4346
    4447          <% if (p.embedHtml) { %><div class="tl-embed"><%- p.embedHtml %></div><% } %>
Note: See TracChangeset for help on using the changeset viewer.