diff --git a/config/config.exs b/config/config.exs
index 6696a4902..c4f89c40c 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -44,7 +44,8 @@ config :pleroma, :instance,
version: version,
name: "Pleroma",
email: "example@example.com",
- limit: 5000
+ limit: 5000,
+ registrations_open: true
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex
index 0e055a58a..3de77d220 100644
--- a/lib/pleroma/web/router.ex
+++ b/lib/pleroma/web/router.ex
@@ -98,6 +98,9 @@ defmodule Pleroma.Web.Router do
get "/statusnet/version", TwitterAPI.UtilController, :version
end
+ @instance Application.get_env(:pleroma, :instance)
+ @registrations_open Keyword.get(@instance, :registrations_open)
+
scope "/api", Pleroma.Web do
pipe_through :api
@@ -110,7 +113,9 @@ defmodule Pleroma.Web.Router do
get "/statuses/show/:id", TwitterAPI.Controller, :fetch_status
get "/statusnet/conversation/:id", TwitterAPI.Controller, :fetch_conversation
- post "/account/register", TwitterAPI.Controller, :register
+ if @registrations_open do
+ post "/account/register", TwitterAPI.Controller, :register
+ end
get "/externalprofile/show", TwitterAPI.Controller, :external_profile
end
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
index 25ed912c9..32910d92c 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -16,6 +16,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
#{Keyword.get(@instance, :name)}
#{Web.base_url}
#{Keyword.get(@instance, :limit)}
+ #{!Keyword.get(@instance, :registrations_open)}
"""
@@ -27,7 +28,8 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
site: %{
name: Keyword.get(@instance, :name),
server: Web.base_url,
- textlimit: Keyword.get(@instance, :limit)
+ textlimit: Keyword.get(@instance, :limit),
+ closed: if(Keyword.get(@instance, :registrations_open), do: "0", else: "1")
}
})
end