2020-05-15 18:34:46 +00:00
|
|
|
defmodule Pleroma.Web.MediaProxy.Invalidation.Script do
|
|
|
|
@behaviour Pleroma.Web.MediaProxy.Invalidation
|
|
|
|
|
|
|
|
@impl Pleroma.Web.MediaProxy.Invalidation
|
2020-05-16 12:16:33 +00:00
|
|
|
def purge(urls, %{script_path: script_path} = _options) do
|
|
|
|
args =
|
|
|
|
urls
|
|
|
|
|> List.wrap()
|
|
|
|
|> Enum.uniq()
|
|
|
|
|> Enum.join(" ")
|
|
|
|
|
|
|
|
System.cmd(Path.expand(script_path), [args])
|
2020-05-15 18:34:46 +00:00
|
|
|
{:ok, "success"}
|
|
|
|
end
|
|
|
|
end
|