Merge branch 'develop' into 'fix/2412-filters'

# Conflicts:
#   CHANGELOG.md
This commit is contained in:
feld 2021-02-03 14:23:23 +00:00
commit 008499f65a
245 changed files with 1803 additions and 791 deletions

View file

@ -34,6 +34,14 @@ build:
- mix deps.get - mix deps.get
- mix compile --force - mix compile --force
spec-build:
stage: test
artifacts:
paths:
- spec.json
script:
- mix pleroma.openapi_spec spec.json
benchmark: benchmark:
stage: benchmark stage: benchmark
when: manual when: manual
@ -155,6 +163,20 @@ review_app:
- (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
- git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
spec-deploy:
stage: deploy
artifacts:
paths:
- spec.json
only:
- develop@pleroma/pleroma
image: alpine:latest
before_script:
- apk add curl
script:
- curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline
stop_review_app: stop_review_app:
image: alpine:3.9 image: alpine:3.9
stage: deploy stage: deploy

View file

@ -10,17 +10,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` - **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
- **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate/deactivate` - **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate/deactivate`
- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved`
- **Breaking**: AdminAPI changed User field `deactivated` to `is_active`
- Polls now always return a `voters_count`, even if they are single-choice. - Polls now always return a `voters_count`, even if they are single-choice.
- Admin Emails: The ap id is used as the user link in emails now. - Admin Emails: The ap id is used as the user link in emails now.
- Improved registration workflow for email confirmation and account approval modes. - Improved registration workflow for email confirmation and account approval modes.
- Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries. - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries.
- Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators.
- Admin API: Reports now ordered by newest
- Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders.
- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script
- Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address.
<details>
<summary>API Changes</summary>
- **Breaking:** AdminAPI changed User field `confirmation_pending` to `is_confirmed`
- **Breaking:** AdminAPI changed User field `approval_pending` to `is_approved`
- **Breaking**: AdminAPI changed User field `deactivated` to `is_active`
- **Breaking:** AdminAPI `GET /api/pleroma/admin/users/:nickname_or_id/statuses` changed response format and added the number of total users posts.
- **Breaking:** AdminAPI `GET /api/pleroma/admin/instances/:instance/statuses` changed response format and added the number of total users posts.
- Admin API: Reports now ordered by newest
</details>
### Added ### Added
@ -38,7 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc. - OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc.
- Ability to set ActivityPub aliases for follower migration. - Ability to set ActivityPub aliases for follower migration.
- Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy - Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy
- Ability to define custom HTTP headers per each frontend
<details> <details>
<summary>API Changes</summary> <summary>API Changes</summary>
@ -48,7 +57,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute. - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute.
- Admin API: An endpoint to manage frontends. - Admin API: An endpoint to manage frontends.
- Streaming API: Add follow relationships updates. - Streaming API: Add follow relationships updates.
- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types - WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types.
- Mastodon API: Add monthly active users to `/api/v1/instance` (`pleroma.stats.mau`).
- Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `remote` & `local` parameters for filtration.
- Mastodon API: `/api/v1/accounts/:id` & `/api/v1/mutes` endpoints accept `with_relationships` parameter and return filled `pleroma.relationship` field.
</details> </details>
### Fixed ### Fixed
@ -58,12 +70,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Creating incorrect IPv4 address-style HTTP links when encountering certain numbers. - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers.
- Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private. - Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private.
- Tag URLs in statuses are now absolute - Tag URLs in statuses are now absolute
- Removed duplicate jobs to purge expired activities
- File extensions of some attachments were incorrectly changed. This feature has been disabled for now.
- Mix task pleroma.instance creates missing parent directories if the configuration or SQL output paths are changed.
<details> <details>
<summary>API Changes</summary> <summary>API Changes</summary>
- Mastodon API: Current user is now included in conversation if it's the only participant. - Mastodon API: Current user is now included in conversation if it's the only participant.
- Mastodon API: Fixed last_status.account being not filled with account data. - Mastodon API: Fixed last_status.account being not filled with account data.
- Mastodon API: Fix not being able to add or remove multiple users at once in lists.
- Mastodon API: Fixed own_votes being not returned with poll data. - Mastodon API: Fixed own_votes being not returned with poll data.
- Mastodon API: Fixed creation of scheduled posts with polls.
- Mastodon API: Support for expires_in/expires_at in the Filters. - Mastodon API: Support for expires_in/expires_at in the Filters.
</details> </details>

View file

@ -726,7 +726,10 @@
"git" => "https://git.pleroma.social/pleroma/fedi-fe", "git" => "https://git.pleroma.social/pleroma/fedi-fe",
"build_url" => "build_url" =>
"https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build", "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
"ref" => "master" "ref" => "master",
"custom-http-headers" => [
{"service-worker-allowed", "/"}
]
}, },
"admin-fe" => %{ "admin-fe" => %{
"name" => "admin-fe", "name" => "admin-fe",

View file

@ -60,6 +60,12 @@
label: "Build directory", label: "Build directory",
type: :string, type: :string,
description: "The directory inside the zip file " description: "The directory inside the zip file "
},
%{
key: "custom-http-headers",
label: "Custom HTTP headers",
type: {:list, :string},
description: "The custom HTTP headers for the frontend"
} }
] ]
@ -3218,6 +3224,12 @@
type: :string, type: :string,
description: "S3 host", description: "S3 host",
suggestions: ["s3.eu-central-1.amazonaws.com"] suggestions: ["s3.eu-central-1.amazonaws.com"]
},
%{
key: :region,
type: :string,
description: "S3 region (for AWS)",
suggestions: ["us-east-1"]
} }
] ]
}, },

View file

@ -0,0 +1 @@
See `Authentication` section of [the configuration cheatsheet](../configuration/cheatsheet.md#authentication).

View file

@ -893,6 +893,22 @@ Pleroma account will be created with the same name as the LDAP user name.
Note, if your LDAP server is an Active Directory server the correct value is commonly `uid: "cn"`, but if you use an Note, if your LDAP server is an Active Directory server the correct value is commonly `uid: "cn"`, but if you use an
OpenLDAP server the value may be `uid: "uid"`. OpenLDAP server the value may be `uid: "uid"`.
### :oauth2 (Pleroma as OAuth 2.0 provider settings)
OAuth 2.0 provider settings:
* `token_expires_in` - The lifetime in seconds of the access token.
* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token.
* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`.
OAuth 2.0 provider and related endpoints:
* `POST /api/v1/apps` creates client app basing on provided params.
* `GET/POST /oauth/authorize` renders/submits authorization form.
* `POST /oauth/token` creates/renews OAuth token.
* `POST /oauth/revoke` revokes provided OAuth token.
* `GET /api/v1/accounts/verify_credentials` (with proper `Authorization` header or `access_token` URI param) returns user info on requester (with `acct` field containing local nickname and `fqn` field containing fully-qualified nickname which could generally be used as email stub for OAuth software that demands email field in identity endpoint response, like Peertube).
### OAuth consumer mode ### OAuth consumer mode
OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.). OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.).
@ -965,14 +981,6 @@ config :ueberauth, Ueberauth,
] ]
``` ```
### OAuth 2.0 provider - :oauth2
Configure OAuth 2 provider capabilities:
* `token_expires_in` - The lifetime in seconds of the access token.
* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token.
* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`.
## Link parsing ## Link parsing
### :uri_schemes ### :uri_schemes

View file

@ -287,7 +287,18 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
- *optional* `with_reblogs`: `true`/`false` allows to see reblogs (default is false) - *optional* `with_reblogs`: `true`/`false` allows to see reblogs (default is false)
- Response: - Response:
- On failure: `Not found` - On failure: `Not found`
- On success: JSON array of user's latest statuses - On success: JSON, where:
- `total`: total count of the statuses for the user
- `activities`: list of the statuses for the user
```json
{
"total" : 1,
"activities": [
// activities list
]
}
```
## `GET /api/pleroma/admin/instances/:instance/statuses` ## `GET /api/pleroma/admin/instances/:instance/statuses`
@ -300,7 +311,18 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
- *optional* `with_reblogs`: `true`/`false` allows to see reblogs (default is false) - *optional* `with_reblogs`: `true`/`false` allows to see reblogs (default is false)
- Response: - Response:
- On failure: `Not found` - On failure: `Not found`
- On success: JSON array of instance's latest statuses - On success: JSON, where:
- `total`: total count of the statuses for the instance
- `activities`: list of the statuses for the instance
```json
{
"total" : 1,
"activities": [
// activities list
]
}
```
## `GET /api/pleroma/admin/statuses` ## `GET /api/pleroma/admin/statuses`

View file

@ -16,6 +16,12 @@ Adding the parameter `reply_visibility` to the public and home timelines queries
Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance). Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance).
Home, public, hashtag & list timelines accept these parameters:
- `only_media`: show only statuses with media attached
- `local`: show only local statuses
- `remote`: show only remote statuses
## Statuses ## Statuses
- `visibility`: has additional possible values `list` and `local` (for local-only statuses) - `visibility`: has additional possible values `list` and `local` (for local-only statuses)
@ -54,6 +60,23 @@ The `id` parameter can also be the `nickname` of the user. This only works in th
- `/api/v1/accounts/:id` - `/api/v1/accounts/:id`
- `/api/v1/accounts/:id/statuses` - `/api/v1/accounts/:id/statuses`
`/api/v1/accounts/:id/statuses` endpoint accepts these parameters:
- `pinned`: include only pinned statuses
- `tagged`: with tag
- `only_media`: include only statuses with media attached
- `with_muted`: include statuses/reactions from muted accounts
- `exclude_reblogs`: exclude reblogs
- `exclude_replies`: exclude replies
- `exclude_visibilities`: exclude visibilities
Endpoints which accept `with_relationships` parameter:
- `/api/v1/accounts/:id`
- `/api/v1/accounts/:id/followers`
- `/api/v1/accounts/:id/following`
- `/api/v1/mutes`
Has these additional fields under the `pleroma` object: Has these additional fields under the `pleroma` object:
- `ap_id`: nullable URL string, ActivityPub id of the user - `ap_id`: nullable URL string, ActivityPub id of the user

View file

@ -242,6 +242,13 @@ def run(["gen" | rest]) do
rum_enabled: rum_enabled rum_enabled: rum_enabled
) )
config_dir = Path.dirname(config_path)
psql_dir = Path.dirname(psql_path)
[config_dir, psql_dir, static_dir, uploads_dir]
|> Enum.reject(&File.exists?/1)
|> Enum.map(&File.mkdir_p!/1)
shell_info("Writing config to #{config_path}.") shell_info("Writing config to #{config_path}.")
File.write(config_path, result_config) File.write(config_path, result_config)
@ -275,10 +282,6 @@ defp write_robots_txt(static_dir, indexable, template_dir) do
indexable: indexable indexable: indexable
) )
unless File.exists?(static_dir) do
File.mkdir_p!(static_dir)
end
robots_txt_path = Path.join(static_dir, "robots.txt") robots_txt_path = Path.join(static_dir, "robots.txt")
if File.exists?(robots_txt_path) do if File.exists?(robots_txt_path) do

View file

@ -0,0 +1,6 @@
defmodule Mix.Tasks.Pleroma.OpenapiSpec do
def run([path]) do
spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!()
File.write(path, spec)
end
end

View file

@ -113,11 +113,15 @@ def create(title, %User{} = creator) do
end end
end end
def follow(%Pleroma.List{following: following} = list, %User{} = followed) do def follow(%Pleroma.List{id: id}, %User{} = followed) do
list = Repo.get(Pleroma.List, id)
%{following: following} = list
update_follows(list, %{following: Enum.uniq([followed.follower_address | following])}) update_follows(list, %{following: Enum.uniq([followed.follower_address | following])})
end end
def unfollow(%Pleroma.List{following: following} = list, %User{} = unfollowed) do def unfollow(%Pleroma.List{id: id}, %User{} = unfollowed) do
list = Repo.get(Pleroma.List, id)
%{following: following} = list
update_follows(list, %{following: List.delete(following, unfollowed.follower_address)}) update_follows(list, %{following: List.delete(following, unfollowed.follower_address)})
end end

View file

