forked from AkkomaGang/akkoma
Add simple way to decode fully qualified mediaproxy URLs
This commit is contained in:
parent
13aa98d689
commit
e97b34f65d
1 changed files with 5 additions and 0 deletions
|
@ -121,6 +121,11 @@ def decode_url(sig, url) do
|
||||||
end
|
end
|
||||||
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
|
defp signed_url(url) do
|
||||||
:crypto.hmac(:sha, Config.get([Web.Endpoint, :secret_key_base]), url)
|
:crypto.hmac(:sha, Config.get([Web.Endpoint, :secret_key_base]), url)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue