diff --git a/src/activitypub/mod.rs b/src/activitypub/mod.rs index c9d90a45..aa520ef6 100644 --- a/src/activitypub/mod.rs +++ b/src/activitypub/mod.rs @@ -55,7 +55,7 @@ pub async fn view(State(ctx): State) -> Result, .set_public_key(Node::object( serde_json::Value::new_object() .set_id(Some(&url!(ctx, "#main-key"))) - .set_owner(Some(ctx.base())) + .set_owner(Some(&url!(ctx, ""))) .set_public_key_pem(&ctx.app().public_key) )) .ld_context() diff --git a/src/server.rs b/src/server.rs index 11b31574..afa6e029 100644 --- a/src/server.rs +++ b/src/server.rs @@ -19,7 +19,7 @@ struct ContextInner { #[macro_export] macro_rules! url { ($ctx:expr, $($args: tt)*) => { - format!("{}{}", $ctx.base(), format!($($args)*)) + format!("{}{}{}", $ctx.protocol(), $ctx.base(), format!($($args)*)) }; } @@ -86,6 +86,10 @@ impl Context { &self.0.domain } + pub fn protocol(&self) -> &str { + &self.0.protocol + } + pub fn uri(&self, entity: &str, id: String) -> String { if id.starts_with("http") { id } else { format!("{}{}/{}/{}", self.0.protocol, self.0.domain, entity, id)