diff --git a/content/en/spec/activitypub.md b/content/en/spec/activitypub.md index f8ff7feb..5ab4dcf0 100644 --- a/content/en/spec/activitypub.md +++ b/content/en/spec/activitypub.md @@ -7,10 +7,6 @@ menu: parent: spec --- -{{< hint style="warning" >}} -Sample payloads will be added at a future date. -{{< /hint >}} - ## Status federation {#status} {{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/lib/activitypub/activity.rb" caption="app/lib/activitypub/activity.rb" >}} @@ -29,21 +25,21 @@ Like Announce : Transformed into a boost on a status -Flag -: Transformed into a report to the moderation team. - Update -: Refresh vote count on polls. As of Mastodon 3.5.0, can be used to edit statuses when the `updated` timestamp is present. +: Refresh vote count on polls. As of Mastodon 3.5.0: edit statuses when the `updated` timestamp is present. Undo : Undo a previous Like or Announce. +Flag +: Transformed into a report to the moderation team. See the [Reports](#Flag) extension for more information. + ### Payloads The first-class Object types supported by Mastodon are `Note` and `Question`. - Notes are transformed into regular statuses. -- Questions are transformed into a poll status. +- Questions are transformed into a poll status. See the [Polls](#Question) extension for more information. Some other Object types are converted as best as possible: @@ -56,6 +52,64 @@ Some other Object types are converted as best as possible: The transformer uses `content` if available, or `name` if not, in order to generate status text. The `url` will be appended. The `summary` property will be used as the CW text. The `icon` will be used as a thumbnail. +### HTML sanitization {#sanitization} + +{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/lib/sanitize_ext/sanitize_config.rb" caption="lib/sanitize_ext/sanitize_config.rb" >}} + +Mastodon sanitizes incoming HTML in order to not break assumptions for API client developers. Supported elements will be kept as-is, and unsupported elements will be converted or removed. Supported attributes will be kept, and all other attributes will be stripped. The following elements and attributes are supported: + +- `

` +- `` (`class`) +- `
` +- `` (`href`, `rel`, `class`) +- lists will be converted to `

`, and list items will be separated with `
` + +Since Mastodon v4.2, the following elements and attributes are supported: + +- `

` +- `` (`class`) +- `
` +- `
` (`href`, `rel`, `class`) +- `` +- `

`
+- ``
+- ``
+- ``
+- ``
+- ``
+- ``
+- `