fix: put bac protocol in urls
This commit is contained in:
parent
6a050c0bb4
commit
13f99532fe
2 changed files with 6 additions and 2 deletions
|
@ -55,7 +55,7 @@ pub async fn view(State(ctx): State<Context>) -> Result<Json<serde_json::Value>,
|
|||
.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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue