forked from alemi/upub
fix: context querying
This commit is contained in:
parent
32dd5163bb
commit
49cee6cafa
2 changed files with 4 additions and 7 deletions
|
@ -26,13 +26,7 @@ pub async fn page(
|
||||||
Query(page): Query<Pagination>,
|
Query(page): Query<Pagination>,
|
||||||
AuthIdentity(auth): AuthIdentity,
|
AuthIdentity(auth): AuthIdentity,
|
||||||
) -> crate::Result<JsonLD<serde_json::Value>> {
|
) -> crate::Result<JsonLD<serde_json::Value>> {
|
||||||
let context = if id.starts_with('+') {
|
let context = ctx.context_id(&id);
|
||||||
id.replacen('+', "https://", 1).replace('@', "/")
|
|
||||||
} else if id.starts_with("tag:") {
|
|
||||||
id.clone()
|
|
||||||
} else {
|
|
||||||
url!(ctx, "/context/{id}") // TODO need a better way to figure out which ones are our contexts
|
|
||||||
};
|
|
||||||
|
|
||||||
crate::server::builders::paginate(
|
crate::server::builders::paginate(
|
||||||
url!(ctx, "/context/{id}/page"),
|
url!(ctx, "/context/{id}/page"),
|
||||||
|
|
|
@ -121,6 +121,9 @@ impl Context {
|
||||||
|
|
||||||
// TODO remove this!!
|
// TODO remove this!!
|
||||||
pub fn context_id(&self, id: &str) -> String {
|
pub fn context_id(&self, id: &str) -> String {
|
||||||
|
if id.starts_with("tag:") {
|
||||||
|
return id.to_string();
|
||||||
|
}
|
||||||
uriproxy::uri(self.base(), UriClass::Context, id)
|
uriproxy::uri(self.base(), UriClass::Context, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue