mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
aaa
This commit is contained in:
parent
35905c8b12
commit
366c2b7e81
|
|
@ -16,6 +16,7 @@ use activitypub_federation::{
|
||||||
protocol::{context::WithContext, helpers::deserialize_one_or_many},
|
protocol::{context::WithContext, helpers::deserialize_one_or_many},
|
||||||
traits::{ActivityHandler, Object},
|
traits::{ActivityHandler, Object},
|
||||||
};
|
};
|
||||||
|
use reqwest::RequestBuilder;
|
||||||
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
|
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
@ -125,11 +126,20 @@ async fn federate_inbox(note: crate::entities::post::Model) -> anyhow::Result<()
|
||||||
let req_client = request_client();
|
let req_client = request_client();
|
||||||
for inbox in array {
|
for inbox in array {
|
||||||
let push = req_client.post(inbox.clone())
|
let push = req_client.post(inbox.clone())
|
||||||
.json(&json)
|
.json(&json);
|
||||||
.send();
|
|
||||||
warn!("{}", inbox.to_string());
|
warn!("{}", inbox.to_string());
|
||||||
tokio::spawn(push);
|
tokio::spawn(push_to_inbox(push));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
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(())
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue