aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/config.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-08-14 20:55:45 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-08-14 20:55:45 +0300
commit95529ab709b14acbf0b4ef2c17a76e0540e1e84e (patch)
tree0ec69c4651bdc8fd1ff8c6b9beb937f4062a0b6d /lib/pleroma/config.ex
parent33e508d7c6bae4f2b48568c50e1573fb4cbcffd3 (diff)
downloadpleroma-95529ab709b14acbf0b4ef2c17a76e0540e1e84e.tar.gz
[#2046] Defaulted pleroma/restrict_unauthenticated basing on instance privacy setting (i.e. restrict on private instances only by default).
Diffstat (limited to 'lib/pleroma/config.ex')
-rw-r--r--lib/pleroma/config.ex10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex
index a8329cc1e..97f877595 100644
--- a/lib/pleroma/config.ex
+++ b/lib/pleroma/config.ex
@@ -81,6 +81,16 @@ defmodule Pleroma.Config do
Application.delete_env(:pleroma, key)
end
+ def restrict_unauthenticated_access?(resource, kind) do
+ setting = get([:restrict_unauthenticated, resource, kind])
+
+ if setting in [nil, :if_instance_is_private] do
+ !get!([:instance, :public])
+ else
+ setting
+ end
+ end
+
def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], [])
def oauth_consumer_enabled?, do: oauth_consumer_strategies() != []