mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-21 17:34:37 +02:00
feat: add links in fields attribute
This commit is contained in:
13
src/util.rs
13
src/util.rs
@@ -4,7 +4,11 @@ use base64::encode;
|
||||
use egg_mode::tweet::Tweet;
|
||||
use futures::{stream, stream::StreamExt};
|
||||
use log::{error, info, warn};
|
||||
use megalodon::{mastodon::Mastodon, megalodon::Megalodon};
|
||||
use megalodon::{
|
||||
entities::UploadMedia::{AsyncAttachment, Attachment},
|
||||
mastodon::Mastodon,
|
||||
megalodon::Megalodon,
|
||||
};
|
||||
use reqwest::Url;
|
||||
use std::error::Error;
|
||||
use tokio::{
|
||||
@@ -49,7 +53,12 @@ pub async fn generate_media_ids(
|
||||
// it doesn’t matter if we can’t remove, cache_media fn is idempotent
|
||||
remove_file(&local_tweet_media_path).await.ok();
|
||||
|
||||
Ok::<String, ScootalooError>(mastodon_media.id)
|
||||
let id = match mastodon_media {
|
||||
Attachment(m) => m.id,
|
||||
AsyncAttachment(m) => m.id,
|
||||
};
|
||||
|
||||
Ok::<String, ScootalooError>(id)
|
||||
})
|
||||
})
|
||||
.buffered(4); // there are max four medias per tweet and they need to be treated in
|
||||
|
Reference in New Issue
Block a user