This commit is contained in:
Mirai Kumiko 2025-07-05 15:20:40 +02:00
parent 188bc08494
commit 4af88f3e1d
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
44 changed files with 1041 additions and 34 deletions

View file

@ -0,0 +1,52 @@
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