Provide an accept CSP policy for global search pictures

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-08-26 17:18:54 +02:00
parent 8812122168
commit 4db13046b7
4 changed files with 21 additions and 2 deletions

View File

@@ -32,6 +32,10 @@ defmodule Mobilizon.Service.GlobalSearch.Provider do
Page.t(EventResult.t())
@callback search_groups(search_options :: keyword) ::
Page.t(GroupResult.t())
@doc """
The CSP configuration to add for the service to work
"""
@callback csp() :: keyword()
@spec endpoint(atom()) :: String.t()
def endpoint(provider) do

View File

@@ -113,6 +113,16 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
end
end
@impl Provider
@doc """
Returns the CSP configuration for this search provider to work
"""
def csp do
:mobilizon
|> Application.get_env(__MODULE__, [])
|> Keyword.get(:csp_policy, [])
end
defp build_event(data) do
picture =
if data["banner"] do