Changeset 75f2897 in Klonkt for src/routes/activitypub.js
- Timestamp:
- 08/10/2026 07:33:52 AM (4 weeks ago)
- Branches:
- main
- Children:
- aae5881
- Parents:
- 0db3c72
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r0db3c72 r75f2897 195 195 if (audience === 'friend') { 196 196 // The owner's app builds its feed from this leg, and every note here is 197 // by the site itself : give it the same `shaer:author` byline the timeline198 // entries carry, so your own cards get a header too (avatar + name).197 // by the site itself, so give it a byline too (avatar + name): de 198 // ingesloten actor in attributedTo, net als de tijdlijn. 199 199 const me = AP.selfAuthor(baseUrl(req), site); 200 // De kaart op je eigen post (shaer-k3f): dezelfde shaer:quote/shaer:embed201 // die detijdlijn voor andermans posts draagt, uit de snapshots die200 // De kaart op je eigen post (shaer-k3f): dezelfde quote/preview die de 201 // tijdlijn voor andermans posts draagt, uit de snapshots die 202 202 // deliverCreate bij het publiceren opsloeg. Op note-id gekoppeld, want 203 203 // buildOutbox sorteert en mengt tracks erdoorheen. De embed alleen voor de … … 213 213 for (const it of ob.orderedItems) { 214 214 if (it && it.object && typeof it.object === 'object') { 215 it.object['shaer:author'] = me;216 // En de standaardvorm ernaast (shaer-nmw): de ingesloten actor, zodat217 // ook een generieke lezer de byline heeft.218 215 it.object.attributedTo = AP.actorObject( 219 216 (typeof it.object.attributedTo === 'string' ? it.object.attributedTo : undefined) || AP.actorId(baseUrl(req), site.slug), … … 222 219 const row = byNote.get(it.object.id); 223 220 if (row) { 224 it.object['shaer:quote'] = AP.timelineQuote(row.quote_json);225 221 it.object.quote = AP.quoteObject(row.quote_json); 226 222 if (bearerEmbeds) { 227 it.object['shaer:embed'] = AP.timelineEmbed(row.embed_json, { playback: bearerEmbeds.playback });228 223 it.object.preview = AP.previewObject(row.embed_json, { playback: bearerEmbeds.playback }); 229 224 } … … 501 496 return tags.length ? tags : undefined; 502 497 })(), 503 // FEP-044f: the resolved quoted post (author + content), so the client504 // renders an embedded quote card instead of a bare link. Omitted when the505 // note has no quote or the quoted post could not be resolved.506 'shaer:quote': quotesAllowed ? AP.timelineQuote(t.quote_json) : undefined,507 // The post author's display info (name / @handle / avatar), so every card508 // gets a byline header like the quote card. attributedTo stays the bare509 // actor URI; this is the resolved presentation Klonkt already stored.510 'shaer:author': gateAuthor((t.author_name || t.author_handle || t.author_icon) ? {511 name: t.author_name || undefined, handle: t.author_handle || undefined,512 icon: t.author_icon || undefined, url: t.author_url || undefined,513 // FEP-9098: emojis in the display name (":shortcode:"), if any.514 emojis: (() => { try { return t.author_emoji_json ? JSON.parse(t.author_emoji_json) : undefined; } catch { return undefined; } })(),515 } : undefined),516 // When a followed account boosted this, who did ("X boosted"). Omitted for517 // ordinary posts.518 'shaer:booster': gateAuthor((t.reblog_name || t.reblog_handle || t.reblog_icon) ? {519 name: t.reblog_name || undefined, handle: t.reblog_handle || undefined,520 icon: t.reblog_icon || undefined,521 // FEP-9098: emojis in the booster's display name (":shortcode:"), if any.522 emojis: (() => { try { return t.reblog_emoji_json ? JSON.parse(t.reblog_emoji_json) : undefined; } catch { return undefined; } })(),523 } : undefined),524 498 // Whether THIS account already liked/boosted the note, so the app's 525 499 // detail-view buttons show the current state (and can toggle/undo). 526 500 'shaer:liked': !!(reacties.get(t.id) || {}).liked, 527 501 'shaer:boosted': !!(reacties.get(t.id) || {}).boosted, 528 // An external (non-fediverse) embed, thumbnail-only and never an iframe. 529 // Omitted entirely when the gate is closed (see above). 530 // Carries shaer:playerUrl only when the playback gate is open too. 531 'shaer:embed': embedsAllowed ? AP.timelineEmbed(t.embed_json, { playback: playbackAllowed }) : undefined, 532 // De standaardvormen (shaer-nmw): FEP-044f quote als object, AS2 preview 533 // als kaart. Dezelfde poorten als hun shaer:-tegenhangers hierboven. 502 // FEP-044f: de geciteerde post als object, zodat de client een kaart 503 // rendert in plaats van een kale link. AS2 preview is diezelfde kaart 504 // voor een EXTERNE link: thumbnail, nooit de iframe van de aanbieder. 505 // Allebei weg zodra hun poort dicht staat; de speler in preview hangt 506 // aan de playback-poort. 534 507 quote: quotesAllowed ? AP.quoteObject(t.quote_json) : undefined, 535 508 preview: embedsAllowed ? AP.previewObject(t.embed_json, { playback: playbackAllowed }) : undefined, … … 578 551 'shaer:wave': m.wave ? true : undefined, 579 552 'shaer:helpRequest': m.help_request ? true : undefined, 580 'shaer:quote': quotesAllowed ? AP.timelineQuote(m.quote_json) : undefined,581 'shaer:author': gateAuthor((m.actor_name || m.actor_handle || m.actor_icon) ? {582 name: m.actor_name || undefined, handle: m.actor_handle || undefined,583 icon: m.actor_icon || undefined, url: m.actor_url || undefined,584 emojis: (() => { try { return m.actor_emoji_json ? JSON.parse(m.actor_emoji_json) : undefined; } catch { return undefined; } })(),585 } : undefined),586 'shaer:embed': embedsAllowed ? AP.timelineEmbed(m.embed_json, { playback: playbackAllowed }) : undefined,587 553 quote: quotesAllowed ? AP.quoteObject(m.quote_json) : undefined, 588 554 preview: embedsAllowed ? AP.previewObject(m.embed_json, { playback: playbackAllowed }) : undefined, … … 612 578 tag: [{ type: 'Mention', href: me, name: myHandle }, ...(AP.timelineEmojis(m.emoji_json) || [])], 613 579 attachment: AP.timelineAttachments(m.media_json), 614 'shaer:quote': AP.timelineQuote(m.quote_json),615 'shaer:author': (m.actor_name || m.actor_handle || m.actor_icon) ? {616 name: m.actor_name || undefined, handle: m.actor_handle || undefined,617 icon: m.actor_icon || undefined, url: m.actor_url || undefined,618 emojis: (() => { try { return m.actor_emoji_json ? JSON.parse(m.actor_emoji_json) : undefined; } catch { return undefined; } })(),619 } : undefined,620 'shaer:embed': embedsAllowed ? AP.timelineEmbed(m.embed_json, { playback: playbackAllowed }) : undefined,621 580 quote: quotesAllowed ? AP.quoteObject(m.quote_json) : undefined, 622 581 preview: embedsAllowed ? AP.previewObject(m.embed_json, { playback: playbackAllowed }) : undefined, … … 637 596 object: { 638 597 ...n, content: AP.stripLeadingMentions(n.content), 639 'shaer:author': mine,640 598 attributedTo: AP.actorObject(typeof n.attributedTo === 'string' ? n.attributedTo : me, mine), 641 599 }, … … 957 915 AP.sendAP(res, { 958 916 '@context': AP.AP_CONTEXT, 959 'shaer:quote': AP.timelineQuote(uit.quoteJson),960 'shaer:embed': embedsAllowed ? AP.timelineEmbed(uit.embedJson, { playback }) : undefined,961 917 quote: AP.quoteObject(uit.quoteJson), 962 918 preview: embedsAllowed ? AP.previewObject(uit.embedJson, { playback }) : undefined, … … 996 952 attachment: AP.gateAttachments(n.attachment, { images: imagesOk, audio: musicOk }), 997 953 tag: emojiOk ? n.tag : AP.stripEmojiTags(n.tag), 998 'shaer:author': (n['shaer:author'] && !emojiOk) ? { ...n['shaer:author'], emojis: undefined } : n['shaer:author'], 954 // De emoji-poort knipt in de byline zelf: FEP-9098 zit in de tag van de 955 // ingesloten actor, niet meer in een eigen emoji-kaart ernaast. 956 attributedTo: (!emojiOk && n.attributedTo && typeof n.attributedTo === 'object') 957 ? { ...n.attributedTo, tag: undefined } : n.attributedTo, 999 958 })); 1000 959 uit.hidden = kring.hidden;
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)