Add `account_activation_required` to /api/v1/instance
[akkoma] / lib / pleroma / web / mastodon_api / views / instance_view.ex
index 8088306c3bd0c01f6f4d0d4ae725f48067a448a8..bb7bd2a9fa459bf108128966cae8eaf6bb5e7162 100644 (file)
@@ -23,7 +23,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
         streaming_api: Pleroma.Web.Endpoint.websocket_url()
       },
       stats: Pleroma.Stats.get_stats(),
-      thumbnail: Pleroma.Web.base_url() <> "/instance/thumbnail.jpeg",
+      thumbnail: instance_thumbnail(),
       languages: ["en"],
       registrations: Keyword.get(instance, :registrations_open),
       # Extra (not present in Mastodon):
@@ -36,6 +36,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
       background_image: Keyword.get(instance, :background_image),
       pleroma: %{
         metadata: %{
+          account_activation_required: Keyword.get(instance, :account_activation_required),
           features: features(),
           federation: federation()
         },
@@ -87,4 +88,9 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
     end
     |> Map.put(:enabled, Config.get([:instance, :federating]))
   end
+
+  defp instance_thumbnail do
+    Pleroma.Config.get([:instance, :instance_thumbnail]) ||
+      "#{Pleroma.Web.base_url()}/instance/thumbnail.jpeg"
+  end
 end