1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Preload do
8 def build_tags(%{assigns: %{csp_nonce: nonce}}, params) do
10 Enum.reduce(Pleroma.Config.get([__MODULE__, :providers], []), %{}, fn parser, acc ->
13 |> parser.generate_terms()
14 |> Enum.map(fn {k, v} -> {k, Base.encode64(Jason.encode!(v))} end)
23 |> build_script_tag(nonce)
24 |> HTML.safe_to_string()
29 def build_script_tag(content, nonce) do
30 HTML.Tag.content_tag(:script, HTML.raw(content),
31 id: "initial-results",
32 type: "application/json",