lemmy/server/src/routes/federation.rs
2020-04-13 15:06:41 +02:00

38 lines
1.2 KiB
Rust

use crate::apub;
use crate::settings::Settings;
use actix_web::web;
pub fn config(cfg: &mut web::ServiceConfig) {
if Settings::get().federation.enabled {
println!("federation enabled, host is {}", Settings::get().hostname);
cfg
.route(
"/federation/communities",
web::get().to(apub::community::get_apub_community_list),
)
// TODO: this needs to be moved to the actors (eg /federation/u/{}/inbox)
.route("/federation/inbox", web::post().to(apub::inbox::inbox))
.route("/federation/inbox", web::post().to(apub::inbox::inbox))
.route(
"/federation/c/{community_name}",
web::get().to(apub::community::get_apub_community_http),
)
.route(
"/federation/c/{community_name}/followers",
web::get().to(apub::community::get_apub_community_followers),
)
.route(
"/federation/c/{community_name}/outbox",
web::get().to(apub::community::get_apub_community_outbox),
)
.route(
"/federation/u/{user_name}",
web::get().to(apub::user::get_apub_user),
)
.route(
"/federation/p/{post_id}",
web::get().to(apub::user::get_apub_user),
);
}
}