aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-05-12 13:38:11 -0500
committerAlex Gleason <alex@alexgleason.me>2021-05-12 15:07:31 -0500
commitab9eabdf20180f2dd8539cf5d3dc0fdc6412496b (patch)
tree3d9c077184c9f9aba5c335e90157ecaf6d754773 /lib/pleroma/web/mastodon_api
parentb221d77a6da07c684bdbc63ddf4500e0d7ffeae8 (diff)
downloadpleroma-ab9eabdf20180f2dd8539cf5d3dc0fdc6412496b.tar.gz
Add SetMeta filter to store uploaded image sizes
Diffstat (limited to 'lib/pleroma/web/mastodon_api')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index bac897a57..5dbdc309e 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -426,10 +426,26 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
type: type,
description: attachment["name"],
pleroma: %{mime_type: media_type},
+ meta: render("attachment_meta.json", %{attachment: attachment}),
blurhash: attachment["blurhash"]
}
end
+ def render("attachment_meta.json", %{
+ attachment: %{"url" => [%{"width" => width, "height" => height} | _]}
+ })
+ when is_integer(width) and is_integer(height) do
+ %{
+ original: %{
+ width: width,
+ height: height,
+ aspect: width / height
+ }
+ }
+ end
+
+ def render("attachment_meta.json", _), do: %{}
+
def render("context.json", %{activity: activity, activities: activities, user: user}) do
%{ancestors: ancestors, descendants: descendants} =
activities