Change how CalDAV/CardDAV services are initialised

This commit is contained in:
Lennart
2025-01-26 14:13:56 +01:00
parent 33b7f748b8
commit 8fda600e7f
3 changed files with 68 additions and 77 deletions

View File

@@ -2,6 +2,8 @@ use actix_web::body::MessageBody;
use actix_web::dev::{ServiceFactory, ServiceRequest, ServiceResponse};
use actix_web::middleware::NormalizePath;
use actix_web::{web, App};
use rustical_caldav::caldav_service;
use rustical_carddav::carddav_service;
use rustical_frontend::{configure_frontend, FrontendConfig};
use rustical_store::auth::AuthenticationProvider;
use rustical_store::{AddressbookStore, CalendarStore, SubscriptionStore};
@@ -27,23 +29,17 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
// .wrap(Logger::new("[%s] %r"))
.wrap(TracingLogger::default())
.wrap(NormalizePath::trim())
.service(web::scope("/caldav").configure(|cfg| {
rustical_caldav::configure_dav(
cfg,
auth_provider.clone(),
cal_store.clone(),
addr_store.clone(),
subscription_store.clone(),
)
}))
.service(web::scope("/carddav").configure(|cfg| {
rustical_carddav::configure_dav(
cfg,
auth_provider.clone(),
addr_store.clone(),
subscription_store,
)
}))
.service(web::scope("/caldav").service(caldav_service(
auth_provider.clone(),
cal_store.clone(),
addr_store.clone(),
subscription_store.clone(),
)))
.service(web::scope("/carddav").service(carddav_service(
auth_provider.clone(),
addr_store.clone(),
subscription_store,
)))
.service(
web::scope("/.well-known")
.service(web::redirect("/caldav", "/caldav"))