2 use actix_web::web::Data;
3 use lemmy_api_common::{
5 post::{GetSiteMetadata, GetSiteMetadataResponse},
6 request::fetch_site_metadata,
8 use lemmy_utils::{error::LemmyError, ConnectionId};
10 #[async_trait::async_trait(?Send)]
11 impl Perform for GetSiteMetadata {
12 type Response = GetSiteMetadataResponse;
14 #[tracing::instrument(skip(context, _websocket_id))]
17 context: &Data<LemmyContext>,
18 _websocket_id: Option<ConnectionId>,
19 ) -> Result<GetSiteMetadataResponse, LemmyError> {
20 let data: &Self = self;
22 let metadata = fetch_site_metadata(context.client(), &data.url).await?;
24 Ok(GetSiteMetadataResponse { metadata })