StaticFE Plug: Use phoenix helper to get the requested format.

This commit is contained in:
lain 2020-07-06 12:11:10 +02:00
parent ed4f9f6a29
commit 158c26d7dd

View File

@ -21,12 +21,6 @@ def call(conn, _) do
defp enabled?, do: Pleroma.Config.get([:static_fe, :enabled], false) defp enabled?, do: Pleroma.Config.get([:static_fe, :enabled], false)
defp requires_html?(conn) do defp requires_html?(conn) do
case get_req_header(conn, "accept") do Phoenix.Controller.get_format(conn) == "html"
[accept | _] ->
!String.contains?(accept, "json") && String.contains?(accept, "text/html")
_ ->
false
end
end end
end end