Use ActivityPub object ID for external_url field in token metadata
This commit is contained in:
parent
fbb0bc01cd
commit
d975b00990
1 changed files with 6 additions and 2 deletions
|
@ -10,6 +10,7 @@ use crate::activitypub::activity::{
|
||||||
};
|
};
|
||||||
use crate::activitypub::actor::Actor;
|
use crate::activitypub::actor::Actor;
|
||||||
use crate::activitypub::deliverer::deliver_activity;
|
use crate::activitypub::deliverer::deliver_activity;
|
||||||
|
use crate::activitypub::views::get_object_url;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::database::{Pool, get_database_client};
|
use crate::database::{Pool, get_database_client};
|
||||||
use crate::errors::{DatabaseError, HttpError};
|
use crate::errors::{DatabaseError, HttpError};
|
||||||
|
@ -221,12 +222,15 @@ async fn make_permanent(
|
||||||
// Use IPFS logo if there's no image
|
// Use IPFS logo if there's no image
|
||||||
IPFS_LOGO.to_string()
|
IPFS_LOGO.to_string()
|
||||||
};
|
};
|
||||||
|
let post_url = get_object_url(
|
||||||
|
&config.instance_url(),
|
||||||
|
&post.id,
|
||||||
|
);
|
||||||
let post_metadata = PostMetadata {
|
let post_metadata = PostMetadata {
|
||||||
name: format!("Post {}", post.id),
|
name: format!("Post {}", post.id),
|
||||||
description: post.content.clone(),
|
description: post.content.clone(),
|
||||||
image: get_ipfs_url(&post_image_cid),
|
image: get_ipfs_url(&post_image_cid),
|
||||||
// TODO: use absolute URL
|
external_url: post_url,
|
||||||
external_url: format!("/post/{}", post.id),
|
|
||||||
};
|
};
|
||||||
let post_metadata_json = serde_json::to_string(&post_metadata)
|
let post_metadata_json = serde_json::to_string(&post_metadata)
|
||||||
.map_err(|_| HttpError::InternalError)?
|
.map_err(|_| HttpError::InternalError)?
|
||||||
|
|
Loading…
Reference in a new issue