Changeset 08ab8ad in Klonkt for src/routes
- Timestamp:
- 07/29/2026 11:26:00 AM (6 weeks ago)
- Branches:
- main
- Children:
- 6100ce9
- Parents:
- 6d5ce0c
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r6d5ce0c r08ab8ad 161 161 const playbackAllowed = embedsAllowed 162 162 && Guardianship.externalPlaybackAllowed(auth.site.external_playback, isWard); 163 const items = AP.getTimeline(auth.site.slug, 60).map((t) => ({163 const posts = AP.getTimeline(auth.site.slug, 60).map((t) => ({ 164 164 id: `${t.id}#create`, 165 165 type: 'Create', … … 217 217 }, 218 218 })); 219 // The direct notes addressed to this account: a plain DM, a guardian's wave 220 // (§5), a ward's 🛟 help request (§5.2.1). Those are messages, not posts, so 221 // they are not in the timeline; without them the app's Berichten shows only 222 // what you said yourself. Same shape as a post, so one parser handles both. 223 const me = AP.actorId(base, auth.site.slug); 224 const myHandle = (() => { try { return `@${auth.site.slug}@${new URL(base).host}`; } catch { return `@${auth.site.slug}`; } })(); 225 const messages = AP.getDirectMessages(auth.site.slug, 60).map((m) => ({ 226 id: `${m.object_uri}#create`, 227 type: 'Create', 228 actor: m.actor_uri, 229 published: AP.isoStamp(m.published || m.created_at), 230 object: { 231 id: m.object_uri, 232 type: 'Note', 233 attributedTo: m.actor_uri, 234 content: AP.stripLeadingMentions(m.content), 235 url: m.note_url || undefined, 236 published: AP.isoStamp(m.published || m.created_at), 237 // Addressed to us and to nobody we know of: the other recipients of a 238 // note to several people are not ours to see, so we serve what we know. 239 to: [me], 240 // The Mention is how the client recognises itself as the addressee and 241 // groups the note into a conversation. No FEP-e232 link tags here: a 242 // mention row keeps the resolved quote, not the raw tags. 243 tag: [{ type: 'Mention', href: me, name: myHandle }, ...(AP.timelineEmojis(m.emoji_json) || [])], 244 attachment: AP.timelineAttachments(m.media_json), 245 // FEP-633c: what kind of message this is. The wave is a gentle nudge from 246 // a guardian; the help request is the buoy. Both render differently. 247 'shaer:wave': m.wave ? true : undefined, 248 'shaer:helpRequest': m.help_request ? true : undefined, 249 'shaer:quote': AP.timelineQuote(m.quote_json), 250 'shaer:author': (m.actor_name || m.actor_handle || m.actor_icon) ? { 251 name: m.actor_name || undefined, handle: m.actor_handle || undefined, 252 icon: m.actor_icon || undefined, url: m.actor_url || undefined, 253 emojis: (() => { try { return m.actor_emoji_json ? JSON.parse(m.actor_emoji_json) : undefined; } catch { return undefined; } })(), 254 } : undefined, 255 'shaer:embed': embedsAllowed ? AP.timelineEmbed(m.embed_json, { playback: playbackAllowed }) : undefined, 256 }, 257 })); 258 // Newest first over both, so the app can keep treating this as one feed. 259 const items = [...posts, ...messages].sort((a, b) => String(b.published || '').localeCompare(String(a.published || ''))); 219 260 AP.sendAP(res, { 220 261 '@context': AP.AP_CONTEXT,
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)