: add mastodon quotes

This commit is contained in:
VC
2025-11-25 18:17:20 +01:00
parent cf5fe11b56
commit 43aa6dcd99
7 changed files with 590 additions and 584 deletions

View File

@@ -148,6 +148,31 @@ async fn get_record(
Ok(record)
}
/// Generate an quote embed record into Bsky
pub async fn generate_quote_records(
config: &BlueskyConfig,
quote_id: &str,
) -> Option<atrium_api::types::Union<atrium_api::app::bsky::feed::post::RecordEmbedRefs>> {
// if we cant match the quote_id, simply return None
let quote_record = match get_record(&config.handle, &rkey(quote_id)).await {
Ok(a) => a,
Err(_) => return None,
};
Some(atrium_api::types::Union::Refs(
atrium_api::app::bsky::feed::post::RecordEmbedRefs::AppBskyEmbedRecordMain(Box::new(
atrium_api::app::bsky::embed::record::MainData {
record: atrium_api::com::atproto::repo::strong_ref::MainData {
cid: quote_record.data.cid.unwrap(),
uri: quote_record.data.uri.to_owned(),
}
.into(),
}
.into(),
)),
))
}
/// Generate an embed card record into Bsky
/// If the preview image does not exist or fails to upload, it is simply ignored
pub async fn generate_embed_records(