projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
AdminAPI: Allow to modify Terms of Service and Instance Panel via Admin API
[akkoma]
/
lib
/
pleroma
/
config.ex
diff --git
a/lib/pleroma/config.ex
b/lib/pleroma/config.ex
index 98099ca58a906955dd06191e564473a433948fad..97f87759554f325192b315222444a5f8fc6840bb 100644
(file)
--- a/
lib/pleroma/config.ex
+++ b/
lib/pleroma/config.ex
@@
-32,6
+32,8
@@
defmodule Pleroma.Config do
end
end
end
end
+ def fetch(key) when is_atom(key), do: fetch([key])
+
def fetch([root_key | keys]) do
Enum.reduce_while(keys, Application.fetch_env(:pleroma, root_key), fn
key, {:ok, config} when is_map(config) or is_list(config) ->
def fetch([root_key | keys]) do
Enum.reduce_while(keys, Application.fetch_env(:pleroma, root_key), fn
key, {:ok, config} when is_map(config) or is_list(config) ->
@@
-79,6
+81,16
@@
defmodule Pleroma.Config do
Application.delete_env(:pleroma, key)
end
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() != []
def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], [])
def oauth_consumer_enabled?, do: oauth_consumer_strategies() != []