]> Untitled Git - lemmy.git/blob - server/src/routes/federation.rs
Merge branch 'dev' into federation
[lemmy.git] / server / src / routes / federation.rs
1 use crate::apub;
2 use crate::settings::Settings;
3 use actix_web::web;
4
5 pub fn config(cfg: &mut web::ServiceConfig) {
6   if Settings::get().federation.enabled {
7     println!("federation enabled, host is {}", Settings::get().hostname);
8     cfg
9       .route(
10         "/federation/communities",
11         web::get().to(apub::community::get_apub_community_list),
12       )
13       // TODO: this needs to be moved to the actors (eg /federation/u/{}/inbox)
14       .route("/federation/inbox", web::post().to(apub::inbox::inbox))
15       .route(
16         "/federation/c/{_}/inbox",
17         web::post().to(apub::inbox::inbox),
18       )
19       .route(
20         "/federation/u/{_}/inbox",
21         web::post().to(apub::inbox::inbox),
22       )
23       .route(
24         "/federation/c/{community_name}",
25         web::get().to(apub::community::get_apub_community_http),
26       )
27       .route(
28         "/federation/c/{community_name}/followers",
29         web::get().to(apub::community::get_apub_community_followers),
30       )
31       .route(
32         "/federation/c/{community_name}/outbox",
33         web::get().to(apub::community::get_apub_community_outbox),
34       )
35       .route(
36         "/federation/u/{user_name}",
37         web::get().to(apub::user::get_apub_user),
38       )
39       .route(
40         "/federation/p/{post_id}",
41         web::get().to(apub::user::get_apub_user),
42       );
43   }
44 }