routing changes

This commit is contained in:
Lennart
2025-06-09 17:19:25 +02:00
parent 8f29a468db
commit 2ba0beeafc
6 changed files with 97 additions and 56 deletions

View File

@@ -1,3 +1,5 @@
use axum::response::Redirect;
use axum::routing::any;
use axum::{Extension, Router};
use derive_more::Constructor;
pub use error::Error;
@@ -36,8 +38,16 @@ pub fn carddav_router<AP: AuthenticationProvider, A: AddressbookStore, S: Subscr
auth_provider.clone(),
subscription_store.clone(),
);
RootResourceService::<_, User, CardDavPrincipalUri>::new(principal_service.clone())
.axum_router()
.layer(AuthenticationLayer::new(auth_provider))
.layer(Extension(CardDavPrincipalUri(prefix)))
Router::new()
.nest(
prefix,
RootResourceService::<_, User, CardDavPrincipalUri>::new(principal_service.clone())
.axum_router()
.layer(AuthenticationLayer::new(auth_provider))
.layer(Extension(CardDavPrincipalUri(prefix))),
)
.route(
"/.well-known/carddav",
any(async || Redirect::permanent(prefix)),
)
}