|
|
@ -1,4 +1,7 @@
|
|
|
|
use axum::{Json, extract::Path};
|
|
|
|
use axum::{
|
|
|
|
|
|
|
|
extract::Path,
|
|
|
|
|
|
|
|
response::{IntoResponse, Response},
|
|
|
|
|
|
|
|
};
|
|
|
|
use log::debug;
|
|
|
|
use log::debug;
|
|
|
|
use serde::Serialize;
|
|
|
|
use serde::Serialize;
|
|
|
|
|
|
|
|
|
|
|
@ -13,14 +16,23 @@ pub struct UsersResponse {
|
|
|
|
id: String,
|
|
|
|
id: String,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn users_get(Path(user): Path<String>) -> Json<UsersResponse> {
|
|
|
|
pub async fn users_get(Path(user): Path<String>) -> UsersResponse {
|
|
|
|
debug!("Got request for actor: {user}");
|
|
|
|
debug!("Got request for actor: {user}");
|
|
|
|
assert_eq!(user, USER);
|
|
|
|
assert_eq!(user, USER);
|
|
|
|
|
|
|
|
|
|
|
|
Json(UsersResponse {
|
|
|
|
UsersResponse {
|
|
|
|
context: "https://www.w3.org/ns/activitystreams".to_string(),
|
|
|
|
context: "https://www.w3.org/ns/activitystreams".to_string(),
|
|
|
|
r#type: "Person".to_string(),
|
|
|
|
r#type: "Person".to_string(),
|
|
|
|
name: "Sally Smith".to_string(),
|
|
|
|
name: "Sally Smith".to_string(),
|
|
|
|
id: "https://testhost.com/users/test".to_string(),
|
|
|
|
id: "https://testhost.com/users/test".to_string(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl IntoResponse for UsersResponse {
|
|
|
|
|
|
|
|
fn into_response(self) -> Response {
|
|
|
|
|
|
|
|
Response::builder()
|
|
|
|
|
|
|
|
.header("content-type", "application/activity+json; charset=utf-8")
|
|
|
|
|
|
|
|
.body(serde_json::to_string(&self).unwrap().into())
|
|
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|