2020-04-19 18:08:25 -04:00
|
|
|
use super::*;
|
2019-12-31 07:55:33 -05:00
|
|
|
use crate::apub;
|
|
|
|
|
|
|
|
pub fn config(cfg: &mut web::ServiceConfig) {
|
2020-03-18 17:09:00 -04:00
|
|
|
if Settings::get().federation.enabled {
|
2020-01-02 13:22:23 -05:00
|
|
|
println!("federation enabled, host is {}", Settings::get().hostname);
|
|
|
|
cfg
|
2020-04-15 14:12:25 -04:00
|
|
|
// TODO: check the user/community params for these
|
2020-04-14 11:37:23 -04:00
|
|
|
.route(
|
2020-04-17 10:55:28 -04:00
|
|
|
"/federation/c/{community_name}/inbox",
|
2020-04-15 14:12:25 -04:00
|
|
|
web::post().to(apub::community_inbox::community_inbox),
|
2020-04-14 11:37:23 -04:00
|
|
|
)
|
|
|
|
.route(
|
2020-04-17 10:55:28 -04:00
|
|
|
"/federation/u/{user_name}/inbox",
|
2020-04-15 14:12:25 -04:00
|
|
|
web::post().to(apub::user_inbox::user_inbox),
|
2020-04-14 11:37:23 -04:00
|
|
|
)
|
2020-01-02 13:22:23 -05:00
|
|
|
.route(
|
|
|
|
"/federation/c/{community_name}",
|
2020-04-03 01:02:43 -04:00
|
|
|
web::get().to(apub::community::get_apub_community_http),
|
2020-01-02 13:22:23 -05:00
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/federation/c/{community_name}/followers",
|
|
|
|
web::get().to(apub::community::get_apub_community_followers),
|
|
|
|
)
|
2020-03-13 20:05:42 -04:00
|
|
|
.route(
|
|
|
|
"/federation/c/{community_name}/outbox",
|
|
|
|
web::get().to(apub::community::get_apub_community_outbox),
|
|
|
|
)
|
2020-01-02 13:22:23 -05:00
|
|
|
.route(
|
|
|
|
"/federation/u/{user_name}",
|
|
|
|
web::get().to(apub::user::get_apub_user),
|
|
|
|
)
|
2020-03-16 14:19:04 -04:00
|
|
|
.route(
|
|
|
|
"/federation/p/{post_id}",
|
2020-04-17 09:46:08 -04:00
|
|
|
web::get().to(apub::post::get_apub_post),
|
2020-01-02 13:22:23 -05:00
|
|
|
);
|
|
|
|
}
|
2019-12-31 07:55:33 -05:00
|
|
|
}
|