Changeset 22d2f5a8 in Klonkt


Ignore:
Timestamp:
07/20/2026 07:35:55 AM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
9209cfa
Parents:
520e477
git-author:
Robin <roboburr@…> (07/20/2026 07:31:47 AM)
git-committer:
Robin <roboburr@…> (07/20/2026 07:35:55 AM)
Message:

Feature: "Interact via the fediverse" next to the Share button

A visitor can now reply/like/boost a post from their own fediverse
server straight from the top of the post, next to Share. Reuses the
existing fedi-remote flow (click -> asks for your server -> redirects to
your instance's authorize_interaction for this post's URI). Hidden for
the owner/admin (their own post) and when AP is off. Removed the
now-duplicate CTA that sat lower in the fediverse section, so there is
one prominent place. Dropped the now-unused _postAbsUrl var.

Browser-verified: present in the share row for visitors, absent for the
owner, and the click pops the server-input form targeting the post URI.

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

File:
1 edited

Legend:

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

    r520e477 r22d2f5a8  
    8686  <div class="post-share" style="margin:1.25rem 0;display:flex;align-items:center;gap:.6rem;flex-wrap:wrap">
    8787    <button type="button" class="btn post-share-btn" data-share data-share-title="<%= post.title %>">🔗 <%= t('post.share') %></button>
     88    <%# Interact via the fediverse — for VISITORS (reply/like/boost from their own
     89        server). Same flow as the CTA in the fediverse section; hidden for the
     90        owner/admin (their own post) and when AP is off. %>
     91    <% if (post.status === 'published' && (typeof apEnabled === 'undefined' || apEnabled) && (typeof canManageSite === 'undefined' || !canManageSite)) { %>
     92      <% var _shareAbsUrl = (typeof ogOrigin !== 'undefined' && ogOrigin ? ogOrigin : '') + (typeof _base !== 'undefined' && _base ? _base : '') + '/' + post.slug; %>
     93      <button type="button" class="btn fedi-remote-reply-btn" data-fedi-uri="<%= _shareAbsUrl %>" data-fedi-ph="<%= t('fedi.remote_ph') %>">
     94        <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
     95        <%= t('fedi.remote_interact') %>
     96      </button>
     97    <% } %>
    8898    <span class="post-share-feedback" id="post-share-feedback" style="color:var(--accent);font-size:.85rem" hidden><%= t('post.share_copied') %></span>
    8999  </div>
     
    108118
    109119  <!-- Fediverse interactions — single place: ⭐ like (clickable) + 🔁/💬 counts + reply -->
    110   <% var _postAbsUrl = (typeof ogOrigin !== 'undefined' && ogOrigin ? ogOrigin : '') + (typeof _base !== 'undefined' && _base ? _base : '') + '/' + post.slug; %>
    111120  <% var _fedi = (typeof fediverse !== 'undefined' && fediverse) ? fediverse : { thread: [], likeCount: 0, announceCount: 0 }; %>
    112121  <% if (post.status === 'published' && (typeof apEnabled === 'undefined' || apEnabled)) { %>
     
    134143        </ol>
    135144      <% } %>
    136       <%# "Interact via the fediverse" is for VISITORS (reply from their own server).
    137           The owner/admin has their own controls + it's their post → hide it for them. %>
    138       <% if (typeof canManageSite === 'undefined' || !canManageSite) { %>
    139       <div class="post-fediverse-cta">
    140         <button type="button" class="btn fedi-remote-reply-btn" data-fedi-uri="<%= _postAbsUrl %>" data-fedi-ph="<%= t('fedi.remote_ph') %>">
    141           <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
    142           <%= t('fedi.remote_interact') %>
    143         </button>
    144       </div>
    145       <% } %>
     145      <%# The "Interact via the fediverse" button for visitors now lives next to
     146          the Share button at the top of the post (single, prominent place). %>
    146147    </section>
    147148  <% } %>
Note: See TracChangeset for help on using the changeset viewer.