summaryrefslogtreecommitdiffstats
path: root/server/src/routes/federation.rs
blob: f4fffdad4ba2da13088925b4b2ded7b586c3acee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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::create_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),
      );
  }
}