mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 23:01:21 +00:00
Nutomic
366d9d1e2e
* Get rid of remaining Perform/SendActivity traits (fixes #3670) * fix api tests * ci
21 lines
661 B
Rust
21 lines
661 B
Rust
use actix_web::web::{Data, Json};
|
|
use lemmy_api_common::{
|
|
context::LemmyContext,
|
|
site::GetFederatedInstancesResponse,
|
|
utils::build_federated_instances,
|
|
};
|
|
use lemmy_db_views::structs::SiteView;
|
|
use lemmy_utils::error::LemmyError;
|
|
|
|
#[tracing::instrument(skip(context))]
|
|
pub async fn get_federated_instances(
|
|
context: Data<LemmyContext>,
|
|
) -> Result<Json<GetFederatedInstancesResponse>, LemmyError> {
|
|
let site_view = SiteView::read_local(&mut context.pool()).await?;
|
|
let federated_instances =
|
|
build_federated_instances(&site_view.local_site, &mut context.pool()).await?;
|
|
|
|
Ok(Json(GetFederatedInstancesResponse {
|
|
federated_instances,
|
|
}))
|
|
}
|