1
0
Fork 0
forked from alemi/upub

fix: only fetch remote objects to avoid recursion

This commit is contained in:
əlemi 2024-04-18 04:50:06 +02:00
parent 3a79ca05a2
commit 93b5c0cd4a
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,7 @@ pub async fn view(
.await?
{
Some(activity) => Ok(JsonLD(serde_json::Value::from(activity).ld_context())),
None => if auth.is_local() && query.fetch {
None => if auth.is_local() && query.fetch && !ctx.is_local(&aid) {
Ok(JsonLD(ap_activity(ctx.fetch().activity(&aid).await?).ld_context()))
} else {
Err(UpubError::not_found())

View file

@ -44,7 +44,7 @@ pub async fn view(
{
Some(EmbeddedActivity { activity: _, object: Some(object) }) => Ok(JsonLD(ap_object(object).ld_context())),
Some(EmbeddedActivity { activity: _, object: None }) => Err(UpubError::not_found()),
None => if auth.is_local() && query.fetch {
None => if auth.is_local() && query.fetch && !ctx.is_local(&oid) {
Ok(JsonLD(ap_object(ctx.fetch().object(&oid).await?).ld_context()))
} else {
Err(UpubError::not_found())

View file

@ -102,7 +102,7 @@ pub async fn view(
},
// remote user TODDO doesn't work?
Some((user, None)) => Ok(JsonLD(ap_user(user).ld_context())),
None => if auth.is_local() && query.fetch {
None => if auth.is_local() && query.fetch && !ctx.is_local(&uid) {
Ok(JsonLD(ap_user(ctx.fetch().user(&uid).await?).ld_context()))
} else {
Err(UpubError::not_found())