1
0
Fork 0
forked from alemi/upub

fix: don't embed remote objects when dispatching

weak check but should still save some bytes
This commit is contained in:
əlemi 2024-04-22 22:42:00 +02:00
parent e810abcff0
commit 3c6b2ae3e6
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -76,8 +76,16 @@ async fn worker(db: DatabaseConnection, domain: String, poll_interval: u64, mut
.one(&db)
.await? // TODO probably should not fail here and at least re-insert the delivery
{
Some((activity, Some(object))) => activity.ap().set_object(Node::object(object.ap())),
Some((activity, None)) => activity.ap(),
Some((activity, Some(object))) => {
// embed local object when dispatching
// TODO this .contains() is jank, could trick us into embedding remote activities
if object.id.contains(&domain) {
activity.ap().set_object(Node::object(object.ap()))
} else {
activity.ap()
}
},
None => {
tracing::warn!("skipping dispatch for deleted object {}", delivery.activity);
continue;