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 chat = Application.get_env(:pleroma, :chat)
26 gopher = Application.get_env(:pleroma, :gopher)
27 stats = Stats.get_stats()
33 version: Keyword.get(instance, :version)
35 protocols: ["ostatus", "activitypub"],
40 openRegistrations: Keyword.get(instance, :registrations_open),
43 total: stats.user_count || 0
45 localPosts: stats.status_count || 0
48 nodeName: Keyword.get(instance, :name),
49 nodeDescription: Keyword.get(instance, :description),
50 mediaProxy: Keyword.get(media_proxy, :enabled),
51 private: !Keyword.get(instance, :public, true),
53 enabled: Keyword.get(suggestions, :enabled, false),
54 thirdPartyEngine: Keyword.get(suggestions, :third_party_engine, ""),
55 timeout: Keyword.get(suggestions, :timeout, 5000),
56 web: Keyword.get(suggestions, :web, "")
58 chat: Keyword.get(chat, :enabled),
59 gopher: Keyword.get(gopher, :enabled)
66 "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8"
71 def nodeinfo(conn, _) do
74 |> json(%{error: "Nodeinfo schema version not handled"})