Aller au contenu principal

ActivityPub

This service allows you to create an ActivityPub server with data stored in a triple store.

Features#

  • Store activities, actors and objects in the triple store
  • Handle all kind of ontologies (see additionalContext setting)
  • Allow to create actors when new WebIDs are created
  • Currently supported activities:
    • Create
    • Update
    • Delete
    • Follow

Dependencies#

Sub-services#

  • ActivityService
  • ActorService
  • CollectionService
  • FollowService
  • InboxService
  • ObjectService
  • OutboxService

Install#

$ npm install @semapps/activitypub --save

Usage#

const { ActivityPubService } = require('@semapps/activitypub');
module.exports = {
mixins: [ActivityPubService],
settings: {
baseUri: 'http://localhost:3000/',
additionalContext: {
foaf: 'http://xmlns.com/foaf/0.1/'
}
}
};

Configure the LDP containers#

The containers for actors and objects are handled through the LDP service. You need to define containers with ActivityStreams's actors and objects in the acceptedTypes. Alternatively, you can load the default containers from the @semapps/activitypub package as below:

const { LdpService } = require('@semapps/ldp');
const { containers: apContainers } = require('@semapps/activitypub');
module.exports = {
mixins: [LdpService],
settings: {
baseUrl: process.env.SEMAPPS_HOME_URL,
containers: ['/my-container', ...apContainers]
}
};

Queue federation POSTs#

If you want to make sure no data is lost when trying to POST to remote ActivityPub servers, you can set the queueServiceUrl settings.

The Bull task manager will queue the task and you will be able to retry it if it fails.

Create actors on WebID creations#

This is done automatically when a webid.created event is detected.

Settings#

PropertyTypeDefaultDescription
baseUriStringrequiredBase URI of your web server
additionalContextObjectThe ActivityStreams ontology is the base ontology, but you can add more contexts here if you wish.
queueServiceUrlStringRedis connection string. If set, the Bull task manager will be used to handle federation POSTs.