Update
This commit is contained in:
parent
188bc08494
commit
4af88f3e1d
44 changed files with 1041 additions and 34 deletions
52
lib/nulla_web/controllers/generic/nodeinfo_json.ex
Normal file
52
lib/nulla_web/controllers/generic/nodeinfo_json.ex
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue