From d975b0099045262a858985b195fbdb24d02adb43 Mon Sep 17 00:00:00 2001 From: silverpill Date: Thu, 4 Nov 2021 23:49:53 +0000 Subject: [PATCH] Use ActivityPub object ID for external_url field in token metadata --- src/mastodon_api/statuses/views.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mastodon_api/statuses/views.rs b/src/mastodon_api/statuses/views.rs index 7f3865d..a0e4be0 100644 --- a/src/mastodon_api/statuses/views.rs +++ b/src/mastodon_api/statuses/views.rs @@ -10,6 +10,7 @@ use crate::activitypub::activity::{ }; use crate::activitypub::actor::Actor; use crate::activitypub::deliverer::deliver_activity; +use crate::activitypub::views::get_object_url; use crate::config::Config; use crate::database::{Pool, get_database_client}; use crate::errors::{DatabaseError, HttpError}; @@ -221,12 +222,15 @@ async fn make_permanent( // Use IPFS logo if there's no image IPFS_LOGO.to_string() }; + let post_url = get_object_url( + &config.instance_url(), + &post.id, + ); let post_metadata = PostMetadata { name: format!("Post {}", post.id), description: post.content.clone(), image: get_ipfs_url(&post_image_cid), - // TODO: use absolute URL - external_url: format!("/post/{}", post.id), + external_url: post_url, }; let post_metadata_json = serde_json::to_string(&post_metadata) .map_err(|_| HttpError::InternalError)?