2019-12-31 12:55:33 +00:00
|
|
|
use crate::apub;
|
2020-01-02 18:22:23 +00:00
|
|
|
use crate::settings::Settings;
|
2020-04-09 19:04:31 +00:00
|
|
|
use actix_web::web;
|
2019-12-31 12:55:33 +00:00
|
|
|
|
|
|
|
pub fn config(cfg: &mut web::ServiceConfig) {
|
2020-03-18 21:09:00 +00:00
|
|
|
if Settings::get().federation.enabled {
|
2020-01-02 18:22:23 +00:00
|
|
|
println!("federation enabled, host is {}", Settings::get().hostname);
|
|
|
|
cfg
|
2020-04-03 05:02:43 +00:00
|
|
|
.route(
|
|
|
|
"/federation/communities",
|
|
|
|
web::get().to(apub::community::get_apub_community_list),
|
|
|
|
)
|
2020-04-10 11:26:06 +00:00
|
|
|
// TODO: this needs to be moved to the actors (eg /federation/u/{}/inbox)
|
2020-04-09 19:26:22 +00:00
|
|
|
.route(
|
|
|
|
"/federation/inbox",
|
|
|
|
web::post().to(apub::inbox::create_inbox),
|
|
|
|
)
|
2020-01-02 18:22:23 +00:00
|
|
|
.route(
|
|
|
|
"/federation/c/{community_name}",
|
2020-04-03 05:02:43 +00:00
|
|
|
web::get().to(apub::community::get_apub_community_http),
|
2020-01-02 18:22:23 +00:00
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/federation/c/{community_name}/followers",
|
|
|
|
web::get().to(apub::community::get_apub_community_followers),
|
|
|
|
)
|
2020-03-14 00:05:42 +00:00
|
|
|
.route(
|
|
|
|
"/federation/c/{community_name}/outbox",
|
|
|
|
web::get().to(apub::community::get_apub_community_outbox),
|
|
|
|
)
|
2020-01-02 18:22:23 +00:00
|
|
|
.route(
|
|
|
|
"/federation/u/{user_name}",
|
|
|
|
web::get().to(apub::user::get_apub_user),
|
|
|
|
)
|
2020-03-16 18:19:04 +00:00
|
|
|
.route(
|
|
|
|
"/federation/p/{post_id}",
|
|
|
|
web::get().to(apub::user::get_apub_user),
|
2020-01-02 18:22:23 +00:00
|
|
|
);
|
|
|
|
}
|
2019-12-31 12:55:33 +00:00
|
|
|
}
|