1 defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
2 use Pleroma.Web, :controller
7 def schemas(conn, _params) do
11 rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
12 href: Web.base_url() <> "/nodeinfo/2.0.json"
20 # Schema definition: https://github.com/jhass/nodeinfo/blob/master/schemas/2.0/schema.json
21 def nodeinfo(conn, %{"version" => "2.0"}) do
22 instance = Application.get_env(:pleroma, :instance)
23 media_proxy = Application.get_env(:pleroma, :media_proxy)
24 suggestions = Application.get_env(:pleroma, :suggestions)
25 stats = Stats.get_stats()
31 version: Keyword.get(instance, :version)
33 protocols: ["ostatus", "activitypub"],
38 openRegistrations: Keyword.get(instance, :registrations_open),
41 total: stats.user_count || 0
43 localPosts: stats.status_count || 0
46 nodeName: Keyword.get(instance, :name),
47 nodeDescription: Keyword.get(instance, :description),
48 mediaProxy: Keyword.get(media_proxy, :enabled),
49 private: !Keyword.get(instance, :public, true),
51 enabled: Keyword.get(suggestions, :enabled, false),
52 thirdPartyEngine: Keyword.get(suggestions, :third_party_engine, ""),
53 timeout: Keyword.get(suggestions, :timeout, 5000),
54 web: Keyword.get(suggestions, :web, "")
62 "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8"
67 def nodeinfo(conn, _) do
70 |> json(%{error: "Nodeinfo schema version not handled"})