Ignore:
Timestamp:
07/20/2026 11:35:45 PM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
562e1b0
Parents:
5143ccf
git-author:
Robin <roboburr@…> (07/20/2026 11:35:44 PM)
git-committer:
Robin <roboburr@…> (07/20/2026 11:35:45 PM)
Message:

Feature: enrichment is opt-in via Prefer (FEP-9876 conformance)

Klonkt is the reference implementation of FEP-9876. The owner
followers/following collections now enrich member representations only
when the client asks with Prefer: return=representation (RFC 7240),
echo Preference-Applied and always set Vary: Prefer; the default is
bare id strings, so the collections match the AP norm and existing
consumers are unaffected. The Prefer predicate is a pure, tested
function.

Changed files:
src/services/ActivityPubService.js

  • prefersEnriched(preferHeader): pure Prefer detector, exported

src/routes/activitypub.js

  • owner followers/following: enrich only on the preference, set Preference-Applied + Vary: Prefer

test/c2s-contacts.test.js

  • prefersEnriched cases

docs/shaer-c2s-api.md

  • document the Prefer opt-in

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r5143ccf r30871c1  
    667667  } catch { /* ignore */ }
    668668  return { name: null, handle: deriveHandle(uri), icon: null };
     669}
     670
     671// FEP-9876: does this `Prefer` header ask for enriched (embedded) members?
     672// Pure and testable; the route sets the response headers around it.
     673export function prefersEnriched(preferHeader) {
     674  return /(^|[,;\s])return=representation($|[,;\s])/i.test(String(preferHeader || ''));
    669675}
    670676
     
    30703076  linkifyBody, bakePostContent, bakePostContentWithMentions, listFollowers, removeFollower, listConnections,
    30713077  noteVisibility, isRejectedObject, rejectInteraction, interactionReportTarget,
    3072   getMessages, notificationsSeenAt, ingestOutboxActivity, c2sVisibility, actorDisplay, buildActorRef,
     3078  getMessages, notificationsSeenAt, ingestOutboxActivity, c2sVisibility, actorDisplay, buildActorRef, prefersEnriched,
    30733079};
Note: See TracChangeset for help on using the changeset viewer.