Browse Source

Fix API docs by adding missing attributes and methods, fix example
nginx config by removing overly specific configuration options
that confuse more than they help

Eugen Rochko 7 years ago
parent
commit
8b5d2ba471
2 changed files with 57 additions and 6 deletions
  1. 2 4
      Running-Mastodon/Production-guide.md
  2. 55 2
      Using-the-API/API.md

+ 2 - 4
Running-Mastodon/Production-guide.md

@@ -43,7 +43,6 @@ server {
 
   ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
-  ssl_dhparam         /etc/ssl/certs/dhparam.pem;
 
   keepalive_timeout    70;
   sendfile             on;
@@ -61,7 +60,6 @@ server {
   gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
 
   add_header Strict-Transport-Security "max-age=31536000";
-  add_header Content-Security-Policy "style-src 'self' 'unsafe-inline'; script-src 'self'; object-src 'self'; img-src data: https:; media-src data: https:; connect-src 'self' wss://example.com; upgrade-insecure-requests";
 
   location / {
     try_files $uri @proxy;
@@ -97,7 +95,7 @@ server {
     proxy_set_header X-Forwarded-Proto https;
     proxy_set_header Proxy "";
 
-    proxy_pass http://localhost:4000;
+    proxy_pass http://127.0.0.1:4000;
     proxy_buffering off;
     proxy_redirect off;
     proxy_http_version 1.1;
@@ -123,7 +121,7 @@ It is recommended to create a special user for mastodon on the server (you could
     curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
     sudo apt-get install nodejs
     sudo npm install -g yarn
-    
+
 * **NOTE**: On Debian you have to first add the [Debian Backports](https://backports.debian.org/) repository to install `ffmpeg`.
 
 ### CentOS / RHEL

+ 55 - 2
Using-the-API/API.md

@@ -9,6 +9,7 @@ API overview
   - [Accounts](#accounts)
   - [Apps](#apps)
   - [Blocks](#blocks)
+  - [Domain blocks](#domain-blocks)
   - [Favourites](#favourites)
   - [Follow Requests](#follow-requests)
   - [Follows](#follows)
@@ -90,7 +91,7 @@ Form data:
 | -------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
 | `display_name` | The name to display in the user's profile                                                                                              | yes        |
 | `note`         | A new biography for the user                                                                                                           | yes        |
-| `avatar`       | A base64 encoded image to display as the user's avatar (e.g. `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...`)       | yes        | 
+| `avatar`       | A base64 encoded image to display as the user's avatar (e.g. `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...`)       | yes        |
 | `header`       | A base64 encoded image to display as the user's header image (e.g. `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAADrCAYAAAA...`) | yes        |
 
 #### Getting an account's followers:
@@ -237,6 +238,48 @@ Query parameters:
 
 Returns an array of [Accounts](#account) blocked by the authenticated user.
 
+### Domain blocks
+
+#### Fetching a user's blocked domains:
+
+    GET /api/v1/domain_blocks
+
+Query parameters:
+
+| Field             | Description                                                   | Optional   |
+| ----------------- | ------------------------------------------------------------- | ---------- |
+| `max_id`          | Get a list of blocks with ID less than or equal this value    | yes        |
+| `since_id`        | Get a list of blocks with ID greater than this value          | yes        |
+| `limit`           | Maximum number of blocks to get (Default 40, Max 80)          | yes        |
+
+`max_id` and `since_id` are usually get from the `Link` header.
+
+Returns an array of strings.
+
+#### Blocking a domain
+
+    POST /api/v1/domain_blocks
+
+Parameters:
+
+| Field             | Description                                                         | Optional   |
+| ----------------- | ------------------------------------------------------------------- | ---------- |
+| `domain`          | Domain to block                                                     | no         |
+
+Returns an empty object.
+
+#### Unblocking a domain
+
+    DELETE /api/v1/domain_blocks
+
+Parameters:
+
+| Field             | Description                                                         | Optional   |
+| ----------------- | ------------------------------------------------------------------- | ---------- |
+| `domain`          | Domain to unblock                                                   | no         |
+
+Returns an empty object.
+
 ### Favourites
 
 #### Fetching a user's favourites:
@@ -386,7 +429,7 @@ Returns an empty object.
 
     GET /api/v1/reports
 
-Returns a list of [Reports](#report) made by the authenticated user.
+Returns a list of [Reports](#report) made by the authenticated user. (This method is not entirely implemented and contains no useful information at this point)
 
 #### Reporting a user:
 
@@ -569,6 +612,7 @@ Note: Some attributes in the entity payload can have ``null`` value and are mark
 | `remote_url`             | For remote images, the remote URL of the original image                           | yes      |
 | `preview_url`            | URL of the preview image                                                          | no       |
 | `text_url`               | Shorter URL for the image, for insertion into text (only present on local images) | yes      |
+| `meta`                   | `width`, `height`, `size` (width x height), `aspect` | yes |
 
 ### Card
 
@@ -578,6 +622,14 @@ Note: Some attributes in the entity payload can have ``null`` value and are mark
 | `title`                  | The title of the card                      | no       |
 | `description`            | The card description                       | no       |
 | `image`                  | The image associated with the card, if any | yes      |
+| `type`                   | "link", "photo", "video", or "rich"        | no       |
+| `author_name`            | OEmbed data                                | yes      |
+| `author_url`             | OEmbed data                                | yes      |
+| `provider_name`          | OEmbed data                                | yes      |
+| `provider_url`           | OEmbed data                                | yes      |
+| `html`                   | OEmbed data                                | yes      |
+| `width`                  | OEmbed data                                | yes      |
+| `height`                 | OEmbed data                                | yes      |
 
 ### Context
 
@@ -632,6 +684,7 @@ Note: Some attributes in the entity payload can have ``null`` value and are mark
 | `muting`                 | Whether the user is currently muting the account             | no       |
 | `muting_boosts`          | Whether the user is currently muting boosts from the account | no       |
 | `requested`              | Whether the user has requested to follow the account         | no       |
+| `domain_blocking`        | Whether the user is currently blocking the user's domain     | no       |
 
 ### Report