logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 073ad7e6d91884f3c972f903d936f029c7a884e6
parent 2fd384e0a28c2e8259ba1afccb2495f4a2399a58
Author: Haelwenn <contact+git.pleroma.social@hacktivis.me>
Date:   Mon, 26 Oct 2020 02:09:20 +0000

Merge branch 'docs/ap_c2s' into 'develop'

AP C2S: Document our additional endpoints

See merge request pleroma/pleroma!3056

Diffstat:

Mdocs/ap_extensions.md34++++++++++++++++++++++++++++++++--
Mlib/pleroma/web/activity_pub/activity_pub_controller.ex13-------------
2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/docs/ap_extensions.md b/docs/ap_extensions.md @@ -1,11 +1,41 @@ -# ChatMessages +# AP Extensions +## Actor endpoints -ChatMessages are the messages sent in 1-on-1 chats. They are similar to +The following endpoints are additionally present into our actors. + +- `oauthRegistrationEndpoint` (`http://litepub.social/ns#oauthRegistrationEndpoint`) +- `uploadMedia` (`https://www.w3.org/ns/activitystreams#uploadMedia`) + +### oauthRegistrationEndpoint + +Points to MastodonAPI `/api/v1/apps` for now. + +See <https://docs.joinmastodon.org/methods/apps/> + +### uploadMedia + +Inspired by <https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload>, it is part of the ActivityStreams namespace because it used to be part of the ActivityPub specification and got removed from it. + +Content-Type: multipart/form-data + +Parameters: +- (required) `file`: The file being uploaded +- (optionnal) `description`: A plain-text description of the media, for accessibility purposes. + +Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id` + +The object given in the reponse should then be inserted into an Object's `attachment` field. + +## ChatMessages + +`ChatMessage`s are the messages sent in 1-on-1 chats. They are similar to `Note`s, but the addresing is done by having a single AP actor in the `to` field. Addressing multiple actors is not allowed. These messages are always private, there is no public version of them. They are created with a `Create` activity. +They are part of the `litepub` namespace as `http://litepub.social/ns#ChatMessage`. + Example: ```json diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -525,19 +525,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do {new_user, for_user} end - @doc """ - Endpoint based on <https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload> - - Parameters: - - (required) `file`: data of the media - - (optionnal) `description`: description of the media, intended for accessibility - - Response: - - HTTP Code: 201 Created - - HTTP Body: ActivityPub object to be inserted into another's `attachment` field - - Note: Will not point to a URL with a `Location` header because no standalone Activity has been created. - """ def upload_media(%{assigns: %{user: %User{} = user}} = conn, %{"file" => file} = data) do with {:ok, object} <- ActivityPub.upload(