Add CSP Policy for pictures
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -16,7 +16,7 @@ defmodule Mobilizon.Service.Pictures.Unsplash do
|
||||
@doc """
|
||||
Unsplash implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
|
||||
"""
|
||||
@spec search(String.t(), keyword()) :: list(Information.t())
|
||||
@spec search(String.t(), keyword()) :: Information.t()
|
||||
def search(location, _options \\ []) do
|
||||
url = "#{unsplash_endpoint()}#{@unsplash_api}?query=#{location}&orientation=landscape"
|
||||
|
||||
@@ -42,6 +42,16 @@ defmodule Mobilizon.Service.Pictures.Unsplash 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 unsplash_app_name do
|
||||
Application.get_env(:mobilizon, __MODULE__) |> get_in([:app_name])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user