Refactoring of config wrapper
This commit is contained in:
@@ -6,10 +6,8 @@
|
||||
defmodule MobilizonWeb.NodeInfoController do
|
||||
use MobilizonWeb, :controller
|
||||
|
||||
alias Mobilizon.{Events, Users}
|
||||
alias Mobilizon.CommonConfig
|
||||
alias Mobilizon.{Config, Events, Users}
|
||||
|
||||
@instance Application.get_env(:mobilizon, :instance)
|
||||
@node_info_supported_versions ["2.0", "2.1"]
|
||||
@node_info_schema_uri "http://nodeinfo.diaspora.software/ns/schema/"
|
||||
|
||||
@@ -35,14 +33,14 @@ defmodule MobilizonWeb.NodeInfoController do
|
||||
version: version,
|
||||
software: %{
|
||||
name: "mobilizon",
|
||||
version: Keyword.get(@instance, :version)
|
||||
version: Config.instance_version()
|
||||
},
|
||||
protocols: ["activitypub"],
|
||||
services: %{
|
||||
inbound: [],
|
||||
outbound: ["atom1.0"]
|
||||
},
|
||||
openRegistrations: CommonConfig.registrations_open?(),
|
||||
openRegistrations: Config.instance_registrations_open?(),
|
||||
usage: %{
|
||||
users: %{
|
||||
total: Users.count_users()
|
||||
@@ -51,14 +49,14 @@ defmodule MobilizonWeb.NodeInfoController do
|
||||
localComments: Events.count_local_comments()
|
||||
},
|
||||
metadata: %{
|
||||
nodeName: CommonConfig.instance_name(),
|
||||
nodeDescription: CommonConfig.instance_description()
|
||||
nodeName: Config.instance_name(),
|
||||
nodeDescription: Config.instance_description()
|
||||
}
|
||||
}
|
||||
|
||||
response =
|
||||
if version == "2.1" do
|
||||
put_in(response, [:software, :repository], Keyword.get(@instance, :repository))
|
||||
put_in(response, [:software, :repository], Config.instance_repository())
|
||||
else
|
||||
response
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user