honkoma/lib/pleroma/web/media_proxy/invalidation.ex

20 lines
463 B
Elixir
Raw Normal View History

2020-05-15 18:34:46 +00:00
defmodule Pleroma.Web.MediaProxy.Invalidation do
@callback purge(list(String.t()), map()) :: {:ok, String.t()} | {:error, String.t()}
alias Pleroma.Config
def purge(urls) do
[:media_proxy, :invalidation, :enabled]
|> Config.get()
|> do_purge(urls)
end
defp do_purge(true, urls) do
config = Config.get([:media_proxy, :invalidation])
config[:provider].purge(urls, config[:options])
:ok
end
defp do_purge(_, _), do: :ok
end