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,28 @@
defmodule NullaWeb.Generic.NodeinfoController do
use NullaWeb, :controller
alias Nulla.Accounts
alias NullaWeb.Generic.NodeinfoJSON
def index(conn, _params) do
url = NullaWeb.Endpoint.url()
json(conn, NodeinfoJSON.index(url))
end
def show(conn, _params) do
version = Application.spec(:nulla, :vsn) |> to_string()
total = Accounts.get_total_users_count()
month = Accounts.get_active_users_count(30)
halfyear = Accounts.get_active_users_count(180)
users = %{
total: total,
month: month,
halfyear: halfyear
}
instance = Application.get_env(:nulla, :instance) |> Map.new()
json(conn, NodeinfoJSON.show(version, users, instance))
end
end