- Timestamp:
- 06/24/2026 01:58:33 PM (3 months ago)
- Branches:
- main
- Children:
- 5b47619
- Parents:
- ffa53cc
- Location:
- src
- Files:
-
- 3 edited
-
routes/posts.js (modified) (1 diff)
-
services/ActivityPubService.js (modified) (2 diffs)
-
views/partials/fedi-node.ejs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
rffa53cc rc73ac64 806 806 try { 807 807 const _apBase = (process.env.PUBLIC_BASE_URL || `${req.protocol}://${req.get('host')}`).replace(/\/+$/, ''); 808 fediverse = ActivityPubService.getInteractions(post.id, _apBase );808 fediverse = ActivityPubService.getInteractions(post.id, _apBase, site); 809 809 } catch { /* non-fatal */ } 810 810 // Owner/admin of this site may reply back to a fediverse interaction. -
src/services/ActivityPubService.js
rffa53cc rc73ac64 250 250 // View-ready threaded view of a post's fediverse activity (inbound replies + 251 251 // our outbound replies, nested), plus like/boost counts. 252 export function getInteractions(postId, base ) {252 export function getInteractions(postId, base, site) { 253 253 const s = iStmts(); 254 254 const rows = s.list.all(postId); 255 255 const baseClean = (base || process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 256 256 const postNoteId = baseClean ? `${baseClean}/ap/notes/${postId}` : null; 257 // Our own (outbound) replies show the SITE identity for everyone (not "You"). 258 let host = ''; try { host = new URL(baseClean).host; } catch { /* ignore */ } 259 const siteName = (site && (site.title || site.slug)) || ''; 260 const siteHandle = (site && site.slug && host) ? `@${site.slug}@${host}` : ''; 261 const siteUrl = baseClean ? `${baseClean}/` : ''; 262 const siteIcon = (site && site.profile_photo) || null; 257 263 258 264 const nodes = []; … … 269 275 nodes.push({ 270 276 noteId: baseClean ? `${baseClean}/ap/notes/${o.id}` : o.id, parent: o.in_reply_to || null, 271 mine: true, outboxId: o.id, content: o.content, created_at: o.created_at, children: [], 277 mine: true, outboxId: o.id, content: o.content, created_at: o.created_at, 278 actor_name: siteName, actor_handle: siteHandle, actor_url: siteUrl, actor_icon: siteIcon, 279 children: [], 272 280 }); 273 281 } -
src/views/partials/fedi-node.ejs
rffa53cc rc73ac64 1 1 <%# Renders one fediverse thread node (n). Expects: n, t, canManageSite, _base, siteAvatar, formatDateTime %> 2 2 <div class="comment-avatar"> 3 <% if (n.mine) { %> 4 <% if (typeof siteAvatar !== 'undefined' && siteAvatar) { %><img src="<%= siteAvatar %>" alt=""> 5 <% } else { %><span><%= t('fedi.you').charAt(0).toUpperCase() %></span><% } %> 6 <% } else if (n.actor_icon) { %><img src="<%= n.actor_icon %>" alt="" loading="lazy"> 3 <% if (n.actor_icon) { %><img src="<%= n.actor_icon %>" alt="" loading="lazy"> 7 4 <% } else { %><span><%= (n.actor_name || '?').charAt(0).toUpperCase() %></span><% } %> 8 5 </div> 9 6 <div class="comment-body"> 10 7 <div class="comment-meta"> 11 <% if (n.mine) { %> 12 <span class="comment-author"><%= t('fedi.you') %></span> 13 <% } else { %> 14 <a class="comment-author" href="<%= n.actor_url %>" rel="nofollow noopener" target="_blank"><%= n.actor_name %></a> 15 <span class="fedi-handle"><%= n.actor_handle %></span> 16 <% } %> 8 <% if (n.actor_url) { %><a class="comment-author" href="<%= n.actor_url %>" rel="nofollow noopener" target="_blank"><%= n.actor_name %></a> 9 <% } else { %><span class="comment-author"><%= n.actor_name %></span><% } %> 10 <% if (n.actor_handle) { %><span class="fedi-handle"><%= n.actor_handle %></span><% } %> 17 11 <% if (n.created_at) { %><span class="comment-time"><%= formatDateTime(n.created_at) %></span><% } %> 18 12 </div>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)