defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
use Pleroma.Web, :controller
- alias Pleroma.{Repo, Activity, User, Notification}
+ alias Pleroma.{Repo, Activity, User, Notification, Stats}
alias Pleroma.Web
alias Pleroma.Web.MastodonAPI.{StatusView, AccountView, MastodonView}
alias Pleroma.Web.ActivityPub.ActivityPub
@instance Application.get_env(:pleroma, :instance)
def masto_instance(conn, _params) do
- user_count = Repo.aggregate(User.local_user_query, :count, :id)
response = %{
uri: Web.base_url,
title: Keyword.get(@instance, :name),
urls: %{
streaming_api: String.replace(Web.base_url, ["http","https"], "wss")
},
- stats: %{
- status_count: 2,
- user_count: user_count,
- domain_count: 3
- },
+ stats: Stats.get_stats,
+ thumbnail: Web.base_url <> "/instance/thumbnail.jpeg",
max_toot_chars: Keyword.get(@instance, :limit)
}
json(conn, response)
end
+ def peers(conn, _params) do
+ json(conn, Stats.get_peers)
+ end
+
defp mastodonized_emoji do
Pleroma.Formatter.get_custom_emoji()
|> Enum.map(fn {shortcode, relative_url} ->