bump k-ap 0.4.4, handle OutboundFollowAccepted w/ outbox backfill
This commit is contained in:
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -2017,9 +2017,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "k-ap"
|
name = "k-ap"
|
||||||
version = "0.4.0"
|
version = "0.4.4"
|
||||||
source = "sparse+https://git.gabrielkaszewski.dev/api/packages/GKaszewski/cargo/"
|
source = "sparse+https://git.gabrielkaszewski.dev/api/packages/GKaszewski/cargo/"
|
||||||
checksum = "ccaa914953bfd45ea206e11826da8f61ce1fbe02f8fe0622880527046ad6ae24"
|
checksum = "daec6ce514e07fc9c6e39a780f3144292534008a2c16c1645f131fad877c7894"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -4570,7 +4570,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
k-ap = { version = "0.4.0", registry = "gitea" }
|
k-ap = { version = "0.4.4", registry = "gitea" }
|
||||||
domain = { workspace = true }
|
domain = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|||||||
@@ -97,6 +97,11 @@ pub enum EventPayload {
|
|||||||
owner_user_id: String,
|
owner_user_id: String,
|
||||||
follower_inbox_url: String,
|
follower_inbox_url: String,
|
||||||
},
|
},
|
||||||
|
FederationOutboundFollowAccepted {
|
||||||
|
local_user_id: String,
|
||||||
|
remote_actor_url: String,
|
||||||
|
outbox_url: Option<String>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventPayload {
|
impl EventPayload {
|
||||||
@@ -124,6 +129,7 @@ impl EventPayload {
|
|||||||
Self::MentionReceived { .. } => "mentions.received",
|
Self::MentionReceived { .. } => "mentions.received",
|
||||||
Self::FederationDeliveryRequested { .. } => "federation.delivery.requested",
|
Self::FederationDeliveryRequested { .. } => "federation.delivery.requested",
|
||||||
Self::FederationBackfillRequested { .. } => "federation.backfill.requested",
|
Self::FederationBackfillRequested { .. } => "federation.backfill.requested",
|
||||||
|
Self::FederationOutboundFollowAccepted { .. } => "federation.outbound_follow.accepted",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -421,7 +427,8 @@ impl TryFrom<EventPayload> for DomainEvent {
|
|||||||
author_user_id: UserId::from_uuid(parse_uuid(&author_user_id, "author_user_id")?),
|
author_user_id: UserId::from_uuid(parse_uuid(&author_user_id, "author_user_id")?),
|
||||||
},
|
},
|
||||||
EventPayload::FederationDeliveryRequested { .. }
|
EventPayload::FederationDeliveryRequested { .. }
|
||||||
| EventPayload::FederationBackfillRequested { .. } => {
|
| EventPayload::FederationBackfillRequested { .. }
|
||||||
|
| EventPayload::FederationOutboundFollowAccepted { .. } => {
|
||||||
return Err(DomainError::Internal(
|
return Err(DomainError::Internal(
|
||||||
"federation infrastructure event — not a domain event".into(),
|
"federation infrastructure event — not a domain event".into(),
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
k-ap = { version = "0.4.0", registry = "gitea" }
|
k-ap = { version = "0.4.4", registry = "gitea" }
|
||||||
sqlx = { workspace = true }
|
sqlx = { workspace = true }
|
||||||
uuid = { workspace = true }
|
uuid = { workspace = true }
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ postgres = { workspace = true }
|
|||||||
postgres-search = { workspace = true }
|
postgres-search = { workspace = true }
|
||||||
postgres-federation = { workspace = true }
|
postgres-federation = { workspace = true }
|
||||||
activitypub = { workspace = true }
|
activitypub = { workspace = true }
|
||||||
k-ap = { version = "0.4.0", registry = "gitea" }
|
k-ap = { version = "0.4.4", registry = "gitea" }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
nats = { workspace = true }
|
nats = { workspace = true }
|
||||||
|
|||||||
@@ -70,6 +70,20 @@ impl k_ap::data::EventPublisher for KapPublisher {
|
|||||||
follower_inbox_url,
|
follower_inbox_url,
|
||||||
})?,
|
})?,
|
||||||
),
|
),
|
||||||
|
FederationEvent::OutboundFollowAccepted {
|
||||||
|
local_user_id,
|
||||||
|
remote_actor_url,
|
||||||
|
outbox_url,
|
||||||
|
} => (
|
||||||
|
"federation.outbound_follow.accepted",
|
||||||
|
serde_json::to_vec(
|
||||||
|
&event_payload::EventPayload::FederationOutboundFollowAccepted {
|
||||||
|
local_user_id: local_user_id.to_string(),
|
||||||
|
remote_actor_url,
|
||||||
|
outbox_url,
|
||||||
|
},
|
||||||
|
)?,
|
||||||
|
),
|
||||||
FederationEvent::DeliveryFailed { inbox, error, .. } => {
|
FederationEvent::DeliveryFailed { inbox, error, .. } => {
|
||||||
tracing::warn!(%inbox, %error, "AP delivery failed permanently");
|
tracing::warn!(%inbox, %error, "AP delivery failed permanently");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ application = { workspace = true }
|
|||||||
nats = { workspace = true }
|
nats = { workspace = true }
|
||||||
event-transport = { workspace = true }
|
event-transport = { workspace = true }
|
||||||
event-payload = { workspace = true }
|
event-payload = { workspace = true }
|
||||||
k-ap = { version = "0.4.0", registry = "gitea" }
|
k-ap = { version = "0.4.4", registry = "gitea" }
|
||||||
activitypub = { workspace = true }
|
activitypub = { workspace = true }
|
||||||
postgres = { workspace = true }
|
postgres = { workspace = true }
|
||||||
postgres-federation = { workspace = true }
|
postgres-federation = { workspace = true }
|
||||||
|
|||||||
@@ -104,6 +104,22 @@ async fn main() {
|
|||||||
.await;
|
.await;
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
EventPayload::FederationOutboundFollowAccepted {
|
||||||
|
remote_actor_url,
|
||||||
|
outbox_url,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
if let Some(outbox) = outbox_url {
|
||||||
|
infra
|
||||||
|
.raw_ap_service
|
||||||
|
.import_remote_outbox(&outbox, &remote_actor_url)
|
||||||
|
.await
|
||||||
|
.map_err(|e| DomainError::Internal(e.to_string()))
|
||||||
|
} else {
|
||||||
|
tracing::info!(%remote_actor_url, "outbound follow accepted but no outbox URL — skipping backfill");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ── domain events ──────────────────────────────────────
|
// ── domain events ──────────────────────────────────────
|
||||||
p => match DomainEvent::try_from(p) {
|
p => match DomainEvent::try_from(p) {
|
||||||
|
|||||||
Reference in New Issue
Block a user