Commit 2e48e9af authored by swentel's avatar swentel

Add installation and configuration instructions

parent 2ce29f28
......@@ -9,6 +9,8 @@ The module works with the following federated platforms:
- Mastodon
Open an issue if you have successfully interacted with another platform!
## Features
- Enable ActivityPub per user
......@@ -21,6 +23,65 @@ The module works with the following federated platforms:
- Configure Activity types and properties
- Send posts via drush or cron
## Installation and configuration.
Use composer require drupal/activitypub to get all dependencies:
- Drupal webfinger module
- Drupal nodeinfo module
- landrok/activitypub library
1. Enable Activitypub module
2. Configure permissions:
- 'view user profiles' for anonymous users
- 'allow users to enable activitypub' for authenticated user (or a role)
3. At this point, when a user has enabled activitypub at user
/x/activitypub/settings, they should be discoverable. Try searching for
@handle@domain on Mastodon. If you follow this user, an entry will arrive
in the inbox and an Accept outbox entry will be created automatically
4. Configure global settings at admin/config/services/activitypub to
select how to process those outbox activities. Then either run cron,
configure a crontab for the drush command or manually call it. The
outbox activities will be send then.
5. On admin/config/services/activitypub/activitypub-type you get an overview
of all ActivityPub Type configuration entities. Two are enabled (and locked)
when enabling this module, which are the 'Accept' and 'Delete' types.
6. Create your own configuration
- Select 'Type plugin', only dynamic types are available
- Select the content type which you want to map
- Select the activity (See '1' and '2' underneath)
- Select the object (use Note if you do not want to populate a title)
- Map properties to the content type fields
7. When saved, go to the content type you selected. You can now select the
entity which will process this node in the 'ActivityPub outbox' fieldset.
**important**
1. The 'Send to' fieldset must currently have a value and point to a remote
user. Sending a post to multiple followers is in development and will arrive
soon.
2. Make sure a 'Reply' URL points to the canonical URL. For example,
do not use the URL in your browser for a Mastodon status
- Will work: https://mastodon.social/@swentel/104960564425633436
- Will not work: https://mastodon.social/web/statuses/104960564425633436
Footnotes:
1. Use Create when you want to send regular posts (e.g note, article or reply)
2. 'Announce' usually stands for the 'Boost'/'Retweet' response
## Plugins
ActivityPub types (activities, objects, etc) are managed by plugins. This module
ships with two types of plugins:
- Dynamic types: map content types and properties
- Static types: manages the 'Accept', 'Follow' and 'Undo' activity type.
**Important**: as this module is still alpha, the interface and methods will most
likely change, so be careful when implementing your own plugin. If a change
happens, the release notes of a new release will document those changes.
## Public and Private keys
Public and private keys are saved in private://activitypub/keys.
......@@ -60,3 +121,32 @@ The drush command is activitypub:send-activities
- activitypub:add-to-queue: adds an outbox activity to the queue
- activitypub:delete-activity: send a delete request
- activitypub:webfinger-info: test command to get info about a remote user
## FAQ
### Can I follow users
Technically this would possible with a new plubin, but there's no (decent)
interface to view the incoming posts. In combination with the IndieWeb module,
you can setup a great stack where you can follow content from any source, and
interact with it as well.
### Can I use this together with the IndieWeb module
As mentioned in the previous question, you can use the Microsub module to
follow users and then use your favorite client to read content and interact via
Micropub.
If you are using a Micropub client (or in-built in a Reader), using one or
more syndication targets can help you to create an outbox request. This
requires implementing a hook, for example:
```
```
### Can I send DM's
You can not at this moment, but you should probably just use e-mail :)
Although not tested yet, DM's probably will arrive in the inbox when a remote
user would send one.
......@@ -49,12 +49,12 @@ class DynamicTypes extends TypePluginBase {
*/
public function getProperties($object) {
return [
'published',
'name',
'content',
'object',
'inReplyTo',
'attachment',
'published' => 'Date',
'name' => 'Title',
'content' => 'Content',
//'object',
'inReplyTo' => 'Reply link',
'attachment' => 'Image attachment',
];
}
......@@ -83,7 +83,7 @@ class DynamicTypes extends TypePluginBase {
];
$properties = $this->getProperties($this->getConfiguration()['object']);
foreach ($properties as $property) {
foreach ($properties as $property => $label) {
$form['field_mapping'][] = [
'property' => [
'#type' => 'value',
......@@ -91,7 +91,7 @@ class DynamicTypes extends TypePluginBase {
],
'field_name' => [
'#type' => 'select',
'#title' => $this->t('Property: @property', ['@property' => $property]),
'#title' => $this->t('Property: @property', ['@property' => $label]),
'#options' => $bundle_fields,
'#default_value' => isset($default_mapping[$property]) ? $default_mapping[$property] : '',
],
......
......@@ -293,7 +293,7 @@ class ActivityPubFormAlter implements ActivityPubFormAlterInterface {
$form['activitypub_wrapper']['activitypub_object'] = [
'#type' => 'textfield',
'#title' => 'Owner',
'#title' => $this->t('Send to'),
];
foreach (array_keys($form['actions']) as $action) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment