mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
Make site metadata fetch endpoint require auth. (#4968)
* Make site metadata fetch require auth. * Update crates/api/src/post/get_link_metadata.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> --------- Co-authored-by: dullbananas <dull.bananas0@gmail.com>
This commit is contained in:
parent
63a686d390
commit
254ef6dab3
1 changed files with 3 additions and 0 deletions
|
@ -4,6 +4,7 @@ use lemmy_api_common::{
|
|||
post::{GetSiteMetadata, GetSiteMetadataResponse},
|
||||
request::fetch_link_metadata,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyResult},
|
||||
LemmyErrorType,
|
||||
|
@ -14,6 +15,8 @@ use url::Url;
|
|||
pub async fn get_link_metadata(
|
||||
data: Query<GetSiteMetadata>,
|
||||
context: Data<LemmyContext>,
|
||||
// Require an account for this API
|
||||
_local_user_view: LocalUserView,
|
||||
) -> LemmyResult<Json<GetSiteMetadataResponse>> {
|
||||
let url = Url::parse(&data.url).with_lemmy_type(LemmyErrorType::InvalidUrl)?;
|
||||
let metadata = fetch_link_metadata(&url, &context).await?;
|
||||
|
|
Loading…
Reference in a new issue