7d2956d6d877d3b04fa24165320fa5874ff8dec1
[akkoma] / docs / ap_extensions.md
1 # AP Extensions
2 ## Actor endpoints
3
4 The following endpoints are additionally present into our actors.
5
6 - `oauthRegistrationEndpoint`
7 - `uploadMedia`
8
9 ### uploadMedia
10
11 Inspired by <https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload>
12
13 Content-Type: multipart/form-data
14
15 Parameters:
16 - (required) `file`: The file being uploaded
17 - (optionnal) `description`: A plain-text description of the media, for accessibility purposes.
18
19 Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id`
20
21 The object given in the reponse should then be inserted into an Object's `attachment` field.
22
23 ## ChatMessages
24
25 ChatMessages are the messages sent in 1-on-1 chats. They are similar to
26 `Note`s, but the addresing is done by having a single AP actor in the `to`
27 field. Addressing multiple actors is not allowed. These messages are always
28 private, there is no public version of them. They are created with a `Create`
29 activity.
30
31 Example:
32
33 ```json
34 {
35 "actor": "http://2hu.gensokyo/users/raymoo",
36 "id": "http://2hu.gensokyo/objects/1",
37 "object": {
38 "attributedTo": "http://2hu.gensokyo/users/raymoo",
39 "content": "You expected a cute girl? Too bad.",
40 "id": "http://2hu.gensokyo/objects/2",
41 "published": "2020-02-12T14:08:20Z",
42 "to": [
43 "http://2hu.gensokyo/users/marisa"
44 ],
45 "type": "ChatMessage"
46 },
47 "published": "2018-02-12T14:08:20Z",
48 "to": [
49 "http://2hu.gensokyo/users/marisa"
50 ],
51 "type": "Create"
52 }
53 ```
54
55 This setup does not prevent multi-user chats, but these will have to go through
56 a `Group`, which will be the recipient of the messages and then `Announce` them
57 to the users in the `Group`.