1 defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
2 use Pleroma.Web, :controller
7 @instance Application.get_env(:pleroma, :instance)
9 def schemas(conn, _params) do
13 rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
14 href: Web.base_url() <> "/nodeinfo/2.0.json"
22 # Schema definition: https://github.com/jhass/nodeinfo/blob/master/schemas/2.0/schema.json
23 def nodeinfo(conn, %{"version" => "2.0"}) do
24 stats = Stats.get_stats()
30 version: Keyword.get(@instance, :version)
32 protocols: ["ostatus", "activitypub"],
37 openRegistrations: Keyword.get(@instance, :registrations_open),
40 total: stats.user_count || 0
42 localPosts: stats.status_count || 0
45 nodeName: Keyword.get(@instance, :name)
52 "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8"
57 def nodeinfo(conn, _) do
60 |> json(%{error: "Nodeinfo schema version not handled"})