From 254ef6dab371228367d4c3556be40d0050017546 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 13 Aug 2024 16:53:05 -0400 Subject: [PATCH] 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 --------- Co-authored-by: dullbananas --- crates/api/src/post/get_link_metadata.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/api/src/post/get_link_metadata.rs b/crates/api/src/post/get_link_metadata.rs index 0669408aa..e469b51c7 100644 --- a/crates/api/src/post/get_link_metadata.rs +++ b/crates/api/src/post/get_link_metadata.rs @@ -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, context: Data, + // Require an account for this API + _local_user_view: LocalUserView, ) -> LemmyResult> { let url = Url::parse(&data.url).with_lemmy_type(LemmyErrorType::InvalidUrl)?; let metadata = fetch_link_metadata(&url, &context).await?;