1
0
Fork 0
forked from alemi/upub

fix: webfinger/fetch if checks

This commit is contained in:
əlemi 2024-05-13 02:01:07 +02:00
parent 8a1afadea0
commit 21cde13f96
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -20,14 +20,16 @@ pub async fn view(
Query(query): Query<TryFetch>, Query(query): Query<TryFetch>,
) -> crate::Result<JsonLD<serde_json::Value>> { ) -> crate::Result<JsonLD<serde_json::Value>> {
let mut uid = ctx.uri("users", id.clone()); let mut uid = ctx.uri("users", id.clone());
if auth.is_local() && query.fetch && !ctx.is_local(&uid) { if auth.is_local() {
if id.starts_with('@') { if id.starts_with('@') {
if let Some((user, host)) = id.replacen('@', "", 1).split_once('@') { if let Some((user, host)) = id.replacen('@', "", 1).split_once('@') {
uid = ctx.webfinger(user, host).await?; uid = ctx.webfinger(user, host).await?;
} }
} }
if query.fetch && !ctx.is_local(&uid) {
ctx.fetch_user(&uid).await?; ctx.fetch_user(&uid).await?;
} }
}
let (followed_by_me, following_me) = match auth.my_id() { let (followed_by_me, following_me) = match auth.my_id() {
None => (None, None), None => (None, None),