Implement DAV Push

This commit is contained in:
Lennart
2025-06-14 20:24:50 +02:00
parent 0c48507f0c
commit 03ae492483
23 changed files with 882 additions and 308 deletions

View File

@@ -34,6 +34,7 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
frontend_config: FrontendConfig,
oidc_config: Option<OidcConfig>,
nextcloud_login_config: NextcloudLoginConfig,
dav_push_enabled: bool,
) -> Router<()> {
let combined_cal_store = Arc::new(CombinedCalendarStore::new(
cal_store.clone(),
@@ -90,6 +91,13 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
nextcloud_login_router(auth_provider.clone()),
);
}
if dav_push_enabled {
router = router.merge(rustical_dav_push::subscription_service(
subscription_store.clone(),
));
}
router
.layer(
SessionManagerLayer::new(session_store)

View File

@@ -37,9 +37,14 @@ pub struct TracingConfig {
pub opentelemetry: bool,
}
fn default_true() -> bool {
true
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields, default)]
pub struct DavPushConfig {
#[serde(default = "default_true")]
pub enabled: bool,
#[serde(default)]
// Allowed Push servers, accepts any by default

View File

@@ -117,6 +117,7 @@ async fn main() -> Result<()> {
config.frontend.clone(),
config.oidc.clone(),
config.nextcloud_login.clone(),
config.dav_push.enabled,
);
let app = ServiceExt::<Request>::into_make_service(
NormalizePathLayer::trim_trailing_slash().layer(app),