lemmy/server/src/routes/federation.rs

39 lines
1.1 KiB
Rust
Raw Normal View History

use super::*;
use crate::apub;
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
// TODO: check the user/community params for these
2020-04-14 15:37:23 +00:00
.route(
2020-04-17 14:55:28 +00:00
"/federation/c/{community_name}/inbox",
web::post().to(apub::community_inbox::community_inbox),
2020-04-14 15:37:23 +00:00
)
.route(
2020-04-17 14:55:28 +00:00
"/federation/u/{user_name}/inbox",
web::post().to(apub::user_inbox::user_inbox),
2020-04-14 15:37:23 +00:00
)
2020-01-02 18:22:23 +00:00
.route(
"/federation/c/{community_name}",
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),
)
.route(
"/federation/p/{post_id}",
2020-04-17 13:46:08 +00:00
web::get().to(apub::post::get_apub_post),
2020-01-02 18:22:23 +00:00
);
}
}