mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
Preparation of a carddav crate
This commit is contained in:
27
crates/carddav/Cargo.toml
Normal file
27
crates/carddav/Cargo.toml
Normal file
@@ -0,0 +1,27 @@
|
||||
[package]
|
||||
name = "rustical_carddav"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4.4"
|
||||
actix-web-httpauth = "0.8"
|
||||
anyhow = { version = "1.0", features = ["backtrace"] }
|
||||
base64 = "0.22"
|
||||
derive_more = "0.99"
|
||||
futures-util = "0.3"
|
||||
quick-xml = { version = "0.31", features = [
|
||||
"serde",
|
||||
"serde-types",
|
||||
"serialize",
|
||||
] }
|
||||
roxmltree = "0.20"
|
||||
rustical_store = { path = "../store/" }
|
||||
rustical_dav = { path = "../dav/" }
|
||||
rustical_auth = { path = "../auth/" }
|
||||
serde = { version = "1.0", features = ["serde_derive", "derive"] }
|
||||
serde_json = "1.0"
|
||||
tokio = { version = "1.35", features = ["sync", "full"] }
|
||||
async-trait = "0.1"
|
||||
thiserror = "1.0"
|
||||
strum = { version = "0.26.2", features = ["strum_macros", "derive"] }
|
||||
24
crates/carddav/src/lib.rs
Normal file
24
crates/carddav/src/lib.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use actix_web::{web, HttpResponse, Responder};
|
||||
use rustical_auth::CheckAuthentication;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub fn configure_well_known(cfg: &mut web::ServiceConfig, carddav_root: String) {
|
||||
cfg.service(web::redirect("/carddav", carddav_root).permanent());
|
||||
}
|
||||
|
||||
pub fn configure_dav<A: CheckAuthentication>(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
prefix: String,
|
||||
auth: Arc<A>,
|
||||
) {
|
||||
}
|
||||
|
||||
async fn options_handler() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.insert_header((
|
||||
"Allow",
|
||||
"OPTIONS, GET, HEAD, POST, PUT, REPORT, PROPFIND, PROPPATCH, MKCOL",
|
||||
))
|
||||
.insert_header(("DAV", "1, 2, 3, addressbook, extended-mkcol"))
|
||||
.body("options")
|
||||
}
|
||||
Reference in New Issue
Block a user