dav: Make the get_members function more ergonomic

This commit is contained in:
Lennart
2025-06-09 20:35:25 +02:00
parent 0feaaaaca1
commit 0595920809
14 changed files with 121 additions and 96 deletions

View File

@@ -1,3 +1,4 @@
use crate::config::NextcloudLoginConfig;
use axum::Router;
use axum::extract::Request;
use axum::response::Response;
@@ -5,7 +6,7 @@ use headers::{HeaderMapExt, UserAgent};
use http::StatusCode;
use rustical_caldav::caldav_router;
use rustical_carddav::carddav_router;
use rustical_frontend::nextcloud_login::{NextcloudFlows, nextcloud_login_router};
use rustical_frontend::nextcloud_login::nextcloud_login_router;
use rustical_frontend::{FrontendConfig, frontend_router};
use rustical_oidc::OidcConfig;
use rustical_store::auth::AuthenticationProvider;
@@ -20,8 +21,6 @@ use tower_sessions::{Expiry, MemoryStore, SessionManagerLayer};
use tracing::Span;
use tracing::field::display;
use crate::config::NextcloudLoginConfig;
#[allow(clippy::too_many_arguments)]
pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
addr_store: Arc<AS>,
@@ -31,7 +30,6 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
frontend_config: FrontendConfig,
oidc_config: Option<OidcConfig>,
nextcloud_login_config: NextcloudLoginConfig,
nextcloud_flows_state: Arc<NextcloudFlows>,
) -> Router<()> {
let mut router = Router::new()
.merge(caldav_router(
@@ -63,7 +61,7 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
if nextcloud_login_config.enabled {
router = router.nest(
"/index.php/login/v2",
nextcloud_login_router(nextcloud_flows_state, auth_provider.clone()),
nextcloud_login_router(auth_provider.clone()),
);
}
router

View File

@@ -10,7 +10,6 @@ use config::{DataStoreConfig, SqliteDataStoreConfig};
use figment::Figment;
use figment::providers::{Env, Format, Toml};
use rustical_dav_push::DavPushController;
use rustical_frontend::nextcloud_login::NextcloudFlows;
use rustical_store::auth::AuthenticationProvider;
use rustical_store::{AddressbookStore, CalendarStore, CollectionOperation, SubscriptionStore};
use rustical_store_sqlite::addressbook_store::SqliteAddressbookStore;
@@ -110,8 +109,6 @@ async fn main() -> Result<()> {
}));
}
let nextcloud_flows = Arc::new(NextcloudFlows::default());
let app = make_app(
addr_store.clone(),
cal_store.clone(),
@@ -120,7 +117,6 @@ async fn main() -> Result<()> {
config.frontend.clone(),
config.oidc.clone(),
config.nextcloud_login.clone(),
nextcloud_flows.clone(),
);
let app = ServiceExt::<Request>::into_make_service(
NormalizePathLayer::trim_trailing_slash().layer(app),