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