akkoma/lib/pleroma/web/media_proxy/invalidations/script.ex
2020-05-17 05:56:20 +03:00

16 lines
380 B
Elixir

defmodule Pleroma.Web.MediaProxy.Invalidation.Script do
@behaviour Pleroma.Web.MediaProxy.Invalidation
@impl Pleroma.Web.MediaProxy.Invalidation
def purge(urls, %{script_path: script_path} = _options) do
args =
urls
|> List.wrap()
|> Enum.uniq()
|> Enum.join(" ")
System.cmd(Path.expand(script_path), [args])
{:ok, "success"}
end
end