X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fmetadata.ex;h=0f2d8d1e73635f48ee9bfc0720bb8ede642ff726;hb=cd234a5321b9d33146b90be95d84fa67aa4f7707;hp=8793fc265ec76dcfe1a78eed1752c5602c1870a4;hpb=293f6a8b712246d0580f9eb113c798ae1ea3b634;p=akkoma
diff --git a/lib/pleroma/web/metadata.ex b/lib/pleroma/web/metadata.ex
index 8793fc265..0f2d8d1e7 100644
--- a/lib/pleroma/web/metadata.ex
+++ b/lib/pleroma/web/metadata.ex
@@ -1,13 +1,18 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.Metadata do
alias Phoenix.HTML
- @providers Pleroma.Config.get([__MODULE__, :providers], [])
-
def build_tags(params) do
- Enum.reduce(@providers, "", fn parser, acc ->
+ providers = [
+ Pleroma.Web.Metadata.Providers.RelMe,
+ Pleroma.Web.Metadata.Providers.RestrictIndexing
+ | activated_providers()
+ ]
+
+ Enum.reduce(providers, "", fn parser, acc ->
rendered_html =
params
|> parser.build_tags()
@@ -30,4 +35,20 @@ defmodule Pleroma.Web.Metadata do
raise ArgumentError, message: "make_tag invalid args"
end
end
+
+ def activity_nsfw?(%{data: %{"sensitive" => sensitive}}) do
+ Pleroma.Config.get([__MODULE__, :unfurl_nsfw], false) == false and sensitive
+ end
+
+ def activity_nsfw?(_) do
+ false
+ end
+
+ defp activated_providers do
+ unless Pleroma.Config.restrict_unauthenticated_access?(:activities, :local) do
+ [Pleroma.Web.Metadata.Providers.Feed | Pleroma.Config.get([__MODULE__, :providers], [])]
+ else
+ []
+ end
+ end
end