diff --git a/cave/src/feed.rs b/cave/src/feed.rs index fb5a1a7..f347b4b 100644 --- a/cave/src/feed.rs +++ b/cave/src/feed.rs @@ -74,6 +74,8 @@ pub struct Post { pub language: Option, #[serde(default)] pub media_attachments: Vec, + #[serde(default)] + pub reblog: Option>, } impl Post { diff --git a/hunter/src/worker.rs b/hunter/src/worker.rs index 60e56fe..1122d9d 100644 --- a/hunter/src/worker.rs +++ b/hunter/src/worker.rs @@ -192,6 +192,10 @@ async fn process_posts( if ! posts_cache.insert(post.uri.clone()) { let t1 = Instant::now(); + // introduce instances from reblog authors + if let Some(reblog_account_host) = post.reblog.as_ref().and_then(|reblog| reblog.account.host()) { + introduce_hosts.insert(reblog_account_host); + } // introduce instances from mentions for mention in &post.mentions { if let Some(user_host) = mention.user_host() { @@ -199,15 +203,14 @@ async fn process_posts( } } - // check if it's an actual post, not a repost - if let Some(author_host) = post.account.host() { + // check if it's an actual post + if let Some(account_host) = post.account.host() { // send away to redis if store.save_post(post).await == Ok(true) { new_posts += 1; } - - // introduce instances from authors - introduce_hosts.insert(author_host); + // introduce instances from accounts + introduce_hosts.insert(account_host); } else { tracing::warn!("drop repost ({:?} on {})", post.account.host(), host); }