Initial implementation of image preview proxy. Media proxy tests refactoring.
[akkoma] / lib / pleroma / web / mastodon_api / views / status_view.ex
index 24167f66f76f4f8a614b8dbc6439ee2456692b4e..2a206f743d101efbf4579eccc4ca57db62dfb417 100644 (file)
@@ -419,6 +419,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     [attachment_url | _] = attachment["url"]
     media_type = attachment_url["mediaType"] || attachment_url["mimeType"] || "image"
     href = attachment_url["href"] |> MediaProxy.url()
+    href_preview = attachment_url["href"] |> MediaProxy.preview_url()
 
     type =
       cond do
@@ -434,7 +435,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
       id: to_string(attachment["id"] || hash_id),
       url: href,
       remote_url: href,
-      preview_url: href,
+      preview_url: href_preview,
       text_url: href,
       type: type,
       description: attachment["name"],