1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.MastodonAPI.InstanceView do
9 alias Pleroma.Web.ActivityPub.MRF
11 @mastodon_api_level "2.7.2"
13 def render("show.json", _) do
14 instance = Config.get(:instance)
17 uri: Pleroma.Web.base_url(),
18 title: Keyword.get(instance, :name),
19 description: Keyword.get(instance, :description),
20 version: "#{@mastodon_api_level} (compatible; #{Pleroma.Application.named_version()})",
21 email: Keyword.get(instance, :email),
23 streaming_api: Pleroma.Web.Endpoint.websocket_url()
25 stats: Pleroma.Stats.get_stats(),
26 thumbnail: Keyword.get(instance, :instance_thumbnail),
28 registrations: Keyword.get(instance, :registrations_open),
29 # Extra (not present in Mastodon):
30 max_toot_chars: Keyword.get(instance, :limit),
31 poll_limits: Keyword.get(instance, :poll_limits),
32 upload_limit: Keyword.get(instance, :upload_limit),
33 avatar_upload_limit: Keyword.get(instance, :avatar_upload_limit),
34 background_upload_limit: Keyword.get(instance, :background_upload_limit),
35 banner_upload_limit: Keyword.get(instance, :banner_upload_limit),
36 background_image: Keyword.get(instance, :background_image),
37 chat_limit: Keyword.get(instance, :chat_limit),
38 description_limit: Keyword.get(instance, :description_limit),
41 account_activation_required: Keyword.get(instance, :account_activation_required),
43 federation: federation(),
44 fields_limits: fields_limits(),
45 post_formats: Config.get([:instance, :allowed_post_formats])
47 vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
56 "mastodon_api_streaming",
58 "pleroma_explicit_addressing",
59 "shareable_emoji_packs",
61 "pleroma:api/v1/notifications:include_types_filter",
62 if Config.get([:media_proxy, :enabled]) do
65 if Config.get([:gopher, :enabled]) do
68 if Config.get([:chat, :enabled]) do
71 if Config.get([:instance, :allow_relay]) do
74 if Config.get([:instance, :safe_dm_mentions]) do
77 "pleroma_emoji_reactions",
78 "pleroma_chat_messages"
84 quarantined = Config.get([:instance, :quarantined_instances], [])
86 if Config.get([:mrf, :transparency]) do
87 {:ok, data} = MRF.describe()
90 |> Map.merge(%{quarantined_instances: quarantined})
94 |> Map.put(:enabled, Config.get([:instance, :federating]))
99 max_fields: Config.get([:instance, :max_account_fields]),
100 max_remote_fields: Config.get([:instance, :max_remote_account_fields]),
101 name_length: Config.get([:instance, :account_field_name_length]),
102 value_length: Config.get([:instance, :account_field_value_length])