fix(arch): move AP router assembly to bootstrap — presentation no longer depends on activitypub-base

This commit is contained in:
2026-05-14 16:09:21 +02:00
parent 970f5a1644
commit 004f3cd4d2
3 changed files with 24 additions and 31 deletions

View File

@@ -5,6 +5,14 @@ use std::net::SocketAddr;
use std::sync::Arc;
use tower_http::cors::{AllowOrigin, CorsLayer};
use tracing_subscriber::EnvFilter;
use activitypub_base::{
actor_handler::actor_handler,
followers_handler::{followers_handler, following_handler},
inbox::inbox_handler,
nodeinfo::{nodeinfo_handler, nodeinfo_well_known_handler},
outbox::outbox_handler,
webfinger::webfinger_handler,
};
#[tokio::main]
async fn main() {
@@ -32,7 +40,19 @@ async fn main() {
.allow_headers(tower_http::cors::Any)
};
let base = presentation::routes::router(&infra.fed_config)
let ap_router = axum::Router::new()
.route("/.well-known/webfinger", axum::routing::get(webfinger_handler))
.route("/.well-known/nodeinfo", axum::routing::get(nodeinfo_well_known_handler))
.route("/nodeinfo/2.0", axum::routing::get(nodeinfo_handler))
.route("/users/{username}", axum::routing::get(actor_handler))
.route("/users/{username}/inbox", axum::routing::post(inbox_handler))
.route("/users/{username}/outbox", axum::routing::get(outbox_handler))
.route("/users/{username}/followers", axum::routing::get(followers_handler))
.route("/users/{username}/following", axum::routing::get(following_handler))
.layer(infra.fed_config.middleware());
let base = presentation::routes::router()
.merge(ap_router)
.with_state(infra.state)
.layer(cors);