port: 8536
# json web token for authorization between server and client
jwt_secret: "changeme"
+ # whether to enable activitypub federation. this feature is in alpha, do not enable in production, as might
+ # cause problems like remote instances fetching and permanently storing bad data.
+ federation_enabled: false
# rate limits for various user actions, by user ip
rate_limit: {
# maximum number of messages created in interval
// Create Http server with websocket support
HttpServer::new(move || {
- App::new()
+ let app = App::new()
.data(server.clone())
// Front end routes
.service(actix_files::Files::new("/static", front_end_dir()))
.route(
"/federation/u/{user_name}",
web::get().to(apub::user::get_apub_user))
- .route(
+ .route("/feeds/all.xml", web::get().to(feeds::get_all_feed));
+
+ // Federation
+ if Settings::get().federation_enabled {
+ app.route(
".well-known/webfinger",
web::get().to(webfinger::get_webfinger_response),
)
+ } else {
+ app
+ }
})
.bind((settings.bind, settings.port))
.unwrap()
Ok(site_view) => site_view,
Err(_e) => return HttpResponse::InternalServerError().finish(),
};
+ let protocols = if Settings::get().federation_enabled {
+ vec!["activitypub"]
+ } else {
+ vec![]
+ };
let json = json!({
"version": "2.0",
"software": {
"name": "lemmy",
"version": version::VERSION,
},
- "protocols": [],
+ "protocols": protocols,
"usage": {
"users": {
"total": site_view.number_of_users
pub jwt_secret: String,
pub rate_limit: RateLimitConfig,
pub email: Option<EmailConfig>,
+ pub federation_enabled: bool,
}
#[derive(Debug, Deserialize)]