Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / lib / pleroma / web / mastodon_api / views / instance_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.InstanceView do
6 use Pleroma.Web, :view
7
8 @mastodon_api_level "2.7.2"
9
10 def render("show.json", _) do
11 instance = Pleroma.Config.get(:instance)
12
13 %{
14 uri: Pleroma.Web.base_url(),
15 title: Keyword.get(instance, :name),
16 description: Keyword.get(instance, :description),
17 version: "#{@mastodon_api_level} (compatible; #{Pleroma.Application.named_version()})",
18 email: Keyword.get(instance, :email),
19 urls: %{
20 streaming_api: Pleroma.Web.Endpoint.websocket_url()
21 },
22 stats: Pleroma.Stats.get_stats(),
23 thumbnail: Pleroma.Web.base_url() <> "/instance/thumbnail.jpeg",
24 languages: ["en"],
25 registrations: Keyword.get(instance, :registrations_open),
26 # Extra (not present in Mastodon):
27 max_toot_chars: Keyword.get(instance, :limit),
28 poll_limits: Keyword.get(instance, :poll_limits),
29 upload_limit: Keyword.get(instance, :upload_limit),
30 avatar_upload_limit: Keyword.get(instance, :avatar_upload_limit),
31 background_upload_limit: Keyword.get(instance, :background_upload_limit),
32 banner_upload_limit: Keyword.get(instance, :banner_upload_limit)
33 }
34 end
35 end