From 83b3db8e75d9013bfdc5825e67f8452bd1aed78b Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 15 Jul 2024 01:14:31 +0200 Subject: [PATCH] fix: base app ap id without trailing / --- upub/core/src/traits/fetch.rs | 8 ++++---- upub/routes/src/activitypub/application.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/upub/core/src/traits/fetch.rs b/upub/core/src/traits/fetch.rs index 0406b92..241385e 100644 --- a/upub/core/src/traits/fetch.rs +++ b/upub/core/src/traits/fetch.rs @@ -164,7 +164,7 @@ impl Fetcher for crate::Context { let document = Self::request( Method::GET, id, None, - &format!("https://{}/", self.domain()), self.pkey(), self.domain(), + self.base(), self.pkey(), self.domain(), ) .await? .json::() @@ -241,7 +241,7 @@ impl Fetcher for crate::Context { if let Ok(res) = Self::request( Method::GET, &format!("https://{domain}"), None, - &format!("https://{}/", self.domain()), self.pkey(), self.domain(), + self.base(), self.pkey(), self.domain(), ).await { if let Ok(actor) = res.json::().await { if let Ok(name) = actor.name() { @@ -280,7 +280,7 @@ impl Fetcher for crate::Context { if let Ok(followers_url) = document.followers().id() { let req = Self::request( Method::GET, followers_url, None, - &format!("https://{}/", self.domain()), self.pkey(), self.domain(), + self.base(), self.pkey(), self.domain(), ).await; if let Ok(res) = req { if let Ok(user_followers) = res.json::().await { @@ -294,7 +294,7 @@ impl Fetcher for crate::Context { if let Ok(following_url) = document.following().id() { let req = Self::request( Method::GET, following_url, None, - &format!("https://{}/", self.domain()), self.pkey(), self.domain(), + self.base(), self.pkey(), self.domain(), ).await; if let Ok(res) = req { if let Ok(user_following) = res.json::().await { diff --git a/upub/routes/src/activitypub/application.rs b/upub/routes/src/activitypub/application.rs index 34ec4e9..b314d75 100644 --- a/upub/routes/src/activitypub/application.rs +++ b/upub/routes/src/activitypub/application.rs @@ -33,7 +33,7 @@ pub async fn view( .set_url(apb::Node::link(upub::url!(ctx, "/"))) .set_public_key(apb::Node::object( apb::new() - .set_id(Some(&upub::url!(ctx, "/#main-key"))) + .set_id(Some(&upub::url!(ctx, "#main-key"))) .set_owner(Some(&upub::url!(ctx, ""))) .set_public_key_pem(&ctx.actor().public_key) ))