mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 20:32:48 +00:00
Implement DAV Push
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user