Add simple way to decode fully qualified mediaproxy URLs

This commit is contained in:
Mark Felder 2021-03-05 13:18:37 -06:00
parent 13aa98d689
commit e97b34f65d

View file

@ -121,6 +121,11 @@ defmodule Pleroma.Web.MediaProxy do
end
end
def decode_url(encoded) do
[_, "proxy", sig, base64 | _] = URI.parse(encoded).path |> String.split("/")
decode_url(sig, base64)
end
defp signed_url(url) do
:crypto.hmac(:sha, Config.get([Web.Endpoint, :secret_key_base]), url)
end