projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request 'Update elixir versions' (#512) from norm/akkoma:update-elixir...
[akkoma]
/
lib
/
pleroma
/
web
/
preload.ex
diff --git
a/lib/pleroma/web/preload.ex
b/lib/pleroma/web/preload.ex
index e8588bcc967d078a49b206c82403752ebf7cb52f..57705d2de9b281b20bc09b6f1c39d7a022ed7458 100644
(file)
--- a/
lib/pleroma/web/preload.ex
+++ b/
lib/pleroma/web/preload.ex
@@
-4,9
+4,8
@@
defmodule Pleroma.Web.Preload do
alias Phoenix.HTML
defmodule Pleroma.Web.Preload do
alias Phoenix.HTML
- require Logger
- def build_tags(
_conn
, params) do
+ def build_tags(
%{assigns: %{csp_nonce: nonce}}
, params) do
preload_data =
Enum.reduce(Pleroma.Config.get([__MODULE__, :providers], []), %{}, fn parser, acc ->
terms =
preload_data =
Enum.reduce(Pleroma.Config.get([__MODULE__, :providers], []), %{}, fn parser, acc ->
terms =
@@
-21,16
+20,17
@@
defmodule Pleroma.Web.Preload do
rendered_html =
preload_data
|> Jason.encode!()
rendered_html =
preload_data
|> Jason.encode!()
- |> build_script_tag()
+ |> build_script_tag(
nonce
)
|> HTML.safe_to_string()
rendered_html
end
|> HTML.safe_to_string()
rendered_html
end
- def build_script_tag(content) do
+ def build_script_tag(content
, nonce
) do
HTML.Tag.content_tag(:script, HTML.raw(content),
id: "initial-results",
HTML.Tag.content_tag(:script, HTML.raw(content),
id: "initial-results",
- type: "application/json"
+ type: "application/json",
+ nonce: nonce
)
end
end
)
end
end