%{
"type" => "Image",
- "href" => url_for(Path.join(uuid, file.filename)),
+ "url" => [%{
+ "type" => "Link",
+ "mediaType" => file.content_type,
+ "href" => url_for(Path.join(uuid, file.filename))
+ }],
"name" => file.filename,
"uuid" => uuid
}
end
defp url_for(file) do
- host =
- Application.get_env(:pleroma, Pleroma.Web.Endpoint)
- |> Keyword.fetch!(:url)
- |> Keyword.fetch!(:host)
-
- protocol = Application.get_env(:pleroma, Pleroma.Web.Endpoint) |> Keyword.fetch!(:protocol)
-
- "#{protocol}://#{host}/media/#{file}"
+ "#{Pleroma.Web.base_url()}/media/#{file}"
end
end