29 lines
612 B
Rust
29 lines
612 B
Rust
|
use crate::APUB_JSON_CONTENT_TYPE;
|
||
|
use actix_web::{body::Body, HttpResponse};
|
||
|
use serde::Serialize;
|
||
|
|
||
|
pub mod comment;
|
||
|
pub mod community;
|
||
|
pub mod post;
|
||
|
pub mod user;
|
||
|
|
||
|
/// Convert the data to json and turn it into an HTTP Response with the correct ActivityPub
|
||
|
/// headers.
|
||
|
fn create_apub_response<T>(data: &T) -> HttpResponse<Body>
|
||
|
where
|
||
|
T: Serialize,
|
||
|
{
|
||
|
HttpResponse::Ok()
|
||
|
.content_type(APUB_JSON_CONTENT_TYPE)
|
||
|
.json(data)
|
||
|
}
|
||
|
|
||
|
fn create_apub_tombstone_response<T>(data: &T) -> HttpResponse<Body>
|
||
|
where
|
||
|
T: Serialize,
|
||
|
{
|
||
|
HttpResponse::Gone()
|
||
|
.content_type(APUB_JSON_CONTENT_TYPE)
|
||
|
.json(data)
|
||
|
}
|