chore: stuff i forgot to commit ooops
This commit is contained in:
parent
756012ee69
commit
9d59c73c59
2 changed files with 13 additions and 12 deletions
|
@ -117,6 +117,18 @@ impl Context {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// get bare id, usually an uuid but unspecified
|
||||||
|
pub fn id(&self, uri: &str) -> String {
|
||||||
|
if uri.starts_with(&self.0.domain) {
|
||||||
|
uri.split('/').last().unwrap_or("").to_string()
|
||||||
|
} else {
|
||||||
|
uri
|
||||||
|
.replace("https://", "+")
|
||||||
|
.replace("http://", "+")
|
||||||
|
.replace('/', "@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// get full user id uri
|
/// get full user id uri
|
||||||
pub fn uid(&self, id: String) -> String {
|
pub fn uid(&self, id: String) -> String {
|
||||||
self.uri("users", id)
|
self.uri("users", id)
|
||||||
|
@ -132,17 +144,6 @@ impl Context {
|
||||||
self.uri("activities", id)
|
self.uri("activities", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get bare id, usually an uuid but unspecified
|
|
||||||
pub fn id(&self, uri: &str) -> String {
|
|
||||||
if uri.starts_with(&self.0.domain) {
|
|
||||||
uri.split('/').last().unwrap_or("").to_string()
|
|
||||||
} else {
|
|
||||||
uri
|
|
||||||
.replace("https://", "+")
|
|
||||||
.replace("http://", "+")
|
|
||||||
.replace('/', "@")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn server(id: &str) -> String {
|
pub fn server(id: &str) -> String {
|
||||||
id
|
id
|
||||||
|
|
|
@ -319,7 +319,7 @@ impl apb::server::Inbox for Context {
|
||||||
// TODO in theory we could work with just object_id but right now only accept embedded
|
// TODO in theory we could work with just object_id but right now only accept embedded
|
||||||
let undone_activity = activity.object().extract().ok_or_else(UpubError::bad_request)?;
|
let undone_activity = activity.object().extract().ok_or_else(UpubError::bad_request)?;
|
||||||
let undone_aid = undone_activity.id().ok_or_else(UpubError::bad_request)?;
|
let undone_aid = undone_activity.id().ok_or_else(UpubError::bad_request)?;
|
||||||
let undone_object_id = undone_activity.object().id().ok_or_else(UpubError::bad_request)?;
|
let undone_object_uri = undone_activity.object().id().ok_or_else(UpubError::bad_request)?;
|
||||||
let activity_type = undone_activity.activity_type().ok_or_else(UpubError::bad_request)?;
|
let activity_type = undone_activity.activity_type().ok_or_else(UpubError::bad_request)?;
|
||||||
let undone_activity_author = undone_activity.actor().id().ok_or_else(UpubError::bad_request)?;
|
let undone_activity_author = undone_activity.actor().id().ok_or_else(UpubError::bad_request)?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue