From: Mark Felder Date: Fri, 5 Mar 2021 19:18:37 +0000 (-0600) Subject: Add simple way to decode fully qualified mediaproxy URLs X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=e97b34f65d71b3dd11aab151fe7ce6def315635a;p=akkoma Add simple way to decode fully qualified mediaproxy URLs --- diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index 27f337138..d0d4bb4b3 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -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