forked from AkkomaGang/akkoma
Fix rich media relative path
This commit is contained in:
parent
bd89cdbe31
commit
cbadf9d333
1 changed files with 6 additions and 1 deletions
|
@ -184,6 +184,11 @@ def render("status.json", _) do
|
||||||
def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
||||||
page_url = rich_media[:url] || page_url
|
page_url = rich_media[:url] || page_url
|
||||||
page_url_data = URI.parse(page_url)
|
page_url_data = URI.parse(page_url)
|
||||||
|
|
||||||
|
image_url =
|
||||||
|
URI.merge(page_url_data, URI.parse(rich_media[:image]))
|
||||||
|
|> to_string
|
||||||
|
|
||||||
site_name = rich_media[:site_name] || page_url_data.host
|
site_name = rich_media[:site_name] || page_url_data.host
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
@ -191,7 +196,7 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
||||||
provider_name: site_name,
|
provider_name: site_name,
|
||||||
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
|
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
|
||||||
url: page_url,
|
url: page_url,
|
||||||
image: rich_media[:image] |> MediaProxy.url(),
|
image: image_url |> MediaProxy.url(),
|
||||||
title: rich_media[:title],
|
title: rich_media[:title],
|
||||||
description: rich_media[:description],
|
description: rich_media[:description],
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
|
Loading…
Reference in a new issue