@ -146,6 +146,7 @@ defmodule Pleroma.User do
field(:inbox, :string) field(:inbox, :string)
field(:shared_inbox, :string) field(:shared_inbox, :string)
field(:accepts_chat_messages, :boolean, default: nil) field(:accepts_chat_messages, :boolean, default: nil)
field(:last_active_at, :naive_datetime)
embeds_one( embeds_one(
:notification_settings, :notification_settings,
@ -2030,6 +2031,15 @@ def local_nickname(nickname_or_mention) do
|> hd() |> hd()
end end
def full_nickname(%User{} = user) do
if String.contains?(user.nickname, "@") do
user.nickname
else
%{host: host} = URI.parse(user.ap_id)
user.nickname <> "@" <> host
end
end
def full_nickname(nickname_or_mention), def full_nickname(nickname_or_mention),
do: String.trim_leading(nickname_or_mention, "@") do: String.trim_leading(nickname_or_mention, "@")
@ -2444,4 +2454,19 @@ def sanitize_html(%User{} = user, filter) do
def get_host(%User{ap_id: ap_id} = _user) do def get_host(%User{ap_id: ap_id} = _user) do
URI.parse(ap_id).host URI.parse(ap_id).host
end end
def update_last_active_at(%__MODULE__{local: true} = user) do
user
|> cast(%{last_active_at: NaiveDateTime.utc_now()}, [:last_active_at])
|> update_and_set_cache()
end
def active_user_count(weeks \\ 4) do
active_after = Timex.shift(NaiveDateTime.utc_now(), weeks: -weeks)
__MODULE__
|> where([u], u.last_active_at >= ^active_after)
|> where([u], u.local == true)
|> Repo.aggregate(:count)
end
end end

View file

@ -591,7 +591,21 @@ def fetch_user_abstract_activities(user, reading_user, params \\ %{}) do
|> Enum.reverse() |> Enum.reverse()
end end
def fetch_user_activities(user, reading_user, params \\ %{}) do def fetch_user_activities(user, reading_user, params \\ %{})
def fetch_user_activities(user, reading_user, %{total: true} = params) do
result = fetch_activities_for_user(user, reading_user, params)
Keyword.put(result, :items, Enum.reverse(result[:items]))
end
def fetch_user_activities(user, reading_user, params) do
user
|> fetch_activities_for_user(reading_user, params)
|> Enum.reverse()
end
defp fetch_activities_for_user(user, reading_user, params) do
params = params =
params params
|> Map.put(:type, ["Create", "Announce"]) |> Map.put(:type, ["Create", "Announce"])
@ -616,10 +630,20 @@ def fetch_user_activities(user, reading_user, params \\ %{}) do
} }
|> user_activities_recipients() |> user_activities_recipients()
|> fetch_activities(params, pagination_type) |> fetch_activities(params, pagination_type)
|> Enum.reverse() end
def fetch_statuses(reading_user, %{total: true} = params) do
result = fetch_activities_for_reading_user(reading_user, params)
Keyword.put(result, :items, Enum.reverse(result[:items]))
end end
def fetch_statuses(reading_user, params) do def fetch_statuses(reading_user, params) do
reading_user
|> fetch_activities_for_reading_user(params)
|> Enum.reverse()
end
defp fetch_activities_for_reading_user(reading_user, params) do
params = Map.put(params, :type, ["Create", "Announce"]) params = Map.put(params, :type, ["Create", "Announce"])
%{ %{
@ -628,7 +652,6 @@ def fetch_statuses(reading_user, params) do
} }
|> user_activities_recipients() |> user_activities_recipients()
|> fetch_activities(params, :offset) |> fetch_activities(params, :offset)
|> Enum.reverse()
end end
defp user_activities_recipients(%{godmode: true}), do: [] defp user_activities_recipients(%{godmode: true}), do: []
@ -735,6 +758,12 @@ defp restrict_local(query, %{local_only: true}) do
defp restrict_local(query, _), do: query defp restrict_local(query, _), do: query
defp restrict_remote(query, %{remote: true}) do
from(activity in query, where: activity.local == false)
end
defp restrict_remote(query, _), do: query
defp restrict_actor(query, %{actor_id: actor_id}) do defp restrict_actor(query, %{actor_id: actor_id}) do
from(activity in query, where: activity.actor == ^actor_id) from(activity in query, where: activity.actor == ^actor_id)
end end
@ -1111,6 +1140,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do
|> restrict_tag_all(opts) |> restrict_tag_all(opts)
|> restrict_since(opts) |> restrict_since(opts)
|> restrict_local(opts) |> restrict_local(opts)
|> restrict_remote(opts)
|> restrict_actor(opts) |> restrict_actor(opts)
|> restrict_type(opts) |> restrict_type(opts)
|> restrict_state(opts) |> restrict_state(opts)

View file

@ -85,17 +85,18 @@ def list_instance_statuses(conn, %{"instance" => instance} = params) do
with_reblogs = params["with_reblogs"] == "true" || params["with_reblogs"] == true with_reblogs = params["with_reblogs"] == "true" || params["with_reblogs"] == true
{page, page_size} = page_params(params) {page, page_size} = page_params(params)
activities = result =
ActivityPub.fetch_statuses(nil, %{ ActivityPub.fetch_statuses(nil, %{
instance: instance, instance: instance,
limit: page_size, limit: page_size,
offset: (page - 1) * page_size, offset: (page - 1) * page_size,
exclude_reblogs: not with_reblogs exclude_reblogs: not with_reblogs,
total: true
}) })
conn conn
|> put_view(AdminAPI.StatusView) |> put_view(AdminAPI.StatusView)
|> render("index.json", %{activities: activities, as: :activity}) |> render("index.json", %{total: result[:total], activities: result[:items], as: :activity})
end end
def list_user_statuses(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname} = params) do def list_user_statuses(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname} = params) do
@ -105,18 +106,19 @@ def list_user_statuses(%{assigns: %{user: admin}} = conn, %{"nickname" => nickna
with %User{} = user <- User.get_cached_by_nickname_or_id(nickname, for: admin) do with %User{} = user <- User.get_cached_by_nickname_or_id(nickname, for: admin) do
{page, page_size} = page_params(params) {page, page_size} = page_params(params)
activities = result =
ActivityPub.fetch_user_activities(user, nil, %{ ActivityPub.fetch_user_activities(user, nil, %{
limit: page_size, limit: page_size,
offset: (page - 1) * page_size, offset: (page - 1) * page_size,
godmode: godmode, godmode: godmode,
exclude_reblogs: not with_reblogs, exclude_reblogs: not with_reblogs,
pagination_type: :offset pagination_type: :offset,
total: true
}) })
conn conn
|> put_view(AdminAPI.StatusView) |> put_view(AdminAPI.StatusView)
|> render("index.json", %{activities: activities, as: :activity}) |> render("index.json", %{total: result[:total], activities: result[:items], as: :activity})
else else
_ -> {:error, :not_found} _ -> {:error, :not_found}
end end

View file

@ -13,6 +13,10 @@ defmodule Pleroma.Web.AdminAPI.StatusView do
defdelegate merge_account_views(user), to: AdminAPI.AccountView defdelegate merge_account_views(user), to: AdminAPI.AccountView
def render("index.json", %{total: total} = opts) do
%{total: total, activities: safe_render_many(opts.activities, __MODULE__, "show.json", opts)}
end
def render("index.json", opts) do def render("index.json", opts) do
safe_render_many(opts.activities, __MODULE__, "show.json", opts) safe_render_many(opts.activities, __MODULE__, "show.json", opts)
end end

View file

@ -11,10 +11,10 @@ defmodule Pleroma.Web.ApiSpec do
@behaviour OpenApi @behaviour OpenApi
@impl OpenApi @impl OpenApi
def spec do def spec(opts \\ []) do
%OpenApi{ %OpenApi{
servers: servers:
if Phoenix.Endpoint.server?(:pleroma, Endpoint) do if opts[:server_specific] do
[ [
# Populate the Server info from a phoenix endpoint # Populate the Server info from a phoenix endpoint
OpenApiSpex.Server.from_endpoint(Endpoint) OpenApiSpex.Server.from_endpoint(Endpoint)
@ -23,9 +23,25 @@ def spec do
[] []
end, end,
info: %OpenApiSpex.Info{ info: %OpenApiSpex.Info{
title: "Pleroma", title: "Pleroma API",
description: Application.spec(:pleroma, :description) |> to_string(), description: """
version: Application.spec(:pleroma, :vsn) |> to_string() This is documentation for client Pleroma API. Most of the endpoints and entities come
from Mastodon API and have custom extensions on top.
While this document aims to be a complete guide to the client API Pleroma exposes,
the details are still being worked out. Some endpoints may have incomplete or poorly worded documentation.
You might want to check the following resources if something is not clear:
- [Legacy Pleroma-specific endpoint documentation](https://docs-develop.pleroma.social/backend/development/API/pleroma_api/)
- [Mastodon API documentation](https://docs.joinmastodon.org/client/intro/)
- [Differences in Mastodon API responses from vanilla Mastodon](https://docs-develop.pleroma.social/backend/development/API/differences_in_mastoapi_responses/)
Please report such occurences on our [issue tracker](https://git.pleroma.social/pleroma/pleroma/-/issues). Feel free to submit API questions or proposals there too!
""",
version: Application.spec(:pleroma, :vsn) |> to_string(),
extensions: %{
# Logo path should be picked so that the path exists both on Pleroma instances and on api.pleroma.social
"x-logo": %{"url" => "/static/logo.svg", "altText" => "Pleroma logo"}
}
}, },
# populate the paths from a phoenix router # populate the paths from a phoenix router
paths: OpenApiSpex.Paths.from_router(Router), paths: OpenApiSpex.Paths.from_router(Router),
@ -45,15 +61,73 @@ def spec do
authorizationUrl: "/oauth/authorize", authorizationUrl: "/oauth/authorize",
tokenUrl: "/oauth/token", tokenUrl: "/oauth/token",
scopes: %{ scopes: %{
"read" => "read", # TODO: Document granular scopes
"write" => "write", "read" => "Read everything",
"follow" => "follow", "write" => "Write everything",
"push" => "push" "follow" => "Manage relationships",
"push" => "Web Push API subscriptions"
} }
} }
} }
} }
} }
},
extensions: %{
# Redoc-specific extension, every time a new tag is added it should be reflected here,
# otherwise it won't be shown.
"x-tagGroups": [
%{
"name" => "Accounts",
"tags" => ["Account actions", "Retrieve account information", "Scrobbles"]
},
%{
"name" => "Administration",
"tags" => [
"Chat administration",
"Emoji packs",
"Frontend managment",
"Instance configuration",
"Instance documents",
"Invites",
"MediaProxy cache",
"OAuth application managment",
"Report managment",
"Relays",
"Status administration"
]
},
%{"name" => "Applications", "tags" => ["Applications", "Push subscriptions"]},
%{
"name" => "Current account",
"tags" => [
"Account credentials",
"Backups",
"Blocks and mutes",
"Data import",
"Domain blocks",
"Follow requests",
"Mascot",
"Markers",
"Notifications"
]
},
%{"name" => "Instance", "tags" => ["Custom emojis"]},
%{"name" => "Messaging", "tags" => ["Chats", "Conversations"]},
%{
"name" => "Statuses",
"tags" => [
"Emoji reactions",
"Lists",
"Polls",
"Timelines",
"Retrieve status information",
"Scheduled statuses",
"Search",
"Status actions"
]
},
%{"name" => "Miscellaneous", "tags" => ["Reports", "Suggestions"]}
]
} }
} }
# discover request/response schemas from path specs # discover request/response schemas from path specs

View file

