carddav: Implement DAV Push

This commit is contained in:
Lennart
2025-01-15 17:14:33 +01:00
parent 618ed3b327
commit 751c2d1ce7
15 changed files with 276 additions and 113 deletions

View File

@@ -37,11 +37,16 @@ pub fn make_app<
auth_provider.clone(),
cal_store.clone(),
addr_store.clone(),
subscription_store,
subscription_store.clone(),
)
}))
.service(web::scope("/carddav").configure(|cfg| {
rustical_carddav::configure_dav(cfg, auth_provider.clone(), addr_store.clone())
rustical_carddav::configure_dav(
cfg,
auth_provider.clone(),
addr_store.clone(),
subscription_store,
)
}))
.service(
web::scope("/.well-known")

View File

@@ -9,6 +9,7 @@ use config::{DataStoreConfig, SqliteDataStoreConfig};
use rustical_dav::xml::multistatus::PropstatElement;
use rustical_store::auth::StaticUserStore;
use rustical_store::{AddressbookStore, CalendarStore, CollectionOperation, SubscriptionStore};
use rustical_store_sqlite::addressbook_store::SqliteAddressbookStore;
use rustical_store_sqlite::calendar_store::SqliteCalendarStore;
use rustical_store_sqlite::{create_db_pool, SqliteStore};
use rustical_xml::{XmlRootTag, XmlSerialize, XmlSerializeRoot};
@@ -56,7 +57,7 @@ async fn get_data_stores(
// Channel to watch for changes (for DAV Push)
let (send, recv) = tokio::sync::mpsc::channel(1000);
let addressbook_store = Arc::new(SqliteStore::new(db.clone()));
let addressbook_store = Arc::new(SqliteAddressbookStore::new(db.clone(), send.clone()));
let cal_store = Arc::new(SqliteCalendarStore::new(db.clone(), send));
let subscription_store = Arc::new(SqliteStore::new(db.clone()));
(addressbook_store, cal_store, subscription_store, recv)
@@ -107,7 +108,6 @@ async fn main() -> Result<()> {
tokio::spawn(async move {
let subscription_store = subscription_store_clone.clone();
while let Some(message) = update_recv.recv().await {
dbg!(&message);
if let Ok(subscribers) =
subscription_store.get_subscriptions(&message.topic).await
{