Changeset d3b9f68 in Klonkt for src/routes/activitypub.js


Ignore:
Timestamp:
06/30/2026 02:38:47 AM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
432831c
Parents:
e0a1ec1
Message:

feat(federation): full JSON-LD @context on all AP objects (valid AS2)

Every object now carries a complete @context (AS2 + security/v1 + term definitions for the
Mastodon/toot + schema.org extensions we emit: sensitive, Hashtag, manuallyApprovesFollowers,
discoverable, featured, PropertyValue, embedUrl). Previously these were emitted under only the
bare AS2 context, so a strict JSON-LD processor dropped them — Mastodon tolerated it but it
wasn't valid AS2/JSON-LD. It is the same context shape Mastodon publishes, so Mastodon sees no
change while strict consumers now resolve every term.

  • src/services/ActivityPubService.js — shared AP_CONTEXT on every object/activity; removed the now-dead local AS2 string const
  • src/routes/activitypub.js — served objects (note/replies/notes route) use AP.AP_CONTEXT

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/activitypub.js

    re0a1ec1 rd3b9f68  
    132132      return res.redirect(302, src);
    133133    }
    134     return AP.sendAP(res, { '@context': 'https://www.w3.org/ns/activitystreams', ...note });
     134    return AP.sendAP(res, { '@context': AP.AP_CONTEXT, ...note });
    135135  }
    136136  const site = db.prepare('SELECT * FROM sites WHERE id = ?').get(post.site_id);
     
    142142    return res.redirect(302, note.url || (baseUrl(req) + '/'));
    143143  }
    144   AP.sendAP(res, { '@context': 'https://www.w3.org/ns/activitystreams', ...note });
     144  AP.sendAP(res, { '@context': AP.AP_CONTEXT, ...note });
    145145});
    146146
     
    150150  const items = AP.getReplyUris(base, req.params.id);
    151151  AP.sendAP(res, {
    152     '@context': 'https://www.w3.org/ns/activitystreams',
     152    '@context': AP.AP_CONTEXT,
    153153    id: `${base}/ap/notes/${req.params.id}/replies`,
    154154    type: 'OrderedCollection',
Note: See TracChangeset for help on using the changeset viewer.