Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / lib / pleroma / web / rich_media / parsers / ttl / aws_signed_url.ex
index d5710793929343ec05fe592a61e97396aded0d18..014c0935f44c3968fa3b3cfd1b84c229973b5ab0 100644 (file)
@@ -1,5 +1,8 @@
 defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl do
-  def run(data, url) do
+  @behaviour Pleroma.Web.RichMedia.Parser.TTL
+
+  @impl Pleroma.Web.RichMedia.Parser.TTL
+  def ttl(data, _url) do
     image = Map.get(data, :image)
 
     if is_aws_signed_url(image) do
@@ -7,7 +10,6 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl do
       |> parse_query_params()
       |> format_query_params()
       |> get_expiration_timestamp()
-      |> set_ttl(url)
     end
   end
 
@@ -47,8 +49,4 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl do
 
     Timex.to_unix(date) + String.to_integer(Map.get(params, "X-Amz-Expires"))
   end
-
-  defp set_ttl(ttl, url) do
-    Cachex.expire_at(:rich_media_cache, url, ttl * 1000)
-  end
 end