@ -26,7 +26,7 @@ def open_api_operation(action) do
@spec create_operation() :: Operation.t() @spec create_operation() :: Operation.t()
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account credentials"],
summary: "Register an account", summary: "Register an account",
description: description:
"Creates a user and account records. Returns an account access token for the app that initiated the request. The app should save this token for later, and should wait for the user to confirm their account by clicking a link in their email inbox.", "Creates a user and account records. Returns an account access token for the app that initiated the request. The app should save this token for later, and should wait for the user to confirm their account by clicking a link in their email inbox.",
@ -43,7 +43,7 @@ def create_operation do
def verify_credentials_operation do def verify_credentials_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account credentials"],
description: "Test to make sure that the user token works.", description: "Test to make sure that the user token works.",
summary: "Verify account credentials", summary: "Verify account credentials",
operationId: "AccountController.verify_credentials", operationId: "AccountController.verify_credentials",
@ -56,7 +56,7 @@ def verify_credentials_operation do
def update_credentials_operation do def update_credentials_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account credentials"],
summary: "Update account credentials", summary: "Update account credentials",
description: "Update the user's display and preferences.", description: "Update the user's display and preferences.",
operationId: "AccountController.update_credentials", operationId: "AccountController.update_credentials",
@ -71,8 +71,8 @@ def update_credentials_operation do
def relationships_operation do def relationships_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Check relationships to other accounts", summary: "Relationship with current account",
operationId: "AccountController.relationships", operationId: "AccountController.relationships",
description: "Find out whether a given account is followed, blocked, muted, etc.", description: "Find out whether a given account is followed, blocked, muted, etc.",
security: [%{"oAuth" => ["read:follows"]}], security: [%{"oAuth" => ["read:follows"]}],
@ -95,11 +95,14 @@ def relationships_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Account", summary: "Account",
operationId: "AccountController.show", operationId: "AccountController.show",
description: "View information about a profile.", description: "View information about a profile.",
parameters: [%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}], parameters: [
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
with_relationships_param()
],
responses: %{ responses: %{
200 => Operation.response("Account", "application/json", Account), 200 => Operation.response("Account", "application/json", Account),
401 => Operation.response("Error", "application/json", ApiError), 401 => Operation.response("Error", "application/json", ApiError),
@ -110,8 +113,8 @@ def show_operation do
def statuses_operation do def statuses_operation do
%Operation{ %Operation{
tags: ["accounts"],
summary: "Statuses", summary: "Statuses",
tags: ["Retrieve account information"],
operationId: "AccountController.statuses", operationId: "AccountController.statuses",
description: description:
"Statuses posted to the given account. Public (for public statuses only), or user token + `read:statuses` (for private statuses the user is authorized to see)", "Statuses posted to the given account. Public (for public statuses only), or user token + `read:statuses` (for private statuses the user is authorized to see)",
@ -130,7 +133,7 @@ def statuses_operation do
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike,
"Include statuses from muted acccounts." "Include statuses from muted accounts."
), ),
Operation.parameter(:exclude_reblogs, :query, BooleanLike, "Exclude reblogs"), Operation.parameter(:exclude_reblogs, :query, BooleanLike, "Exclude reblogs"),
Operation.parameter(:exclude_replies, :query, BooleanLike, "Exclude replies"), Operation.parameter(:exclude_replies, :query, BooleanLike, "Exclude replies"),
@ -144,7 +147,7 @@ def statuses_operation do
:with_muted, :with_muted,
:query, :query,
BooleanLike, BooleanLike,
"Include reactions from muted acccounts." "Include reactions from muted accounts."
) )
] ++ pagination_params(), ] ++ pagination_params(),
responses: %{ responses: %{
@ -157,7 +160,7 @@ def statuses_operation do
def followers_operation do def followers_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Followers", summary: "Followers",
operationId: "AccountController.followers", operationId: "AccountController.followers",
security: [%{"oAuth" => ["read:accounts"]}], security: [%{"oAuth" => ["read:accounts"]}],
@ -176,7 +179,7 @@ def followers_operation do
def following_operation do def following_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Following", summary: "Following",
operationId: "AccountController.following", operationId: "AccountController.following",
security: [%{"oAuth" => ["read:accounts"]}], security: [%{"oAuth" => ["read:accounts"]}],
@ -193,7 +196,7 @@ def following_operation do
def lists_operation do def lists_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Lists containing this account", summary: "Lists containing this account",
operationId: "AccountController.lists", operationId: "AccountController.lists",
security: [%{"oAuth" => ["read:lists"]}], security: [%{"oAuth" => ["read:lists"]}],
@ -205,7 +208,7 @@ def lists_operation do
def follow_operation do def follow_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Follow", summary: "Follow",
operationId: "AccountController.follow", operationId: "AccountController.follow",
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],
@ -238,7 +241,7 @@ def follow_operation do
def unfollow_operation do def unfollow_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Unfollow", summary: "Unfollow",
operationId: "AccountController.unfollow", operationId: "AccountController.unfollow",
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],
@ -254,7 +257,7 @@ def unfollow_operation do
def mute_operation do def mute_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Mute", summary: "Mute",
operationId: "AccountController.mute", operationId: "AccountController.mute",
security: [%{"oAuth" => ["follow", "write:mutes"]}], security: [%{"oAuth" => ["follow", "write:mutes"]}],
@ -284,7 +287,7 @@ def mute_operation do
def unmute_operation do def unmute_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Unmute", summary: "Unmute",
operationId: "AccountController.unmute", operationId: "AccountController.unmute",
security: [%{"oAuth" => ["follow", "write:mutes"]}], security: [%{"oAuth" => ["follow", "write:mutes"]}],
@ -298,7 +301,7 @@ def unmute_operation do
def block_operation do def block_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Block", summary: "Block",
operationId: "AccountController.block", operationId: "AccountController.block",
security: [%{"oAuth" => ["follow", "write:blocks"]}], security: [%{"oAuth" => ["follow", "write:blocks"]}],
@ -313,7 +316,7 @@ def block_operation do
def unblock_operation do def unblock_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Unblock", summary: "Unblock",
operationId: "AccountController.unblock", operationId: "AccountController.unblock",
security: [%{"oAuth" => ["follow", "write:blocks"]}], security: [%{"oAuth" => ["follow", "write:blocks"]}],
@ -327,7 +330,7 @@ def unblock_operation do
def follow_by_uri_operation do def follow_by_uri_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Account actions"],
summary: "Follow by URI", summary: "Follow by URI",
operationId: "AccountController.follows", operationId: "AccountController.follows",
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],
@ -342,12 +345,12 @@ def follow_by_uri_operation do
def mutes_operation do def mutes_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Blocks and mutes"],
summary: "Muted accounts", summary: "Retrieve list of mutes",
operationId: "AccountController.mutes", operationId: "AccountController.mutes",
description: "Accounts the user has muted.", description: "Accounts the user has muted.",
security: [%{"oAuth" => ["follow", "read:mutes"]}], security: [%{"oAuth" => ["follow", "read:mutes"]}],
parameters: pagination_params(), parameters: [with_relationships_param() | pagination_params()],
responses: %{ responses: %{
200 => Operation.response("Accounts", "application/json", array_of_accounts()) 200 => Operation.response("Accounts", "application/json", array_of_accounts())
} }
@ -356,8 +359,8 @@ def mutes_operation do
def blocks_operation do def blocks_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Blocks and mutes"],
summary: "Blocked users", summary: "Retrieve list of blocks",
operationId: "AccountController.blocks", operationId: "AccountController.blocks",
description: "View your blocks. See also accounts/:id/{block,unblock}", description: "View your blocks. See also accounts/:id/{block,unblock}",
security: [%{"oAuth" => ["read:blocks"]}], security: [%{"oAuth" => ["read:blocks"]}],
@ -370,7 +373,7 @@ def blocks_operation do
def endorsements_operation do def endorsements_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Endorsements", summary: "Endorsements",
operationId: "AccountController.endorsements", operationId: "AccountController.endorsements",
description: "Not implemented", description: "Not implemented",
@ -383,7 +386,7 @@ def endorsements_operation do
def identity_proofs_operation do def identity_proofs_operation do
%Operation{ %Operation{
tags: ["accounts"], tags: ["Retrieve account information"],
summary: "Identity proofs", summary: "Identity proofs",
operationId: "AccountController.identity_proofs", operationId: "AccountController.identity_proofs",
# Validators complains about unused path params otherwise # Validators complains about unused path params otherwise

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
def delete_message_operation do def delete_message_operation do
%Operation{ %Operation{
tags: ["admin", "chat"], tags: ["Chat administration"],
summary: "Delete an individual chat message", summary: "Delete an individual chat message",
operationId: "AdminAPI.ChatController.delete_message", operationId: "AdminAPI.ChatController.delete_message",
parameters: [ parameters: [
@ -41,8 +41,8 @@ def delete_message_operation do
def messages_operation do def messages_operation do
%Operation{ %Operation{
tags: ["admin", "chat"], tags: ["Chat administration"],
summary: "Get the most recent messages of the chat", summary: "Get chat's messages",
operationId: "AdminAPI.ChatController.messages", operationId: "AdminAPI.ChatController.messages",
parameters: parameters:
[Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++ [Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++
@ -65,7 +65,7 @@ def messages_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chat administration"],
summary: "Create a chat", summary: "Create a chat",
operationId: "AdminAPI.ChatController.show", operationId: "AdminAPI.ChatController.show",
parameters: [ parameters: [

View file

@ -16,8 +16,8 @@ def open_api_operation(action) do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Admin", "Config"], tags: ["Instance configuration"],
summary: "Get list of merged default settings with saved in database", summary: "Retrieve instance configuration",
operationId: "AdminAPI.ConfigController.show", operationId: "AdminAPI.ConfigController.show",
parameters: [ parameters: [
Operation.parameter( Operation.parameter(
@ -38,8 +38,8 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Admin", "Config"], tags: ["Instance configuration"],
summary: "Update config settings", summary: "Update instance configuration",
operationId: "AdminAPI.ConfigController.update", operationId: "AdminAPI.ConfigController.update",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
parameters: admin_api_params(), parameters: admin_api_params(),
@ -71,8 +71,8 @@ def update_operation do
def descriptions_operation do def descriptions_operation do
%Operation{ %Operation{
tags: ["Admin", "Config"], tags: ["Instance configuration"],
summary: "Get JSON with config descriptions.", summary: "Retrieve config description",
operationId: "AdminAPI.ConfigController.descriptions", operationId: "AdminAPI.ConfigController.descriptions",
security: [%{"oAuth" => ["read"]}], security: [%{"oAuth" => ["read"]}],
parameters: admin_api_params(), parameters: admin_api_params(),

View file

@ -16,8 +16,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Frontend managment"],
summary: "Get a list of available frontends", summary: "Retrieve a list of available frontends",
operationId: "AdminAPI.FrontendController.index", operationId: "AdminAPI.FrontendController.index",
security: [%{"oAuth" => ["read"]}], security: [%{"oAuth" => ["read"]}],
responses: %{ responses: %{
@ -29,7 +29,7 @@ def index_operation do
def install_operation do def install_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Frontend managment"],
summary: "Install a frontend", summary: "Install a frontend",
operationId: "AdminAPI.FrontendController.install", operationId: "AdminAPI.FrontendController.install",
security: [%{"oAuth" => ["read"]}], security: [%{"oAuth" => ["read"]}],

View file

@ -15,8 +15,8 @@ def open_api_operation(action) do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Admin", "InstanceDocument"], tags: ["Instance documents"],
summary: "Get the instance document", summary: "Retrieve an instance document",
operationId: "AdminAPI.InstanceDocumentController.show", operationId: "AdminAPI.InstanceDocumentController.show",
security: [%{"oAuth" => ["read"]}], security: [%{"oAuth" => ["read"]}],
parameters: [ parameters: [
@ -36,8 +36,8 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Admin", "InstanceDocument"], tags: ["Instance documents"],
summary: "Update the instance document", summary: "Update an instance document",
operationId: "AdminAPI.InstanceDocumentController.update", operationId: "AdminAPI.InstanceDocumentController.update",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
requestBody: Helpers.request_body("Parameters", update_request()), requestBody: Helpers.request_body("Parameters", update_request()),
@ -74,8 +74,8 @@ defp update_request do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Admin", "InstanceDocument"], tags: ["Instance documents"],
summary: "Get the instance document", summary: "Delete an instance document",
operationId: "AdminAPI.InstanceDocumentController.delete", operationId: "AdminAPI.InstanceDocumentController.delete",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
parameters: [ parameters: [

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Admin", "Invites"], tags: ["Invites"],
summary: "Get a list of generated invites", summary: "Get a list of generated invites",
operationId: "AdminAPI.InviteController.index", operationId: "AdminAPI.InviteController.index",
security: [%{"oAuth" => ["read:invites"]}], security: [%{"oAuth" => ["read:invites"]}],
@ -48,7 +48,7 @@ def index_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Admin", "Invites"], tags: ["Invites"],
summary: "Create an account registration invite token", summary: "Create an account registration invite token",
operationId: "AdminAPI.InviteController.create", operationId: "AdminAPI.InviteController.create",
security: [%{"oAuth" => ["write:invites"]}], security: [%{"oAuth" => ["write:invites"]}],
@ -69,7 +69,7 @@ def create_operation do
def revoke_operation do def revoke_operation do
%Operation{ %Operation{
tags: ["Admin", "Invites"], tags: ["Invites"],
summary: "Revoke invite by token", summary: "Revoke invite by token",
operationId: "AdminAPI.InviteController.revoke", operationId: "AdminAPI.InviteController.revoke",
security: [%{"oAuth" => ["write:invites"]}], security: [%{"oAuth" => ["write:invites"]}],
@ -96,7 +96,7 @@ def revoke_operation do
def email_operation do def email_operation do
%Operation{ %Operation{
tags: ["Admin", "Invites"], tags: ["Invites"],
summary: "Sends registration invite via email", summary: "Sends registration invite via email",
operationId: "AdminAPI.InviteController.email", operationId: "AdminAPI.InviteController.email",
security: [%{"oAuth" => ["write:invites"]}], security: [%{"oAuth" => ["write:invites"]}],

View file

@ -16,8 +16,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Admin", "MediaProxyCache"], tags: ["MediaProxy cache"],
summary: "Fetch a paginated list of all banned MediaProxy URLs in Cachex", summary: "Retrieve a list of banned MediaProxy URLs",
operationId: "AdminAPI.MediaProxyCacheController.index", operationId: "AdminAPI.MediaProxyCacheController.index",
security: [%{"oAuth" => ["read:media_proxy_caches"]}], security: [%{"oAuth" => ["read:media_proxy_caches"]}],
parameters: [ parameters: [
@ -44,7 +44,7 @@ def index_operation do
responses: %{ responses: %{
200 => 200 =>
Operation.response( Operation.response(
"Array of banned MediaProxy URLs in Cachex", "Array of MediaProxy URLs",
"application/json", "application/json",
%Schema{ %Schema{
type: :object, type: :object,
@ -68,8 +68,8 @@ def index_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Admin", "MediaProxyCache"], tags: ["MediaProxy cache"],
summary: "Remove a banned MediaProxy URL from Cachex", summary: "Remove a banned MediaProxy URL",
operationId: "AdminAPI.MediaProxyCacheController.delete", operationId: "AdminAPI.MediaProxyCacheController.delete",
security: [%{"oAuth" => ["write:media_proxy_caches"]}], security: [%{"oAuth" => ["write:media_proxy_caches"]}],
parameters: admin_api_params(), parameters: admin_api_params(),
@ -94,8 +94,8 @@ def delete_operation do
def purge_operation do def purge_operation do
%Operation{ %Operation{
tags: ["Admin", "MediaProxyCache"], tags: ["MediaProxy cache"],
summary: "Purge and optionally ban a MediaProxy URL", summary: "Purge a URL from MediaProxy cache and optionally ban it",
operationId: "AdminAPI.MediaProxyCacheController.purge", operationId: "AdminAPI.MediaProxyCacheController.purge",
security: [%{"oAuth" => ["write:media_proxy_caches"]}], security: [%{"oAuth" => ["write:media_proxy_caches"]}],
parameters: admin_api_params(), parameters: admin_api_params(),

View file

@ -16,8 +16,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
summary: "List OAuth apps", summary: "Retrieve a list of OAuth applications",
tags: ["Admin", "oAuth Apps"], tags: ["OAuth application managment"],
operationId: "AdminAPI.OAuthAppController.index", operationId: "AdminAPI.OAuthAppController.index",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
parameters: [ parameters: [
@ -69,8 +69,8 @@ def index_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Admin", "oAuth Apps"], tags: ["OAuth application managment"],
summary: "Create OAuth App", summary: "Create an OAuth application",
operationId: "AdminAPI.OAuthAppController.create", operationId: "AdminAPI.OAuthAppController.create",
requestBody: request_body("Parameters", create_request()), requestBody: request_body("Parameters", create_request()),
parameters: admin_api_params(), parameters: admin_api_params(),
@ -84,8 +84,8 @@ def create_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Admin", "oAuth Apps"], tags: ["OAuth application managment"],
summary: "Update OAuth App", summary: "Update OAuth application",
operationId: "AdminAPI.OAuthAppController.update", operationId: "AdminAPI.OAuthAppController.update",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -102,8 +102,8 @@ def update_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Admin", "oAuth Apps"], tags: ["OAuth application managment"],
summary: "Delete OAuth App", summary: "Delete OAuth application",
operationId: "AdminAPI.OAuthAppController.delete", operationId: "AdminAPI.OAuthAppController.delete",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],

View file

@ -15,8 +15,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Admin", "Relays"], tags: ["Relays"],
summary: "List Relays", summary: "Retrieve a list of relays",
operationId: "AdminAPI.RelayController.index", operationId: "AdminAPI.RelayController.index",
security: [%{"oAuth" => ["read"]}], security: [%{"oAuth" => ["read"]}],
parameters: admin_api_params(), parameters: admin_api_params(),
@ -37,8 +37,8 @@ def index_operation do
def follow_operation do def follow_operation do
%Operation{ %Operation{
tags: ["Admin", "Relays"], tags: ["Relays"],
summary: "Follow a Relay", summary: "Follow a relay",
operationId: "AdminAPI.RelayController.follow", operationId: "AdminAPI.RelayController.follow",
security: [%{"oAuth" => ["write:follows"]}], security: [%{"oAuth" => ["write:follows"]}],
parameters: admin_api_params(), parameters: admin_api_params(),
@ -51,8 +51,8 @@ def follow_operation do
def unfollow_operation do def unfollow_operation do
%Operation{ %Operation{
tags: ["Admin", "Relays"], tags: ["Relays"],
summary: "Unfollow a Relay", summary: "Unfollow a relay",
operationId: "AdminAPI.RelayController.unfollow", operationId: "AdminAPI.RelayController.unfollow",
security: [%{"oAuth" => ["write:follows"]}], security: [%{"oAuth" => ["write:follows"]}],
parameters: admin_api_params(), parameters: admin_api_params(),

View file

@ -19,8 +19,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Report managment"],
summary: "Get a list of reports", summary: "Retrieve a list of reports",
operationId: "AdminAPI.ReportController.index", operationId: "AdminAPI.ReportController.index",
security: [%{"oAuth" => ["read:reports"]}], security: [%{"oAuth" => ["read:reports"]}],
parameters: [ parameters: [
@ -69,8 +69,8 @@ def index_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Report managment"],
summary: "Get an individual report", summary: "Retrieve a report",
operationId: "AdminAPI.ReportController.show", operationId: "AdminAPI.ReportController.show",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
security: [%{"oAuth" => ["read:reports"]}], security: [%{"oAuth" => ["read:reports"]}],
@ -83,8 +83,8 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Report managment"],
summary: "Change the state of one or multiple reports", summary: "Change state of specified reports",
operationId: "AdminAPI.ReportController.update", operationId: "AdminAPI.ReportController.update",
security: [%{"oAuth" => ["write:reports"]}], security: [%{"oAuth" => ["write:reports"]}],
parameters: admin_api_params(), parameters: admin_api_params(),
@ -99,8 +99,8 @@ def update_operation do
def notes_create_operation do def notes_create_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Report managment"],
summary: "Create report note", summary: "Add a note to the report",
operationId: "AdminAPI.ReportController.notes_create", operationId: "AdminAPI.ReportController.notes_create",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
requestBody: requestBody:
@ -120,8 +120,8 @@ def notes_create_operation do
def notes_delete_operation do def notes_delete_operation do
%Operation{ %Operation{
tags: ["Admin", "Reports"], tags: ["Report managment"],
summary: "Delete report note", summary: "Delete note attached to the report",
operationId: "AdminAPI.ReportController.notes_delete", operationId: "AdminAPI.ReportController.notes_delete",
parameters: [ parameters: [
Operation.parameter(:report_id, :path, :string, "Report ID"), Operation.parameter(:report_id, :path, :string, "Report ID"),

View file

@ -21,8 +21,9 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Admin", "Statuses"], tags: ["Status administration"],
operationId: "AdminAPI.StatusController.index", operationId: "AdminAPI.StatusController.index",
summary: "Get all statuses",
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
parameters: [ parameters: [
Operation.parameter( Operation.parameter(
@ -69,8 +70,8 @@ def index_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Admin", "Statuses"], tags: ["Status adminitration)"],
summary: "Show Status", summary: "Get status",
operationId: "AdminAPI.StatusController.show", operationId: "AdminAPI.StatusController.show",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
@ -83,8 +84,8 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Admin", "Statuses"], tags: ["Status adminitration)"],
summary: "Change the scope of an individual reported status", summary: "Change the scope of a status",
operationId: "AdminAPI.StatusController.update", operationId: "AdminAPI.StatusController.update",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
@ -98,8 +99,8 @@ def update_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Admin", "Statuses"], tags: ["Status adminitration)"],
summary: "Delete an individual reported status", summary: "Delete status",
operationId: "AdminAPI.StatusController.delete", operationId: "AdminAPI.StatusController.delete",
parameters: [id_param() | admin_api_params()], parameters: [id_param() | admin_api_params()],
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
@spec create_operation() :: Operation.t() @spec create_operation() :: Operation.t()
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Applications"],
summary: "Create an application", summary: "Create an application",
description: "Create a new application to obtain OAuth2 credentials", description: "Create a new application to obtain OAuth2 credentials",
operationId: "AppController.create", operationId: "AppController.create",
@ -45,8 +45,8 @@ def create_operation do
def verify_credentials_operation do def verify_credentials_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Applications"],
summary: "Verify your app works", summary: "Verify the application works",
description: "Confirm that the app's OAuth2 credentials work.", description: "Confirm that the app's OAuth2 credentials work.",
operationId: "AppController.verify_credentials", operationId: "AppController.verify_credentials",
security: [%{"oAuth" => ["read"]}], security: [%{"oAuth" => ["read"]}],

View file

@ -20,7 +20,7 @@ def open_api_operation(action) do
def mark_as_read_operation do def mark_as_read_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Mark all messages in the chat as read", summary: "Mark all messages in the chat as read",
operationId: "ChatController.mark_as_read", operationId: "ChatController.mark_as_read",
parameters: [Operation.parameter(:id, :path, :string, "The ID of the Chat")], parameters: [Operation.parameter(:id, :path, :string, "The ID of the Chat")],
@ -43,8 +43,8 @@ def mark_as_read_operation do
def mark_message_as_read_operation do def mark_message_as_read_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Mark one message in the chat as read", summary: "Mark a message as read",
operationId: "ChatController.mark_message_as_read", operationId: "ChatController.mark_message_as_read",
parameters: [ parameters: [
Operation.parameter(:id, :path, :string, "The ID of the Chat"), Operation.parameter(:id, :path, :string, "The ID of the Chat"),
@ -68,8 +68,8 @@ def mark_message_as_read_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Create a chat", summary: "Retrieve a chat",
operationId: "ChatController.show", operationId: "ChatController.show",
parameters: [ parameters: [
Operation.parameter( Operation.parameter(
@ -99,7 +99,7 @@ def show_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Create a chat", summary: "Create a chat",
operationId: "ChatController.create", operationId: "ChatController.create",
parameters: [ parameters: [
@ -130,8 +130,8 @@ def create_operation do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Get a list of chats that you participated in", summary: "Retrieve list of chats",
operationId: "ChatController.index", operationId: "ChatController.index",
parameters: [ parameters: [
Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users") Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users")
@ -150,8 +150,8 @@ def index_operation do
def messages_operation do def messages_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Get the most recent messages of the chat", summary: "Retrieve chat's messages",
operationId: "ChatController.messages", operationId: "ChatController.messages",
parameters: parameters:
[Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++ [Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++
@ -175,7 +175,7 @@ def messages_operation do
def post_chat_message_operation do def post_chat_message_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "Post a message to the chat", summary: "Post a message to the chat",
operationId: "ChatController.post_chat_message", operationId: "ChatController.post_chat_message",
parameters: [ parameters: [
@ -202,8 +202,8 @@ def post_chat_message_operation do
def delete_message_operation do def delete_message_operation do
%Operation{ %Operation{
tags: ["chat"], tags: ["Chats"],
summary: "delete_message", summary: "Delete message",
operationId: "ChatController.delete_message", operationId: "ChatController.delete_message",
parameters: [ parameters: [
Operation.parameter(:id, :path, :string, "The ID of the Chat"), Operation.parameter(:id, :path, :string, "The ID of the Chat"),

View file

@ -18,7 +18,7 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Conversations"], tags: ["Conversations"],
summary: "Show conversation", summary: "List of conversations",
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
operationId: "ConversationController.index", operationId: "ConversationController.index",
parameters: [ parameters: [
@ -44,7 +44,7 @@ def index_operation do
def mark_as_read_operation do def mark_as_read_operation do
%Operation{ %Operation{
tags: ["Conversations"], tags: ["Conversations"],
summary: "Mark as read", summary: "Mark conversation as read",
operationId: "ConversationController.mark_as_read", operationId: "ConversationController.mark_as_read",
parameters: [ parameters: [
Operation.parameter(:id, :path, :string, "Conversation ID", Operation.parameter(:id, :path, :string, "Conversation ID",

View file

@ -14,8 +14,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["custom_emojis"], tags: ["Custom emojis"],
summary: "List custom custom emojis", summary: "Retrieve a list of custom emojis",
description: "Returns custom emojis that are available on the server.", description: "Returns custom emojis that are available on the server.",
operationId: "CustomEmojiController.index", operationId: "CustomEmojiController.index",
responses: %{ responses: %{

View file

@ -14,9 +14,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["domain_blocks"], tags: ["Domain blocks"],
summary: "Fetch domain blocks", summary: "Retrieve a list of blocked domains",
description: "View domains the user has blocked.",
security: [%{"oAuth" => ["follow", "read:blocks"]}], security: [%{"oAuth" => ["follow", "read:blocks"]}],
operationId: "DomainBlockController.index", operationId: "DomainBlockController.index",
responses: %{ responses: %{
@ -34,7 +33,7 @@ def index_operation do
# Supporting domain query parameter is deprecated in Mastodon API # Supporting domain query parameter is deprecated in Mastodon API
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["domain_blocks"], tags: ["Domain blocks"],
summary: "Block a domain", summary: "Block a domain",
description: """ description: """
Block a domain to: Block a domain to:
@ -55,7 +54,7 @@ def create_operation do
# Supporting domain query parameter is deprecated in Mastodon API # Supporting domain query parameter is deprecated in Mastodon API
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["domain_blocks"], tags: ["Domain blocks"],
summary: "Unblock a domain", summary: "Unblock a domain",
description: "Remove a domain block, if it exists in the user's array of blocked domains.", description: "Remove a domain block, if it exists in the user's array of blocked domains.",
operationId: "DomainBlockController.delete", operationId: "DomainBlockController.delete",

View file

@ -17,7 +17,7 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Emoji Reactions"], tags: ["Emoji reactions"],
summary: summary:
"Get an object of emoji to account mappings with accounts that reacted to the post", "Get an object of emoji to account mappings with accounts that reacted to the post",
parameters: [ parameters: [
@ -42,7 +42,7 @@ def index_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Emoji Reactions"], tags: ["Emoji reactions"],
summary: "React to a post with a unicode emoji", summary: "React to a post with a unicode emoji",
parameters: [ parameters: [
Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), Operation.parameter(:id, :path, FlakeID, "Status ID", required: true),
@ -61,7 +61,7 @@ def create_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Emoji Reactions"], tags: ["Emoji reactions"],
summary: "Remove a reaction to a post with a unicode emoji", summary: "Remove a reaction to a post with a unicode emoji",
parameters: [ parameters: [
Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), Operation.parameter(:id, :path, FlakeID, "Status ID", required: true),
@ -78,7 +78,7 @@ def delete_operation do
end end
defp array_of_reactions_response do defp array_of_reactions_response do
Operation.response("Array of Emoji Reactions", "application/json", %Schema{ Operation.response("Array of Emoji reactions", "application/json", %Schema{
type: :array, type: :array,
items: emoji_reaction(), items: emoji_reaction(),
example: [emoji_reaction().example] example: [emoji_reaction().example]

View file

@ -16,8 +16,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Filters"],
summary: "View all filters", summary: "All filters",
operationId: "FilterController.index", operationId: "FilterController.index",
security: [%{"oAuth" => ["read:filters"]}], security: [%{"oAuth" => ["read:filters"]}],
responses: %{ responses: %{
@ -29,7 +29,7 @@ def index_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Filters"],
summary: "Create a filter", summary: "Create a filter",
operationId: "FilterController.create", operationId: "FilterController.create",
requestBody: Helpers.request_body("Parameters", create_request(), required: true), requestBody: Helpers.request_body("Parameters", create_request(), required: true),
@ -43,8 +43,8 @@ def create_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Filters"],
summary: "View all filters", summary: "Filter",
parameters: [id_param()], parameters: [id_param()],
operationId: "FilterController.show", operationId: "FilterController.show",
security: [%{"oAuth" => ["read:filters"]}], security: [%{"oAuth" => ["read:filters"]}],
@ -58,7 +58,7 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Filters"],
summary: "Update a filter", summary: "Update a filter",
parameters: [id_param()], parameters: [id_param()],
operationId: "FilterController.update", operationId: "FilterController.update",
@ -73,7 +73,7 @@ def update_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["apps"], tags: ["Filters"],
summary: "Remove a filter", summary: "Remove a filter",
parameters: [id_param()], parameters: [id_param()],
operationId: "FilterController.delete", operationId: "FilterController.delete",

View file

@ -15,8 +15,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Follow Requests"], tags: ["Follow requests"],
summary: "Pending Follows", summary: "Retrieve follow requests",
security: [%{"oAuth" => ["read:follows", "follow"]}], security: [%{"oAuth" => ["read:follows", "follow"]}],
operationId: "FollowRequestController.index", operationId: "FollowRequestController.index",
responses: %{ responses: %{
@ -32,8 +32,8 @@ def index_operation do
def authorize_operation do def authorize_operation do
%Operation{ %Operation{
tags: ["Follow Requests"], tags: ["Follow requests"],
summary: "Accept Follow", summary: "Accept follow request",
operationId: "FollowRequestController.authorize", operationId: "FollowRequestController.authorize",
parameters: [id_param()], parameters: [id_param()],
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],
@ -45,8 +45,8 @@ def authorize_operation do
def reject_operation do def reject_operation do
%Operation{ %Operation{
tags: ["Follow Requests"], tags: ["Follow requests"],
summary: "Reject Follow", summary: "Reject follow request",
operationId: "FollowRequestController.reject", operationId: "FollowRequestController.reject",
parameters: [id_param()], parameters: [id_param()],
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],

View file

@ -14,7 +14,7 @@ def open_api_operation(action) do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Instance"], tags: ["Instance"],
summary: "Fetch instance", summary: "Retrieve instance information",
description: "Information about the server", description: "Information about the server",
operationId: "InstanceController.show", operationId: "InstanceController.show",
responses: %{ responses: %{
@ -26,7 +26,7 @@ def show_operation do
def peers_operation do def peers_operation do
%Operation{ %Operation{
tags: ["Instance"], tags: ["Instance"],
summary: "List of known hosts", summary: "Retrieve list of known instances",
operationId: "InstanceController.peers", operationId: "InstanceController.peers",
responses: %{ responses: %{
200 => Operation.response("Array of domains", "application/json", array_of_domains()) 200 => Operation.response("Array of domains", "application/json", array_of_domains())

View file

@ -20,7 +20,7 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Lists"], tags: ["Lists"],
summary: "Show user's lists", summary: "Retrieve a list of lists",
description: "Fetch all lists that the user owns", description: "Fetch all lists that the user owns",
security: [%{"oAuth" => ["read:lists"]}], security: [%{"oAuth" => ["read:lists"]}],
operationId: "ListController.index", operationId: "ListController.index",
@ -33,7 +33,7 @@ def index_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Lists"], tags: ["Lists"],
summary: "Create a list", summary: "Create a list",
description: "Fetch the list with the given ID. Used for verifying the title of a list.", description: "Fetch the list with the given ID. Used for verifying the title of a list.",
operationId: "ListController.create", operationId: "ListController.create",
requestBody: create_update_request(), requestBody: create_update_request(),
@ -49,7 +49,7 @@ def create_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Lists"], tags: ["Lists"],
summary: "Show a single list", summary: "Retrieve a list",
description: "Fetch the list with the given ID. Used for verifying the title of a list.", description: "Fetch the list with the given ID. Used for verifying the title of a list.",
operationId: "ListController.show", operationId: "ListController.show",
parameters: [id_param()], parameters: [id_param()],
@ -93,7 +93,7 @@ def delete_operation do
def list_accounts_operation do def list_accounts_operation do
%Operation{ %Operation{
tags: ["Lists"], tags: ["Lists"],
summary: "View accounts in list", summary: "Retrieve accounts in list",
operationId: "ListController.list_accounts", operationId: "ListController.list_accounts",
parameters: [id_param()], parameters: [id_param()],
security: [%{"oAuth" => ["read:lists"]}], security: [%{"oAuth" => ["read:lists"]}],

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["media"], tags: ["Media attachments"],
summary: "Upload media as attachment", summary: "Upload media as attachment",
description: "Creates an attachment to be used with a new status.", description: "Creates an attachment to be used with a new status.",
operationId: "MediaController.create", operationId: "MediaController.create",
@ -56,8 +56,8 @@ defp create_request do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["media"], tags: ["Media attachments"],
summary: "Upload media as attachment", summary: "Update attachment",
description: "Creates an attachment to be used with a new status.", description: "Creates an attachment to be used with a new status.",
operationId: "MediaController.update", operationId: "MediaController.update",
security: [%{"oAuth" => ["write:media"]}], security: [%{"oAuth" => ["write:media"]}],
@ -97,8 +97,8 @@ defp update_request do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["media"], tags: ["Media attachments"],
summary: "Show Uploaded media attachment", summary: "Attachment",
operationId: "MediaController.show", operationId: "MediaController.show",
parameters: [id_param()], parameters: [id_param()],
security: [%{"oAuth" => ["read:media"]}], security: [%{"oAuth" => ["read:media"]}],
@ -112,8 +112,8 @@ def show_operation do
def create2_operation do def create2_operation do
%Operation{ %Operation{
tags: ["media"], tags: ["Media attachments"],
summary: "Upload media as attachment", summary: "Upload media as attachment (v2)",
description: "Creates an attachment to be used with a new status.", description: "Creates an attachment to be used with a new status.",
operationId: "MediaController.create2", operationId: "MediaController.create2",
security: [%{"oAuth" => ["write:media"]}], security: [%{"oAuth" => ["write:media"]}],

View file

@ -22,7 +22,7 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Notifications"], tags: ["Notifications"],
summary: "Get all notifications", summary: "Retrieve a list of notifications",
description: description:
"Notifications concerning the user. This API returns Link headers containing links to the next/previous page. However, the links can also be constructed dynamically using query params and `id` values.", "Notifications concerning the user. This API returns Link headers containing links to the next/previous page. However, the links can also be constructed dynamically using query params and `id` values.",
operationId: "NotificationController.index", operationId: "NotificationController.index",
@ -74,7 +74,7 @@ def index_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Notifications"], tags: ["Notifications"],
summary: "Get a single notification", summary: "Retrieve a notification",
description: "View information about a notification with a given ID.", description: "View information about a notification with a given ID.",
operationId: "NotificationController.show", operationId: "NotificationController.show",
security: [%{"oAuth" => ["read:notifications"]}], security: [%{"oAuth" => ["read:notifications"]}],
@ -99,7 +99,7 @@ def clear_operation do
def dismiss_operation do def dismiss_operation do
%Operation{ %Operation{
tags: ["Notifications"], tags: ["Notifications"],
summary: "Dismiss a single notification", summary: "Dismiss a notification",
description: "Clear a single notification from the server.", description: "Clear a single notification from the server.",
operationId: "NotificationController.dismiss", operationId: "NotificationController.dismiss",
parameters: [id_param()], parameters: [id_param()],

View file

@ -18,8 +18,9 @@ def open_api_operation(action) do
def confirmation_resend_operation do def confirmation_resend_operation do
%Operation{ %Operation{
tags: ["Accounts"], tags: ["Account credentials"],
summary: "Resend confirmation email. Expects `email` or `nickname`", summary: "Resend confirmation email",
description: "Expects `email` or `nickname`.",
operationId: "PleromaAPI.AccountController.confirmation_resend", operationId: "PleromaAPI.AccountController.confirmation_resend",
parameters: [ parameters: [
Operation.parameter(:email, :query, :string, "Email of that needs to be verified", Operation.parameter(:email, :query, :string, "Email of that needs to be verified",
@ -41,8 +42,10 @@ def confirmation_resend_operation do
def favourites_operation do def favourites_operation do
%Operation{ %Operation{
tags: ["Accounts"], tags: ["Retrieve account information"],
summary: "Returns favorites timeline of any user", summary: "Favorites",
description:
"Only returns data if the user has opted into sharing it. See `hide_favorites` in [Update account credentials](#operation/AccountController.update_credentials).",
operationId: "PleromaAPI.AccountController.favourites", operationId: "PleromaAPI.AccountController.favourites",
parameters: [id_param() | pagination_params()], parameters: [id_param() | pagination_params()],
security: [%{"oAuth" => ["read:favourites"]}], security: [%{"oAuth" => ["read:favourites"]}],
@ -61,8 +64,9 @@ def favourites_operation do
def subscribe_operation do def subscribe_operation do
%Operation{ %Operation{
tags: ["Accounts"], tags: ["Account actions"],
summary: "Subscribe to receive notifications for all statuses posted by a user", summary: "Subscribe",
description: "Receive notifications for all statuses posted by the account.",
operationId: "PleromaAPI.AccountController.subscribe", operationId: "PleromaAPI.AccountController.subscribe",
parameters: [id_param()], parameters: [id_param()],
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],
@ -75,8 +79,9 @@ def subscribe_operation do
def unsubscribe_operation do def unsubscribe_operation do
%Operation{ %Operation{
tags: ["Accounts"], tags: ["Account actions"],
summary: "Unsubscribe to stop receiving notifications from user statuses", summary: "Unsubscribe",
description: "Stop receiving notifications for all statuses posted by the account.",
operationId: "PleromaAPI.AccountController.unsubscribe", operationId: "PleromaAPI.AccountController.unsubscribe",
parameters: [id_param()], parameters: [id_param()],
security: [%{"oAuth" => ["follow", "write:follows"]}], security: [%{"oAuth" => ["follow", "write:follows"]}],

View file

@ -19,7 +19,7 @@ def open_api_operation(action) do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Conversations"], tags: ["Conversations"],
summary: "The conversation with the given ID", summary: "Conversation",
parameters: [ parameters: [
Operation.parameter(:id, :path, :string, "Conversation ID", Operation.parameter(:id, :path, :string, "Conversation ID",
example: "123", example: "123",
@ -37,7 +37,7 @@ def show_operation do
def statuses_operation do def statuses_operation do
%Operation{ %Operation{
tags: ["Conversations"], tags: ["Conversations"],
summary: "Timeline for a given conversation", summary: "Timeline for conversation",
parameters: [ parameters: [
Operation.parameter(:id, :path, :string, "Conversation ID", Operation.parameter(:id, :path, :string, "Conversation ID",
example: "123", example: "123",
@ -61,7 +61,8 @@ def statuses_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Conversations"], tags: ["Conversations"],
summary: "Update a conversation. Used to change the set of recipients.", summary: "Update conversation",
description: "Change set of recipients for the conversation.",
parameters: [ parameters: [
Operation.parameter(:id, :path, :string, "Conversation ID", Operation.parameter(:id, :path, :string, "Conversation ID",
example: "123", example: "123",
@ -86,7 +87,7 @@ def update_operation do
def mark_as_read_operation do def mark_as_read_operation do
%Operation{ %Operation{
tags: ["Conversations"], tags: ["Conversations"],
summary: "Marks all user's conversations as read", summary: "Marks all conversations as read",
security: [%{"oAuth" => ["write:conversations"]}], security: [%{"oAuth" => ["write:conversations"]}],
operationId: "PleromaAPI.ConversationController.mark_as_read", operationId: "PleromaAPI.ConversationController.mark_as_read",
responses: %{ responses: %{

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Add new file to the pack", summary: "Add new file to the pack",
operationId: "PleromaAPI.EmojiPackController.add_file", operationId: "PleromaAPI.EmojiPackController.add_file",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -62,7 +62,7 @@ defp create_request do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Add new file to the pack", summary: "Add new file to the pack",
operationId: "PleromaAPI.EmojiPackController.update_file", operationId: "PleromaAPI.EmojiPackController.update_file",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -106,7 +106,7 @@ defp update_request do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Delete emoji file from pack", summary: "Delete emoji file from pack",
operationId: "PleromaAPI.EmojiPackController.delete_file", operationId: "PleromaAPI.EmojiPackController.delete_file",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
def remote_operation do def remote_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Make request to another instance for emoji packs list", summary: "Make request to another instance for emoji packs list",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
parameters: [ parameters: [
@ -44,7 +44,7 @@ def remote_operation do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Lists local custom emoji packs", summary: "Lists local custom emoji packs",
operationId: "PleromaAPI.EmojiPackController.index", operationId: "PleromaAPI.EmojiPackController.index",
parameters: [ parameters: [
@ -69,7 +69,7 @@ def index_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Show emoji pack", summary: "Show emoji pack",
operationId: "PleromaAPI.EmojiPackController.show", operationId: "PleromaAPI.EmojiPackController.show",
parameters: [ parameters: [
@ -97,7 +97,7 @@ def show_operation do
def archive_operation do def archive_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Requests a local pack archive from the instance", summary: "Requests a local pack archive from the instance",
operationId: "PleromaAPI.EmojiPackController.archive", operationId: "PleromaAPI.EmojiPackController.archive",
parameters: [name_param()], parameters: [name_param()],
@ -115,7 +115,7 @@ def archive_operation do
def download_operation do def download_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Download pack from another instance", summary: "Download pack from another instance",
operationId: "PleromaAPI.EmojiPackController.download", operationId: "PleromaAPI.EmojiPackController.download",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -145,7 +145,7 @@ defp download_request do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Create an empty pack", summary: "Create an empty pack",
operationId: "PleromaAPI.EmojiPackController.create", operationId: "PleromaAPI.EmojiPackController.create",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -161,7 +161,7 @@ def create_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Delete a custom emoji pack", summary: "Delete a custom emoji pack",
operationId: "PleromaAPI.EmojiPackController.delete", operationId: "PleromaAPI.EmojiPackController.delete",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -177,7 +177,7 @@ def delete_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Updates (replaces) pack metadata", summary: "Updates (replaces) pack metadata",
operationId: "PleromaAPI.EmojiPackController.update", operationId: "PleromaAPI.EmojiPackController.update",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],
@ -193,7 +193,7 @@ def update_operation do
def import_from_filesystem_operation do def import_from_filesystem_operation do
%Operation{ %Operation{
tags: ["Emoji Packs"], tags: ["Emoji packs"],
summary: "Imports packs from filesystem", summary: "Imports packs from filesystem",
operationId: "PleromaAPI.EmojiPackController.import", operationId: "PleromaAPI.EmojiPackController.import",
security: [%{"oAuth" => ["write"]}], security: [%{"oAuth" => ["write"]}],

View file

@ -13,8 +13,8 @@ def open_api_operation(action) do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["PleromaInstances"], tags: ["Instance"],
summary: "Instances federation status", summary: "Retrieve federation status",
description: "Information about instances deemed unreachable by the server", description: "Information about instances deemed unreachable by the server",
operationId: "PleromaInstances.show", operationId: "PleromaInstances.show",
responses: %{ responses: %{

View file

@ -17,7 +17,7 @@ def open_api_operation(action) do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Mascot"], tags: ["Mascot"],
summary: "Gets user mascot image", summary: "Retrieve mascot",
security: [%{"oAuth" => ["read:accounts"]}], security: [%{"oAuth" => ["read:accounts"]}],
operationId: "PleromaAPI.MascotController.show", operationId: "PleromaAPI.MascotController.show",
responses: %{ responses: %{
@ -29,7 +29,7 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Mascot"], tags: ["Mascot"],
summary: "Set/clear user avatar image", summary: "Set or clear mascot",
description: description:
"Behaves exactly the same as `POST /api/v1/upload`. Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`.", "Behaves exactly the same as `POST /api/v1/upload`. Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`.",
operationId: "PleromaAPI.MascotController.update", operationId: "PleromaAPI.MascotController.update",

View file

@ -18,7 +18,8 @@ def open_api_operation(action) do
def mark_as_read_operation do def mark_as_read_operation do
%Operation{ %Operation{
tags: ["Notifications"], tags: ["Notifications"],
summary: "Mark notifications as read. Query parameters are mutually exclusive.", summary: "Mark notifications as read",
description: "Query parameters are mutually exclusive.",
requestBody: requestBody:
request_body("Parameters", %Schema{ request_body("Parameters", %Schema{
type: :object, type: :object,
@ -32,7 +33,7 @@ def mark_as_read_operation do
responses: %{ responses: %{
200 => 200 =>
Operation.response( Operation.response(
"A Notification or array of Motifications", "A Notification or array of Notifications",
"application/json", "application/json",
%Schema{ %Schema{
anyOf: [ anyOf: [

View file

@ -16,7 +16,7 @@ def open_api_operation(action) do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["reports"], tags: ["Reports"],
summary: "File a report", summary: "File a report",
description: "Report problematic users to your moderators", description: "Report problematic users to your moderators",
operationId: "ReportController.create", operationId: "ReportController.create",

View file

@ -18,7 +18,7 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Scheduled Statuses"], tags: ["Scheduled statuses"],
summary: "View scheduled statuses", summary: "View scheduled statuses",
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
parameters: pagination_params(), parameters: pagination_params(),
@ -35,7 +35,7 @@ def index_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Scheduled Statuses"], tags: ["Scheduled statuses"],
summary: "View a single scheduled status", summary: "View a single scheduled status",
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
parameters: [id_param()], parameters: [id_param()],
@ -49,7 +49,7 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Scheduled Statuses"], tags: ["Scheduled statuses"],
summary: "Schedule a status", summary: "Schedule a status",
operationId: "ScheduledActivity.update", operationId: "ScheduledActivity.update",
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
@ -75,7 +75,7 @@ def update_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Scheduled Statuses"], tags: ["Scheduled statuses"],
summary: "Cancel a scheduled status", summary: "Cancel a scheduled status",
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
parameters: [id_param()], parameters: [id_param()],

View file

@ -22,8 +22,8 @@ def open_api_operation(action) do
def index_operation do def index_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Retrieve status information"],
summary: "Get multiple statuses by IDs", summary: "Multiple statuses",
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
parameters: [ parameters: [
Operation.parameter( Operation.parameter(
@ -48,7 +48,7 @@ def index_operation do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Publish new status", summary: "Publish new status",
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
description: "Post a new status", description: "Post a new status",
@ -68,8 +68,8 @@ def create_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Retrieve status information"],
summary: "View specific status", summary: "Status",
description: "View information about a status", description: "View information about a status",
operationId: "StatusController.show", operationId: "StatusController.show",
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
@ -91,8 +91,8 @@ def show_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Delete status", summary: "Delete",
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
description: "Delete one of your own statuses", description: "Delete one of your own statuses",
operationId: "StatusController.delete", operationId: "StatusController.delete",
@ -107,8 +107,8 @@ def delete_operation do
def reblog_operation do def reblog_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Boost", summary: "Reblog",
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
description: "Share a status", description: "Share a status",
operationId: "StatusController.reblog", operationId: "StatusController.reblog",
@ -129,8 +129,8 @@ def reblog_operation do
def unreblog_operation do def unreblog_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Undo boost", summary: "Undo reblog",
security: [%{"oAuth" => ["write:statuses"]}], security: [%{"oAuth" => ["write:statuses"]}],
description: "Undo a reshare of a status", description: "Undo a reshare of a status",
operationId: "StatusController.unreblog", operationId: "StatusController.unreblog",
@ -144,7 +144,7 @@ def unreblog_operation do
def favourite_operation do def favourite_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Favourite", summary: "Favourite",
security: [%{"oAuth" => ["write:favourites"]}], security: [%{"oAuth" => ["write:favourites"]}],
description: "Add a status to your favourites list", description: "Add a status to your favourites list",
@ -159,7 +159,7 @@ def favourite_operation do
def unfavourite_operation do def unfavourite_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Undo favourite", summary: "Undo favourite",
security: [%{"oAuth" => ["write:favourites"]}], security: [%{"oAuth" => ["write:favourites"]}],
description: "Remove a status from your favourites list", description: "Remove a status from your favourites list",
@ -174,7 +174,7 @@ def unfavourite_operation do
def pin_operation do def pin_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Pin to profile", summary: "Pin to profile",
security: [%{"oAuth" => ["write:accounts"]}], security: [%{"oAuth" => ["write:accounts"]}],
description: "Feature one of your own public statuses at the top of your profile", description: "Feature one of your own public statuses at the top of your profile",
@ -189,8 +189,8 @@ def pin_operation do
def unpin_operation do def unpin_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Unpin to profile", summary: "Unpin from profile",
security: [%{"oAuth" => ["write:accounts"]}], security: [%{"oAuth" => ["write:accounts"]}],
description: "Unfeature a status from the top of your profile", description: "Unfeature a status from the top of your profile",
operationId: "StatusController.unpin", operationId: "StatusController.unpin",
@ -204,7 +204,7 @@ def unpin_operation do
def bookmark_operation do def bookmark_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Bookmark", summary: "Bookmark",
security: [%{"oAuth" => ["write:bookmarks"]}], security: [%{"oAuth" => ["write:bookmarks"]}],
description: "Privately bookmark a status", description: "Privately bookmark a status",
@ -218,7 +218,7 @@ def bookmark_operation do
def unbookmark_operation do def unbookmark_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Undo bookmark", summary: "Undo bookmark",
security: [%{"oAuth" => ["write:bookmarks"]}], security: [%{"oAuth" => ["write:bookmarks"]}],
description: "Remove a status from your private bookmarks", description: "Remove a status from your private bookmarks",
@ -232,7 +232,7 @@ def unbookmark_operation do
def mute_conversation_operation do def mute_conversation_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Mute conversation", summary: "Mute conversation",
security: [%{"oAuth" => ["write:mutes"]}], security: [%{"oAuth" => ["write:mutes"]}],
description: "Do not receive notifications for the thread that this status is part of.", description: "Do not receive notifications for the thread that this status is part of.",
@ -267,7 +267,7 @@ def mute_conversation_operation do
def unmute_conversation_operation do def unmute_conversation_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Status actions"],
summary: "Unmute conversation", summary: "Unmute conversation",
security: [%{"oAuth" => ["write:mutes"]}], security: [%{"oAuth" => ["write:mutes"]}],
description: description:
@ -283,7 +283,7 @@ def unmute_conversation_operation do
def card_operation do def card_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Retrieve status information"],
deprecated: true, deprecated: true,
summary: "Preview card", summary: "Preview card",
description: "Deprecated in favor of card property inlined on Status entity", description: "Deprecated in favor of card property inlined on Status entity",
@ -311,7 +311,7 @@ def card_operation do
def favourited_by_operation do def favourited_by_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Retrieve status information"],
summary: "Favourited by", summary: "Favourited by",
description: "View who favourited a given status", description: "View who favourited a given status",
operationId: "StatusController.favourited_by", operationId: "StatusController.favourited_by",
@ -331,9 +331,9 @@ def favourited_by_operation do
def reblogged_by_operation do def reblogged_by_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Retrieve status information"],
summary: "Boosted by", summary: "Reblogged by",
description: "View who boosted a given status", description: "View who reblogged a given status",
operationId: "StatusController.reblogged_by", operationId: "StatusController.reblogged_by",
security: [%{"oAuth" => ["read:accounts"]}], security: [%{"oAuth" => ["read:accounts"]}],
parameters: [id_param()], parameters: [id_param()],
@ -351,7 +351,7 @@ def reblogged_by_operation do
def context_operation do def context_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Retrieve status information"],
summary: "Parent and child statuses", summary: "Parent and child statuses",
description: "View statuses above and below this status in the thread", description: "View statuses above and below this status in the thread",
operationId: "StatusController.context", operationId: "StatusController.context",
@ -365,7 +365,7 @@ def context_operation do
def favourites_operation do def favourites_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Timelines"],
summary: "Favourited statuses", summary: "Favourited statuses",
description: description:
"Statuses the user has favourited. Please note that you have to use the link headers to paginate this. You can not build the query parameters yourself.", "Statuses the user has favourited. Please note that you have to use the link headers to paginate this. You can not build the query parameters yourself.",
@ -380,7 +380,7 @@ def favourites_operation do
def bookmarks_operation do def bookmarks_operation do
%Operation{ %Operation{
tags: ["Statuses"], tags: ["Timelines"],
summary: "Bookmarked statuses", summary: "Bookmarked statuses",
description: "Statuses the user has bookmarked", description: "Statuses the user has bookmarked",
operationId: "StatusController.bookmarks", operationId: "StatusController.bookmarks",
@ -413,34 +413,7 @@ defp create_request do
items: %Schema{type: :string}, items: %Schema{type: :string},
description: "Array of Attachment ids to be attached as media." description: "Array of Attachment ids to be attached as media."
}, },
poll: %Schema{ poll: poll_params(),
nullable: true,
type: :object,
required: [:options],
properties: %{
options: %Schema{
type: :array,
items: %Schema{type: :string},
description: "Array of possible answers. Must be provided with `poll[expires_in]`."
},
expires_in: %Schema{
type: :integer,
nullable: true,
description:
"Duration the poll should be open, in seconds. Must be provided with `poll[options]`"
},
multiple: %Schema{
allOf: [BooleanLike],
nullable: true,
description: "Allow multiple choices?"
},
hide_totals: %Schema{
allOf: [BooleanLike],
nullable: true,
description: "Hide vote counts until the poll ends?"
}
}
},
in_reply_to_id: %Schema{ in_reply_to_id: %Schema{
nullable: true, nullable: true,
allOf: [FlakeID], allOf: [FlakeID],
@ -522,6 +495,37 @@ defp create_request do
} }
end end
def poll_params do
%Schema{
nullable: true,
type: :object,
required: [:options, :expires_in],
properties: %{
options: %Schema{
type: :array,
items: %Schema{type: :string},
description: "Array of possible answers. Must be provided with `poll[expires_in]`."
},
expires_in: %Schema{
type: :integer,
nullable: true,
description:
"Duration the poll should be open, in seconds. Must be provided with `poll[options]`"
},
multiple: %Schema{
allOf: [BooleanLike],
nullable: true,
description: "Allow multiple choices?"
},
hide_totals: %Schema{
allOf: [BooleanLike],
nullable: true,
description: "Hide vote counts until the poll ends?"
}
}
}
end
def id_param do def id_param do
Operation.parameter(:id, :path, FlakeID, "Status ID", Operation.parameter(:id, :path, FlakeID, "Status ID",
example: "9umDrYheeY451cQnEe", example: "9umDrYheeY451cQnEe",

View file

@ -17,7 +17,7 @@ def open_api_operation(action) do
def create_operation do def create_operation do
%Operation{ %Operation{
tags: ["Push Subscriptions"], tags: ["Push subscriptions"],
summary: "Subscribe to push notifications", summary: "Subscribe to push notifications",
description: description:
"Add a Web Push API subscription to receive notifications. Each access token can have one push subscription. If you create a new subscription, the old subscription is deleted.", "Add a Web Push API subscription to receive notifications. Each access token can have one push subscription. If you create a new subscription, the old subscription is deleted.",
@ -25,7 +25,7 @@ def create_operation do
security: [%{"oAuth" => ["push"]}], security: [%{"oAuth" => ["push"]}],
requestBody: Helpers.request_body("Parameters", create_request(), required: true), requestBody: Helpers.request_body("Parameters", create_request(), required: true),
responses: %{ responses: %{
200 => Operation.response("Push Subscription", "application/json", PushSubscription), 200 => Operation.response("Push subscription", "application/json", PushSubscription),
400 => Operation.response("Error", "application/json", ApiError), 400 => Operation.response("Error", "application/json", ApiError),
403 => Operation.response("Error", "application/json", ApiError) 403 => Operation.response("Error", "application/json", ApiError)
} }
@ -34,13 +34,13 @@ def create_operation do
def show_operation do def show_operation do
%Operation{ %Operation{
tags: ["Push Subscriptions"], tags: ["Push subscriptions"],
summary: "Get current subscription", summary: "Get current subscription",
description: "View the PushSubscription currently associated with this access token.", description: "View the PushSubscription currently associated with this access token.",
operationId: "SubscriptionController.show", operationId: "SubscriptionController.show",
security: [%{"oAuth" => ["push"]}], security: [%{"oAuth" => ["push"]}],
responses: %{ responses: %{
200 => Operation.response("Push Subscription", "application/json", PushSubscription), 200 => Operation.response("Push subscription", "application/json", PushSubscription),
403 => Operation.response("Error", "application/json", ApiError), 403 => Operation.response("Error", "application/json", ApiError),
404 => Operation.response("Error", "application/json", ApiError) 404 => Operation.response("Error", "application/json", ApiError)
} }
@ -49,7 +49,7 @@ def show_operation do
def update_operation do def update_operation do
%Operation{ %Operation{
tags: ["Push Subscriptions"], tags: ["Push subscriptions"],
summary: "Change types of notifications", summary: "Change types of notifications",
description: description:
"Updates the current push subscription. Only the data part can be updated. To change fundamentals, a new subscription must be created instead.", "Updates the current push subscription. Only the data part can be updated. To change fundamentals, a new subscription must be created instead.",
@ -57,7 +57,7 @@ def update_operation do
security: [%{"oAuth" => ["push"]}], security: [%{"oAuth" => ["push"]}],
requestBody: Helpers.request_body("Parameters", update_request(), required: true), requestBody: Helpers.request_body("Parameters", update_request(), required: true),
responses: %{ responses: %{
200 => Operation.response("Push Subscription", "application/json", PushSubscription), 200 => Operation.response("Push subscription", "application/json", PushSubscription),
403 => Operation.response("Error", "application/json", ApiError) 403 => Operation.response("Error", "application/json", ApiError)
} }
} }
@ -65,7 +65,7 @@ def update_operation do
def delete_operation do def delete_operation do
%Operation{ %Operation{
tags: ["Push Subscriptions"], tags: ["Push subscriptions"],
summary: "Remove current subscription", summary: "Remove current subscription",
description: "Removes the current Web Push API subscription.", description: "Removes the current Web Push API subscription.",
operationId: "SubscriptionController.delete", operationId: "SubscriptionController.delete",

View file

@ -25,6 +25,8 @@ def home_operation do
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
parameters: [ parameters: [
local_param(), local_param(),
remote_param(),
only_media_param(),
with_muted_param(), with_muted_param(),
exclude_visibilities_param(), exclude_visibilities_param(),
reply_visibility_param() | pagination_params() reply_visibility_param() | pagination_params()
@ -41,8 +43,7 @@ def direct_operation do
tags: ["Timelines"], tags: ["Timelines"],
summary: "Direct timeline", summary: "Direct timeline",
description: description:
"View statuses with a “direct” privacy, from your account or in your notifications", "View statuses with a “direct” scope addressed to the account. Using this endpoint is discouraged, please use [conversations](#tag/Conversations) or [chats](#tag/Chats).",
deprecated: true,
parameters: [with_muted_param() | pagination_params()], parameters: [with_muted_param() | pagination_params()],
security: [%{"oAuth" => ["read:statuses"]}], security: [%{"oAuth" => ["read:statuses"]}],
operationId: "TimelineController.direct", operationId: "TimelineController.direct",
@ -61,6 +62,7 @@ def public_operation do
local_param(), local_param(),
instance_param(), instance_param(),
only_media_param(), only_media_param(),
remote_param(),
with_muted_param(), with_muted_param(),
exclude_visibilities_param(), exclude_visibilities_param(),
reply_visibility_param() | pagination_params() reply_visibility_param() | pagination_params()
@ -107,6 +109,7 @@ def hashtag_operation do
), ),
local_param(), local_param(),
only_media_param(), only_media_param(),
remote_param(),
with_muted_param(), with_muted_param(),
exclude_visibilities_param() | pagination_params() exclude_visibilities_param() | pagination_params()
], ],
@ -132,6 +135,9 @@ def list_operation do
required: true required: true
), ),
with_muted_param(), with_muted_param(),
local_param(),
remote_param(),
only_media_param(),
exclude_visibilities_param() | pagination_params() exclude_visibilities_param() | pagination_params()
], ],
operationId: "TimelineController.list", operationId: "TimelineController.list",
@ -198,4 +204,13 @@ defp only_media_param do
"Show only statuses with media attached?" "Show only statuses with media attached?"
) )
end end
defp remote_param do
Operation.parameter(
:remote,
:query,
%Schema{allOf: [BooleanLike], default: false},
"Show only remote statuses?"
)
end
end end

View file

@ -17,8 +17,8 @@ def open_api_operation(action) do
def follow_operation do def follow_operation do
%Operation{ %Operation{
tags: ["follow_import"], tags: ["Data import"],
summary: "Imports your follows.", summary: "Import follows",
operationId: "UserImportController.follow", operationId: "UserImportController.follow",
requestBody: request_body("Parameters", import_request(), required: true), requestBody: request_body("Parameters", import_request(), required: true),
responses: %{ responses: %{
@ -31,8 +31,8 @@ def follow_operation do
def blocks_operation do def blocks_operation do
%Operation{ %Operation{
tags: ["blocks_import"], tags: ["Data import"],
summary: "Imports your blocks.", summary: "Import blocks",
operationId: "UserImportController.blocks", operationId: "UserImportController.blocks",
requestBody: request_body("Parameters", import_request(), required: true), requestBody: request_body("Parameters", import_request(), required: true),
responses: %{ responses: %{
@ -45,8 +45,8 @@ def blocks_operation do
def mutes_operation do def mutes_operation do
%Operation{ %Operation{
tags: ["mutes_import"], tags: ["Data import"],
summary: "Imports your mutes.", summary: "Import mutes",
operationId: "UserImportController.mutes", operationId: "UserImportController.mutes",
requestBody: request_body("Parameters", import_request(), required: true), requestBody: request_body("Parameters", import_request(), required: true),
responses: %{ responses: %{

View file

@ -5,8 +5,8 @@
defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do
alias OpenApiSpex.Schema alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Schemas.Attachment alias Pleroma.Web.ApiSpec.Schemas.Attachment
alias Pleroma.Web.ApiSpec.Schemas.Poll
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
alias Pleroma.Web.ApiSpec.StatusOperation
require OpenApiSpex require OpenApiSpex
@ -29,7 +29,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do
spoiler_text: %Schema{type: :string, nullable: true}, spoiler_text: %Schema{type: :string, nullable: true},
visibility: %Schema{allOf: [VisibilityScope], nullable: true}, visibility: %Schema{allOf: [VisibilityScope], nullable: true},
scheduled_at: %Schema{type: :string, format: :"date-time", nullable: true}, scheduled_at: %Schema{type: :string, format: :"date-time", nullable: true},
poll: %Schema{allOf: [Poll], nullable: true}, poll: StatusOperation.poll_params(),
in_reply_to_id: %Schema{type: :string, nullable: true} in_reply_to_id: %Schema{type: :string, nullable: true}
} }
} }

View file

@ -23,6 +23,18 @@ defmodule Pleroma.Web.Endpoint do
# InstanceStatic needs to be before Plug.Static to be able to override shipped-static files # InstanceStatic needs to be before Plug.Static to be able to override shipped-static files
# If you're adding new paths to `only:` you'll need to configure them in InstanceStatic as well # If you're adding new paths to `only:` you'll need to configure them in InstanceStatic as well
# Cache-control headers are duplicated in case we turn off etags in the future # Cache-control headers are duplicated in case we turn off etags in the future
plug(
Pleroma.Web.Plugs.InstanceStatic,
at: "/",
from: :pleroma,
only: ["emoji", "images"],
gzip: true,
cache_control_for_etags: "public, max-age=1209600",
headers: %{
"cache-control" => "public, max-age=1209600"
}
)
plug(Pleroma.Web.Plugs.InstanceStatic, plug(Pleroma.Web.Plugs.InstanceStatic,
at: "/", at: "/",
gzip: true, gzip: true,

View file

@ -269,10 +269,14 @@ def relationships(%{assigns: %{user: user}} = conn, %{id: id}) do
def relationships(%{assigns: %{user: _user}} = conn, _), do: json(conn, []) def relationships(%{assigns: %{user: _user}} = conn, _), do: json(conn, [])
@doc "GET /api/v1/accounts/:id" @doc "GET /api/v1/accounts/:id"
def show(%{assigns: %{user: for_user}} = conn, %{id: nickname_or_id}) do def show(%{assigns: %{user: for_user}} = conn, %{id: nickname_or_id} = params) do
with %User{} = user <- User.get_cached_by_nickname_or_id(nickname_or_id, for: for_user), with %User{} = user <- User.get_cached_by_nickname_or_id(nickname_or_id, for: for_user),
:visible <- User.visible_for(user, for_user) do :visible <- User.visible_for(user, for_user) do
render(conn, "show.json", user: user, for: for_user) render(conn, "show.json",
user: user,
for: for_user,
embed_relationships: embed_relationships?(params)
)
else else
error -> user_visibility_error(conn, error) error -> user_visibility_error(conn, error)
end end
@ -454,7 +458,12 @@ def mutes(%{assigns: %{user: user}} = conn, params) do
conn conn
|> add_link_headers(users) |> add_link_headers(users)
|> render("index.json", users: users, for: user, as: :user) |> render("index.json",
users: users,
for: user,
as: :user,
embed_relationships: embed_relationships?(params)
)
end end
@doc "GET /api/v1/blocks" @doc "GET /api/v1/blocks"

View file

@ -51,6 +51,8 @@ def home(%{assigns: %{user: user}} = conn, params) do
|> Map.put(:reply_filtering_user, user) |> Map.put(:reply_filtering_user, user)
|> Map.put(:announce_filtering_user, user) |> Map.put(:announce_filtering_user, user)
|> Map.put(:user, user) |> Map.put(:user, user)
|> Map.put(:local_only, params[:local])
|> Map.delete(:local)
activities = activities =
[user.ap_id | User.following(user)] [user.ap_id | User.following(user)]
@ -190,6 +192,7 @@ def list(%{assigns: %{user: user}} = conn, %{list_id: id} = params) do
|> Map.put(:blocking_user, user) |> Map.put(:blocking_user, user)
|> Map.put(:user, user) |> Map.put(:user, user)
|> Map.put(:muting_user, user) |> Map.put(:muting_user, user)
|> Map.put(:local_only, params[:local])
# we must filter the following list for the user to avoid leaking statuses the user # we must filter the following list for the user to avoid leaking statuses the user
# does not actually have permission to see (for more info, peruse security issue #270). # does not actually have permission to see (for more info, peruse security issue #270).

View file

@ -262,7 +262,9 @@ defp do_render("show.json", %{user: user} = opts) do
} }
}, },
# Pleroma extension # Pleroma extensions
# Note: it's insecure to output :email but fully-qualified nickname may serve as safe stub
fqn: User.full_nickname(user),
pleroma: %{ pleroma: %{
ap_id: user.ap_id, ap_id: user.ap_id,
also_known_as: user.also_known_as, also_known_as: user.also_known_as,

View file

@ -45,6 +45,7 @@ def render("show.json", _) do
fields_limits: fields_limits(), fields_limits: fields_limits(),
post_formats: Config.get([:instance, :allowed_post_formats]) post_formats: Config.get([:instance, :allowed_post_formats])
}, },
stats: %{mau: Pleroma.User.active_user_count()},
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key) vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
} }
} }

View file

@ -20,9 +20,26 @@ def call(conn, _options) do
end end
end end
defp headers do def primary_frontend do
with %{"name" => frontend} <- Config.get([:frontends, :primary]),
available <- Config.get([:frontends, :available]),
%{} = primary_frontend <- Map.get(available, frontend) do
{:ok, primary_frontend}
end
end
def custom_http_frontend_headers do
with {:ok, %{"custom-http-headers" => custom_headers}} <- primary_frontend() do
custom_headers
else
_ -> []
end
end
def headers do
referrer_policy = Config.get([:http_security, :referrer_policy]) referrer_policy = Config.get([:http_security, :referrer_policy])
report_uri = Config.get([:http_security, :report_uri]) report_uri = Config.get([:http_security, :report_uri])
custom_http_frontend_headers = custom_http_frontend_headers()
headers = [ headers = [
{"x-xss-protection", "1; mode=block"}, {"x-xss-protection", "1; mode=block"},
@ -34,6 +51,13 @@ defp headers do
{"content-security-policy", csp_string()} {"content-security-policy", csp_string()}
] ]
headers =
if custom_http_frontend_headers do
custom_http_frontend_headers ++ headers
else
headers
end
if report_uri do if report_uri do
report_group = %{ report_group = %{
"group" => "csp-endpoint", "group" => "csp-endpoint",

View file

@ -0,0 +1,30 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.UserTrackingPlug do
alias Pleroma.User
import Plug.Conn, only: [assign: 3]
@update_interval :timer.hours(24)
def init(opts), do: opts
def call(%{assigns: %{user: %User{id: id} = user}} = conn, _) when not is_nil(id) do
with true <- needs_update?(user),
{:ok, user} <- User.update_last_active_at(user) do
assign(conn, :user, user)
else
_ -> conn
end
end
def call(conn, _), do: conn
defp needs_update?(%User{last_active_at: nil}), do: true
defp needs_update?(%User{last_active_at: last_active_at}) do
NaiveDateTime.diff(NaiveDateTime.utc_now(), last_active_at, :millisecond) >= @update_interval
end
end

View file

@ -56,6 +56,7 @@ defmodule Pleroma.Web.Router do
plug(Pleroma.Web.Plugs.UserEnabledPlug) plug(Pleroma.Web.Plugs.UserEnabledPlug)
plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) plug(Pleroma.Web.Plugs.SetUserSessionIdPlug)
plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug) plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug)
plug(Pleroma.Web.Plugs.UserTrackingPlug)
end end
pipeline :base_api do pipeline :base_api do
@ -319,6 +320,8 @@ defmodule Pleroma.Web.Router do
end end
scope "/oauth", Pleroma.Web.OAuth do scope "/oauth", Pleroma.Web.OAuth do
# Note: use /api/v1/accounts/verify_credentials for userinfo of signed-in user
get("/registration_details", OAuthController, :registration_details) get("/registration_details", OAuthController, :registration_details)
post("/mfa/verify", MFAController, :verify, as: :mfa_verify) post("/mfa/verify", MFAController, :verify, as: :mfa_verify)

View file

@ -6,7 +6,7 @@
</div> </div>
<span class="display-name" style="padding-left: 0.5em;"> <span class="display-name" style="padding-left: 0.5em;">
<bdi><%= raw (@author.name |> Formatter.emojify(@author.emoji)) %></bdi> <bdi><%= raw (@author.name |> Formatter.emojify(@author.emoji)) %></bdi>
<span class="nickname"><%= full_nickname(@author) %></span> <span class="nickname">@<%= full_nickname(@author) %></span>
</span> </span>
</a> </a>
</div> </div>

View file

@ -17,6 +17,8 @@ defmodule Pleroma.Web.EmbedView do
use Phoenix.HTML use Phoenix.HTML
defdelegate full_nickname(user), to: User
@media_types ["image", "audio", "video"] @media_types ["image", "audio", "video"]
defp fetch_media_type(%{"mediaType" => mediaType}) do defp fetch_media_type(%{"mediaType" => mediaType}) do
@ -30,11 +32,6 @@ defp open_content? do
) )
end end
defp full_nickname(user) do
%{host: host} = URI.parse(user.ap_id)
"@" <> user.nickname <> "@" <> host
end
defp status_title(%Activity{object: %Object{data: %{"name" => name}}}) when is_binary(name), defp status_title(%Activity{object: %Object{data: %{"name" => name}}}) when is_binary(name),
do: name do: name

View file

@ -17,12 +17,14 @@ def perform(%Job{
"object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}} "object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
} }
}) do }) do
attachments if Pleroma.Config.get([:instance, :cleanup_attachments], false) do
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end) attachments
|> fetch_objects |> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|> prepare_objects(actor, Enum.map(attachments, & &1["name"])) |> fetch_objects
|> filter_objects |> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|> do_clean |> filter_objects
|> do_clean
end
{:ok, :success} {:ok, :success}
end end

View file

@ -7,7 +7,7 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do
Worker which purges expired activity. Worker which purges expired activity.
""" """
use Oban.Worker, queue: :activity_expiration, max_attempts: 1 use Oban.Worker, queue: :activity_expiration, max_attempts: 1, unique: [period: :infinity]
import Ecto.Query import Ecto.Query

View file

@ -9,38 +9,50 @@ defmodule Pleroma.Workers.ScheduledActivityWorker do
use Pleroma.Workers.WorkerHelper, queue: "scheduled_activities" use Pleroma.Workers.WorkerHelper, queue: "scheduled_activities"
alias Pleroma.Config alias Pleroma.Repo
alias Pleroma.ScheduledActivity alias Pleroma.ScheduledActivity
alias Pleroma.User alias Pleroma.User
alias Pleroma.Web.CommonAPI
require Logger require Logger
@impl Oban.Worker @impl Oban.Worker
def perform(%Job{args: %{"activity_id" => activity_id}}) do def perform(%Job{args: %{"activity_id" => activity_id}}) do
if Config.get([ScheduledActivity, :enabled]) do with %ScheduledActivity{} = scheduled_activity <- find_scheduled_activity(activity_id),
case Pleroma.Repo.get(ScheduledActivity, activity_id) do %User{} = user <- find_user(scheduled_activity.user_id) do
%ScheduledActivity{} = scheduled_activity -> params = atomize_keys(scheduled_activity.params)
post_activity(scheduled_activity)
_ -> Repo.transaction(fn ->
Logger.error("#{__MODULE__} Couldn't find scheduled activity: #{activity_id}") {:ok, activity} = Pleroma.Web.CommonAPI.post(user, params)
end {:ok, _} = ScheduledActivity.delete(scheduled_activity)
activity
end)
else
{:error, :scheduled_activity_not_found} = error ->
Logger.error("#{__MODULE__} Couldn't find scheduled activity: #{activity_id}")
error
{:error, :user_not_found} = error ->
Logger.error("#{__MODULE__} Couldn't find user for scheduled activity: #{activity_id}")
error
end end
end end
defp post_activity(%ScheduledActivity{user_id: user_id, params: params} = scheduled_activity) do defp find_scheduled_activity(id) do
params = Map.new(params, fn {key, value} -> {String.to_existing_atom(key), value} end) with nil <- Repo.get(ScheduledActivity, id) do
{:error, :scheduled_activity_not_found}
with {:delete, {:ok, _}} <- {:delete, ScheduledActivity.delete(scheduled_activity)},
{:user, %User{} = user} <- {:user, User.get_cached_by_id(user_id)},
{:post, {:ok, _}} <- {:post, CommonAPI.post(user, params)} do
:ok
else
error ->
Logger.error(
"#{__MODULE__} Couldn't create a status from the scheduled activity: #{inspect(error)}"
)
end end
end end
defp find_user(id) do
with nil <- User.get_cached_by_id(id) do
{:error, :user_not_found}
end
end
defp atomize_keys(map) do
Map.new(map, fn
{key, value} when is_map(value) -> {String.to_existing_atom(key), atomize_keys(value)}
{key, value} -> {String.to_existing_atom(key), value}
end)
end
end end

View file

@ -194,7 +194,7 @@ defp deps do
{:restarter, path: "./restarter"}, {:restarter, path: "./restarter"},
{:majic, {:majic,
git: "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", git: "https://git.pleroma.social/pleroma/elixir-libraries/majic.git",
ref: "4c692e544b28d1f5e543fb8a44be090f8cd96f80"}, ref: "289cda1b6d0d70ccb2ba508a2b0bd24638db2880"},
{:open_api_spex, {:open_api_spex,
git: "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", git: "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git",
ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"}, ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"},

View file

@ -66,7 +66,7 @@
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"}, "jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"},
"libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"}, "libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"},
"linkify": {:hex, :linkify, "0.4.1", "f881eb3429ae88010cf736e6fb3eed406c187bcdd544902ec937496636b7c7b3", [:mix], [], "hexpm", "ce98693f54ae9ace59f2f7a8aed3de2ef311381a8ce7794804bd75484c371dda"}, "linkify": {:hex, :linkify, "0.4.1", "f881eb3429ae88010cf736e6fb3eed406c187bcdd544902ec937496636b7c7b3", [:mix], [], "hexpm", "ce98693f54ae9ace59f2f7a8aed3de2ef311381a8ce7794804bd75484c371dda"},
"majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "4c692e544b28d1f5e543fb8a44be090f8cd96f80", [ref: "4c692e544b28d1f5e543fb8a44be090f8cd96f80"]}, "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "289cda1b6d0d70ccb2ba508a2b0bd24638db2880", [ref: "289cda1b6d0d70ccb2ba508a2b0bd24638db2880"]},
"makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"},
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"}, "meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"},

View file

@ -0,0 +1,11 @@
defmodule Pleroma.Repo.Migrations.AddLastActiveAtToUsers do
use Ecto.Migration
def change do
alter table(:users) do
add(:last_active_at, :naive_datetime)
end
create_if_not_exists(index(:users, [:last_active_at]))
end
end

View file

@ -0,0 +1,29 @@
defmodule Pleroma.Repo.Migrations.RemoveDuplicatesFromActivityExpirationQueue do
use Ecto.Migration
import Ecto.Query, only: [from: 2]
def up do
duplicate_ids =
from(j in Oban.Job,
where: j.queue == "activity_expiration",
where: j.worker == "Pleroma.Workers.PurgeExpiredActivity",
where: j.state == "scheduled",
select:
{fragment("(?)->>'activity_id'", j.args), fragment("array_agg(?)", j.id), count(j.id)},
group_by: fragment("(?)->>'activity_id'", j.args),
having: count(j.id) > 1
)
|> Pleroma.Repo.all()
|> Enum.map(fn {_, ids, _} ->
max_id = Enum.max(ids)
List.delete(ids, max_id)
end)
|> List.flatten()
from(j in Oban.Job, where: j.id in ^duplicate_ids)
|> Pleroma.Repo.delete_all()
end
def down, do: :noop
end

View file

@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no"><!--server-generated-meta--><link rel=icon type=image/png href=/favicon.png><link href=/static/css/app.9a4c5ede37b2f0230836.css rel=stylesheet></head><body class=hidden><noscript>To use Pleroma, please enable JavaScript.</noscript><div id=app></div><script type=text/javascript src=/static/js/vendors~app.54838a79dee084ec3dad.js></script><script type=text/javascript src=/static/js/app.eb8f7164fc75862a251d.js></script></body></html> <!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no"><!--server-generated-meta--><link rel=icon type=image/png href=/favicon.png><link href=/static/css/app.9a4c5ede37b2f0230836.css rel=stylesheet></head><body class=hidden><noscript>To use Pleroma, please enable JavaScript.</noscript><div id=app></div><script type=text/javascript src=/static/js/vendors~app.3b02e2e5bd8cdca42216.js></script><script type=text/javascript src=/static/js/app.c6b8a1c86149ed63e6ff.js></script></body></html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more