Skip to content

Commit

Permalink
aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
CutestNekoAqua committed Nov 23, 2024
1 parent 35905c8 commit 366c2b7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/activities/create_post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use activitypub_federation::{
protocol::{context::WithContext, helpers::deserialize_one_or_many},
traits::{ActivityHandler, Object},
};
use reqwest::RequestBuilder;
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
use serde::{Deserialize, Serialize};
use tracing::{info, warn};
Expand Down Expand Up @@ -125,11 +126,20 @@ async fn federate_inbox(note: crate::entities::post::Model) -> anyhow::Result<()
let req_client = request_client();
for inbox in array {
let push = req_client.post(inbox.clone())
.json(&json)
.send();
.json(&json);
warn!("{}", inbox.to_string());
tokio::spawn(push);
tokio::spawn(push_to_inbox(push));
}

Ok(())
}

async fn push_to_inbox(req: RequestBuilder) -> anyhow::Result<()>{
let req_client = request_client();
let response = req_client.execute(req.build()?).await?;

info!("{}", response.status());
info!("{:?}", response.text().await?);

Ok(())
}

0 comments on commit 366c2b7

Please sign in to comment.