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,13 +20,15 @@ pub async fn view(
Query(query): Query<TryFetch>,
) -> crate::Result<JsonLD<serde_json::Value>> {
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 let Some((user, host)) = id.replacen('@', "", 1).split_once('@') {
uid = ctx.webfinger(user, host).await?;
}
}
ctx.fetch_user(&uid).await?;
if query.fetch && !ctx.is_local(&uid) {
ctx.fetch_user(&uid).await?;
}
}
let (followed_by_me, following_me) = match auth.my_id() {