1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Metadata do
8 def build_tags(params) do
10 Pleroma.Web.Metadata.Providers.RelMe,
11 Pleroma.Web.Metadata.Providers.RestrictIndexing
12 | activated_providers()
15 Enum.reduce(providers, "", fn parser, acc ->
18 |> parser.build_tags()
19 |> Enum.map(&to_tag/1)
20 |> Enum.map(&HTML.safe_to_string/1)
28 with {name, attrs, _content = []} <- data do
29 HTML.Tag.tag(name, attrs)
31 {name, attrs, content} ->
32 HTML.Tag.content_tag(name, content, attrs)
35 raise ArgumentError, message: "make_tag invalid args"
39 def activity_nsfw?(%{data: %{"sensitive" => sensitive}}) do
40 Pleroma.Config.get([__MODULE__, :unfurl_nsfw], false) == false and sensitive
43 def activity_nsfw?(_) do
47 defp activated_providers do
48 unless Pleroma.Config.restrict_unauthenticated_access?(:activities, :local) do
49 [Pleroma.Web.Metadata.Providers.Feed | Pleroma.Config.get([__MODULE__, :providers], [])]