chore: upgrade k-ap to 0.4.0
Map new fetched_at field in RemoteActor, read last_fetched_at from DB.
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.3.1"
|
version = "0.4.0"
|
||||||
source = "sparse+https://git.gabrielkaszewski.dev/api/packages/GKaszewski/cargo/"
|
source = "sparse+https://git.gabrielkaszewski.dev/api/packages/GKaszewski/cargo/"
|
||||||
checksum = "f73de37ac4feab6d7b78e73c60acbb07933c2be58dcbb12e8a34201f66e0480d"
|
checksum = "ccaa914953bfd45ea206e11826da8f61ce1fbe02f8fe0622880527046ad6ae24"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -4571,7 +4571,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.48.0",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
k-ap = { version = "0.3.1", registry = "gitea" }
|
k-ap = { version = "0.4.0", registry = "gitea" }
|
||||||
domain = { workspace = true }
|
domain = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ fn k_ap_actor_to_domain(a: k_ap::RemoteActor) -> DomainRemoteActor {
|
|||||||
display_name: a.display_name,
|
display_name: a.display_name,
|
||||||
avatar_url: a.avatar_url,
|
avatar_url: a.avatar_url,
|
||||||
outbox_url: a.outbox_url,
|
outbox_url: a.outbox_url,
|
||||||
last_fetched_at: chrono::Utc::now(),
|
last_fetched_at: a.fetched_at.unwrap_or_else(chrono::Utc::now),
|
||||||
bio: a.bio,
|
bio: a.bio,
|
||||||
banner_url: a.banner_url,
|
banner_url: a.banner_url,
|
||||||
also_known_as: a.also_known_as,
|
also_known_as: a.also_known_as,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
k-ap = { version = "0.3.1", registry = "gitea" }
|
k-ap = { version = "0.4.0", registry = "gitea" }
|
||||||
sqlx = { workspace = true }
|
sqlx = { workspace = true }
|
||||||
uuid = { workspace = true }
|
uuid = { workspace = true }
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ struct RemoteActorRow {
|
|||||||
followers_url: Option<String>,
|
followers_url: Option<String>,
|
||||||
following_url: Option<String>,
|
following_url: Option<String>,
|
||||||
also_known_as: Option<Vec<String>>,
|
also_known_as: Option<Vec<String>>,
|
||||||
|
last_fetched_at: Option<chrono::DateTime<chrono::Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn map_remote_actor(r: RemoteActorRow) -> RemoteActor {
|
fn map_remote_actor(r: RemoteActorRow) -> RemoteActor {
|
||||||
@@ -75,6 +76,7 @@ fn map_remote_actor(r: RemoteActorRow) -> RemoteActor {
|
|||||||
followers_url: r.followers_url,
|
followers_url: r.followers_url,
|
||||||
following_url: r.following_url,
|
following_url: r.following_url,
|
||||||
also_known_as: r.also_known_as.unwrap_or_default(),
|
also_known_as: r.also_known_as.unwrap_or_default(),
|
||||||
|
fetched_at: r.last_fetched_at,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +176,7 @@ impl FollowRepository for PgFederationRepository {
|
|||||||
"SELECT f.remote_actor_url AS url, f.status,
|
"SELECT f.remote_actor_url AS url, f.status,
|
||||||
COALESCE(r.handle,'') AS handle, COALESCE(r.inbox_url,'') AS inbox_url,
|
COALESCE(r.handle,'') AS handle, COALESCE(r.inbox_url,'') AS inbox_url,
|
||||||
r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
||||||
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as
|
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as, r.last_fetched_at
|
||||||
FROM federation_followers f
|
FROM federation_followers f
|
||||||
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
||||||
WHERE f.local_user_id=$1 AND f.status='accepted'",
|
WHERE f.local_user_id=$1 AND f.status='accepted'",
|
||||||
@@ -209,7 +211,7 @@ impl FollowRepository for PgFederationRepository {
|
|||||||
"SELECT f.remote_actor_url AS url, f.status,
|
"SELECT f.remote_actor_url AS url, f.status,
|
||||||
COALESCE(r.handle,'') AS handle, COALESCE(r.inbox_url,'') AS inbox_url,
|
COALESCE(r.handle,'') AS handle, COALESCE(r.inbox_url,'') AS inbox_url,
|
||||||
r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
||||||
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as
|
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as, r.last_fetched_at
|
||||||
FROM federation_followers f
|
FROM federation_followers f
|
||||||
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
||||||
WHERE f.local_user_id=$1 AND f.status='accepted'
|
WHERE f.local_user_id=$1 AND f.status='accepted'
|
||||||
@@ -261,7 +263,7 @@ impl FollowRepository for PgFederationRepository {
|
|||||||
sqlx::query_as::<_, RemoteActorRow>(
|
sqlx::query_as::<_, RemoteActorRow>(
|
||||||
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
||||||
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
||||||
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as
|
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as, r.last_fetched_at
|
||||||
FROM federation_followers f
|
FROM federation_followers f
|
||||||
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
||||||
WHERE f.local_user_id=$1 AND f.status='accepted'
|
WHERE f.local_user_id=$1 AND f.status='accepted'
|
||||||
@@ -305,7 +307,7 @@ impl FollowRepository for PgFederationRepository {
|
|||||||
sqlx::query_as::<_, RemoteActorRow>(
|
sqlx::query_as::<_, RemoteActorRow>(
|
||||||
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
||||||
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
||||||
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as
|
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as, r.last_fetched_at
|
||||||
FROM federation_followers f
|
FROM federation_followers f
|
||||||
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
||||||
WHERE f.local_user_id=$1 AND f.status='pending'",
|
WHERE f.local_user_id=$1 AND f.status='pending'",
|
||||||
@@ -389,7 +391,7 @@ impl FollowRepository for PgFederationRepository {
|
|||||||
sqlx::query_as::<_, RemoteActorRow>(
|
sqlx::query_as::<_, RemoteActorRow>(
|
||||||
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
||||||
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
||||||
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as
|
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as, r.last_fetched_at
|
||||||
FROM federation_following f
|
FROM federation_following f
|
||||||
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
||||||
WHERE f.local_user_id=$1",
|
WHERE f.local_user_id=$1",
|
||||||
@@ -410,7 +412,7 @@ impl FollowRepository for PgFederationRepository {
|
|||||||
sqlx::query_as::<_, RemoteActorRow>(
|
sqlx::query_as::<_, RemoteActorRow>(
|
||||||
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
"SELECT f.remote_actor_url AS url, COALESCE(r.handle,'') AS handle,
|
||||||
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
COALESCE(r.inbox_url,'') AS inbox_url, r.shared_inbox_url, r.display_name, r.avatar_url, r.outbox_url,
|
||||||
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as
|
r.bio, r.banner_url, r.followers_url, r.following_url, r.also_known_as, r.last_fetched_at
|
||||||
FROM federation_following f
|
FROM federation_following f
|
||||||
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
LEFT JOIN remote_actors r ON r.url=f.remote_actor_url
|
||||||
WHERE f.local_user_id=$1
|
WHERE f.local_user_id=$1
|
||||||
@@ -585,7 +587,7 @@ impl ActorRepository for PgFederationRepository {
|
|||||||
async fn get_remote_actor(&self, actor_url: &str) -> Result<Option<RemoteActor>> {
|
async fn get_remote_actor(&self, actor_url: &str) -> Result<Option<RemoteActor>> {
|
||||||
sqlx::query_as::<_, RemoteActorRow>(
|
sqlx::query_as::<_, RemoteActorRow>(
|
||||||
"SELECT url, handle, inbox_url, shared_inbox_url, display_name, avatar_url, outbox_url,
|
"SELECT url, handle, inbox_url, shared_inbox_url, display_name, avatar_url, outbox_url,
|
||||||
bio, banner_url, followers_url, following_url, also_known_as
|
bio, banner_url, followers_url, following_url, also_known_as, last_fetched_at
|
||||||
FROM remote_actors WHERE url=$1",
|
FROM remote_actors WHERE url=$1",
|
||||||
)
|
)
|
||||||
.bind(actor_url)
|
.bind(actor_url)
|
||||||
|
|||||||
@@ -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.3.1", registry = "gitea" }
|
k-ap = { version = "0.4.0", registry = "gitea" }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
nats = { workspace = true }
|
nats = { workspace = true }
|
||||||
|
|||||||
@@ -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.3.1", registry = "gitea" }
|
k-ap = { version = "0.4.0", registry = "gitea" }
|
||||||
activitypub = { workspace = true }
|
activitypub = { workspace = true }
|
||||||
postgres = { workspace = true }
|
postgres = { workspace = true }
|
||||||
postgres-federation = { workspace = true }
|
postgres-federation = { workspace = true }
|
||||||
|
|||||||
Reference in New Issue
Block a user