52 lines
1.1 KiB
Elixir
52 lines
1.1 KiB
Elixir
defmodule NullaWeb.Generic.NodeinfoJSON do
|
|
@doc """
|
|
Renders a nodeinfo.
|
|
"""
|
|
def index(url) do
|
|
Jason.OrderedObject.new(
|
|
links: [
|
|
Jason.OrderedObject.new(
|
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
|
href: "#{url}/nodeinfo/2.0"
|
|
)
|
|
]
|
|
)
|
|
end
|
|
|
|
@doc """
|
|
Renders a nodeinfo.
|
|
"""
|
|
def show(version, users, instance) do
|
|
Jason.OrderedObject.new(
|
|
version: "2.0",
|
|
software:
|
|
Jason.OrderedObject.new(
|
|
name: "nulla",
|
|
version: version
|
|
),
|
|
protocols: [
|
|
"activitypub"
|
|
],
|
|
services:
|
|
Jason.OrderedObject.new(
|
|
outbound: [],
|
|
inbound: []
|
|
),
|
|
usage:
|
|
Jason.OrderedObject.new(
|
|
users:
|
|
Jason.OrderedObject.new(
|
|
total: users.total,
|
|
activeMonth: users.month,
|
|
activeHalfyear: users.halfyear
|
|
)
|
|
),
|
|
openRegistrations: instance.registration,
|
|
metadata:
|
|
Jason.OrderedObject.new(
|
|
nodeName: instance.name,
|
|
nodeDescription: instance.description
|
|
)
|
|
)
|
|
end
|
|
end
|