Change structure
This commit is contained in:
parent
01c2c57933
commit
ddfb58c041
16 changed files with 153 additions and 66 deletions
29
lib/nulla_web/controllers/activitypub/nodeinfo_controller.ex
Normal file
29
lib/nulla_web/controllers/activitypub/nodeinfo_controller.ex
Normal file
|
@ -0,0 +1,29 @@
|
|||
defmodule NullaWeb.ActivityPub.NodeinfoController do
|
||||
use NullaWeb, :controller
|
||||
alias Nulla.ActivityPub
|
||||
alias Nulla.Models.User
|
||||
alias Nulla.Models.InstanceSettings
|
||||
|
||||
def index(conn, _params) do
|
||||
domain = NullaWeb.Endpoint.host()
|
||||
|
||||
json(conn, ActivityPub.nodeinfo(domain))
|
||||
end
|
||||
|
||||
def show(conn, _params) do
|
||||
version = Application.spec(:nulla, :vsn) |> to_string()
|
||||
total = User.get_total_users_count()
|
||||
month = User.get_active_users_count(30)
|
||||
halfyear = User.get_active_users_count(180)
|
||||
|
||||
users = %{
|
||||
total: total,
|
||||
month: month,
|
||||
halfyear: halfyear
|
||||
}
|
||||
|
||||
instance_settings = InstanceSettings.get_instance_settings!()
|
||||
|
||||
json(conn, ActivityPub.nodeinfo(version, users, instance_settings))
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue