2023-10-09 10:46:12 +00:00
|
|
|
use lemmy_api_common::{claims::Claims, context::LemmyContext, utils::check_user_valid};
|
|
|
|
use lemmy_db_views::structs::LocalUserView;
|
2024-09-23 15:26:50 +00:00
|
|
|
use lemmy_utils::error::LemmyResult;
|
2023-10-09 10:46:12 +00:00
|
|
|
|
2020-05-16 14:04:08 +00:00
|
|
|
pub mod feeds;
|
2020-08-05 16:00:00 +00:00
|
|
|
pub mod images;
|
2020-05-16 14:04:08 +00:00
|
|
|
pub mod nodeinfo;
|
|
|
|
pub mod webfinger;
|
2023-10-09 10:46:12 +00:00
|
|
|
|
|
|
|
#[tracing::instrument(skip_all)]
|
2024-04-10 14:14:11 +00:00
|
|
|
async fn local_user_view_from_jwt(jwt: &str, context: &LemmyContext) -> LemmyResult<LocalUserView> {
|
2024-01-19 16:21:43 +00:00
|
|
|
let local_user_id = Claims::validate(jwt, context).await?;
|
2024-09-23 15:26:50 +00:00
|
|
|
let local_user_view = LocalUserView::read(&mut context.pool(), local_user_id).await?;
|
2023-10-13 13:48:18 +00:00
|
|
|
check_user_valid(&local_user_view.person)?;
|
2023-10-09 10:46:12 +00:00
|
|
|
|
|
|
|
Ok(local_user_view)
|
|
|
|
}
|