aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <rbraun@Bobble.local>2017-09-15 14:39:32 +0200
committerRoger Braun <rbraun@Bobble.local>2017-09-15 14:39:32 +0200
commitc20530e7080e7c37f33a944933a5a84c95f0e387 (patch)
treecf6936c74a0a9fc4323164244b25f4efd029dca9 /lib
parent50409326a853db7bd9f538f0ddbec805c134920f (diff)
downloadpleroma-c20530e7080e7c37f33a944933a5a84c95f0e387.tar.gz
Add configuration option for registrations.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/router.ex7
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex4
2 files changed, 9 insertions, 2 deletions
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
<name>#{Keyword.get(@instance, :name)}</name>
<site>#{Web.base_url}</site>
<textlimit>#{Keyword.get(@instance, :limit)}</textlimit>
+ <closed>#{!Keyword.get(@instance, :registrations_open)}</closed>
</site>
</config>
"""
@@ -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