Compare commits

..

27 Commits

Author SHA1 Message Date
Lennart
60b45e70ad fix docker builds 2026-01-15 22:31:40 +01:00
Lennart
a0c33c82dd version 0.11.14 2026-01-15 13:32:45 +01:00
Lennart
8ae5e46abf Automatic repair for calendar objects with invalid VERSION:4.0 2026-01-15 13:30:14 +01:00
Lennart
48b2e614a8 Suppress ical invalid version error 2026-01-15 11:15:20 +01:00
Lennart K
f26214abb9 build Docker images for dev branch 2026-01-12 11:15:08 +01:00
Lennart
276e65d41a version 0.11.11 2026-01-10 13:37:24 +01:00
Lennart
7c3e9ecbc1 update ical-rs dev to remove panics 2026-01-10 13:35:14 +01:00
Lennart
53f81a9433 Add a startup test to check whether existing data will be compatible with v0.12 2026-01-10 13:22:49 +01:00
Lennart
55eabfde4a version 0.11.10 2026-01-04 00:06:43 +01:00
Lennart
5d9d6e3fdf update snapshots 2026-01-04 00:06:16 +01:00
Lennart
1567bc64ef addressbook-query: Fix filter matching for empty filters 2026-01-04 00:05:07 +01:00
Lennart
44ae995f29 Some small fixes on recurrence expansion 2025-12-31 19:54:06 +01:00
Lennart
9c1cd24d32 test data fix uid 2025-12-31 19:47:29 +01:00
Lennart
ff0c5697cf caldav expand: accept <prop> 2025-12-31 19:47:13 +01:00
Lennart
6ccb5a67e4 ical: Respect that calendar do not have to contain a main event 2025-12-31 17:55:58 +01:00
Lennart
da718dd290 caldav: Add import test case from RFC Appendix B 2025-12-31 17:55:30 +01:00
Lennart
4112347e24 more integration tests 2025-12-31 17:36:02 +01:00
Lennart
f4fd1cdd21 caldav max-resource-size: Fix namespace 2025-12-31 17:35:51 +01:00
Lennart
5f0ca67e54 docs: Add document to track progress of CardDAV support 2025-12-31 17:00:14 +01:00
Lennart
3aef9abe48 carddav: Add more integration tests 2025-12-31 16:50:55 +01:00
Lennart
9784f2b53f PUT object: Properly check If-None-Match header 2025-12-31 16:50:32 +01:00
Lennart
271fdfd686 PUT object: Return ETag 2025-12-31 16:17:34 +01:00
Lennart
4fabf74333 version 0.11.9 2025-12-31 15:58:49 +01:00
Lennart
7b154adec3 remove stray dbg! 2025-12-31 15:57:56 +01:00
Lennart
951a1e4bdc update mkdocs.yml 2025-12-31 15:57:23 +01:00
Lennart
8c44733d0a carddav: Fix namespace for max-resource-size 2025-12-31 15:57:13 +01:00
Lennart
829f7b727f carddav calendar-query: Add parsing support for limit 2025-12-31 15:15:07 +01:00
55 changed files with 2630 additions and 290 deletions

View File

@@ -2,7 +2,7 @@ name: Docker
on: on:
push: push:
branches: ["main"] branches: ["main", "dev"]
release: release:
types: ["published"] types: ["published"]

View File

@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "DELETE FROM calendarobjectchangelog WHERE (principal, cal_id, object_id) = (?, ?, ?);",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
},
"hash": "146e23ae4e0eaae4d65ac7563c67d4f295ccc2534dcc4b3bd710de773ed137f9"
}

View File

@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "UPDATE calendarobjects SET ics = ? WHERE (principal, cal_id, id) = (?, ?, ?);",
"describe": {
"columns": [],
"parameters": {
"Right": 4
},
"nullable": []
},
"hash": "354decac84758c88280f60fbf0f93dddc6c7ff92ac7b8ba44049d31df3c680e3"
}

View File

@@ -0,0 +1,38 @@
{
"db_name": "SQLite",
"query": "SELECT principal, cal_id, id, ics FROM calendarobjects WHERE ics LIKE '%VERSION:4.0%';",
"describe": {
"columns": [
{
"name": "principal",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "cal_id",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "ics",
"ordinal": 3,
"type_info": "Text"
}
],
"parameters": {
"Right": 0
},
"nullable": [
false,
false,
false,
false
]
},
"hash": "bdaa4bee8b01d0e3773e34672ed4805d1e71d24888f2227045afd90bf080fc23"
}

306
Cargo.lock generated
View File

@@ -154,7 +154,7 @@ dependencies = [
"rustc-hash", "rustc-hash",
"serde", "serde",
"serde_derive", "serde_derive",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -200,7 +200,7 @@ checksum = "9767c17d33a63daf6da5872ffaf2ab0c289cd73ce7ed4f41d5ddf9149c004873"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -335,7 +335,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -477,9 +477,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "base64ct" name = "base64ct"
version = "1.8.1" version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" checksum = "7d809780667f4410e7c41b07f52439b94d2bdf8528eeedc287fa38d3b7f95d82"
[[package]] [[package]]
name = "basic-toml" name = "basic-toml"
@@ -573,9 +573,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.51" version = "1.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"shlex", "shlex",
@@ -623,7 +623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3" checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3"
dependencies = [ dependencies = [
"chrono", "chrono",
"phf", "phf 0.12.1",
] ]
[[package]] [[package]]
@@ -655,9 +655,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.53" version = "4.5.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@@ -665,9 +665,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.53" version = "4.5.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@@ -684,7 +684,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -898,7 +898,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -932,7 +932,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim", "strsim",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -945,7 +945,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim", "strsim",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -956,7 +956,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
dependencies = [ dependencies = [
"darling_core 0.21.3", "darling_core 0.21.3",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -967,7 +967,7 @@ checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"
dependencies = [ dependencies = [
"darling_core 0.23.0", "darling_core 0.23.0",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -1010,7 +1010,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustc_version", "rustc_version",
"syn 2.0.112", "syn 2.0.114",
"unicode-xid", "unicode-xid",
] ]
@@ -1034,7 +1034,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -1241,9 +1241,9 @@ dependencies = [
[[package]] [[package]]
name = "find-msvc-tools" name = "find-msvc-tools"
version = "0.1.6" version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41"
[[package]] [[package]]
name = "flume" name = "flume"
@@ -1371,7 +1371,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -1484,9 +1484,9 @@ dependencies = [
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.4.12" version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54"
dependencies = [ dependencies = [
"atomic-waker", "atomic-waker",
"bytes", "bytes",
@@ -1494,7 +1494,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"http", "http",
"indexmap 2.12.1", "indexmap 2.13.0",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@@ -1771,7 +1771,23 @@ dependencies = [
[[package]] [[package]]
name = "ical" name = "ical"
version = "0.11.0" version = "0.11.0"
source = "git+https://github.com/lennart-k/ical-rs#dcd3b106758a054f46a5172103abb17972ad032d" source = "git+https://github.com/lennart-k/ical-rs?branch=dev#b1edcdf2bb7db5a302a5df3650218a9a16aefe0c"
dependencies = [
"chrono",
"chrono-tz",
"derive_more",
"itertools 0.14.0",
"lazy_static",
"phf 0.13.1",
"regex",
"rrule",
"thiserror 2.0.17",
]
[[package]]
name = "ical"
version = "0.11.0"
source = "git+https://github.com/lennart-k/ical-rs?rev=7c2ab1f3#7c2ab1f3abdca768f22d8a36627eebbdd7947e29"
dependencies = [ dependencies = [
"chrono", "chrono",
"chrono-tz", "chrono-tz",
@@ -1904,9 +1920,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.12.1" version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.16.1", "hashbrown 0.16.1",
@@ -1922,9 +1938,9 @@ checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb"
[[package]] [[package]]
name = "insta" name = "insta"
version = "1.45.1" version = "1.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "983e3b24350c84ab8a65151f537d67afbbf7153bb9f1110e03e9fa9b07f67a5c" checksum = "1b66886d14d18d420ab5052cbff544fc5d34d0b2cdd35eb5976aaa10a4a472e5"
dependencies = [ dependencies = [
"console", "console",
"once_cell", "once_cell",
@@ -2018,9 +2034,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.178" version = "0.2.180"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
[[package]] [[package]]
name = "libm" name = "libm"
@@ -2334,7 +2350,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -2569,7 +2585,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"proc-macro2-diagnostics", "proc-macro2-diagnostics",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -2593,7 +2609,18 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7"
dependencies = [ dependencies = [
"phf_shared", "phf_shared 0.12.1",
]
[[package]]
name = "phf"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
dependencies = [
"phf_macros",
"phf_shared 0.13.1",
"serde",
] ]
[[package]] [[package]]
@@ -2602,8 +2629,8 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbdcb6f01d193b17f0b9c3360fa7e0e620991b193ff08702f78b3ce365d7e61" checksum = "efbdcb6f01d193b17f0b9c3360fa7e0e620991b193ff08702f78b3ce365d7e61"
dependencies = [ dependencies = [
"phf_generator", "phf_generator 0.12.1",
"phf_shared", "phf_shared 0.12.1",
] ]
[[package]] [[package]]
@@ -2613,7 +2640,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cbb1126afed61dd6368748dae63b1ee7dc480191c6262a3b4ff1e29d86a6c5b" checksum = "2cbb1126afed61dd6368748dae63b1ee7dc480191c6262a3b4ff1e29d86a6c5b"
dependencies = [ dependencies = [
"fastrand", "fastrand",
"phf_shared", "phf_shared 0.12.1",
]
[[package]]
name = "phf_generator"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
dependencies = [
"fastrand",
"phf_shared 0.13.1",
]
[[package]]
name = "phf_macros"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"
dependencies = [
"phf_generator 0.13.1",
"phf_shared 0.13.1",
"proc-macro2",
"quote",
"syn 2.0.114",
] ]
[[package]] [[package]]
@@ -2625,6 +2675,15 @@ dependencies = [
"siphasher", "siphasher",
] ]
[[package]]
name = "phf_shared"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"
dependencies = [
"siphasher",
]
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.1.10" version = "1.1.10"
@@ -2642,7 +2701,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -2781,9 +2840,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.104" version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -2796,7 +2855,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
"version_check", "version_check",
"yansi", "yansi",
] ]
@@ -2821,7 +2880,7 @@ dependencies = [
"itertools 0.14.0", "itertools 0.14.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -2890,9 +2949,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.42" version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -3017,7 +3076,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -3148,9 +3207,9 @@ dependencies = [
[[package]] [[package]]
name = "rsa" name = "rsa"
version = "0.9.9" version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88" checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
dependencies = [ dependencies = [
"const-oid", "const-oid",
"digest", "digest",
@@ -3191,7 +3250,7 @@ dependencies = [
"regex", "regex",
"relative-path", "relative-path",
"rustc_version", "rustc_version",
"syn 2.0.112", "syn 2.0.114",
"unicode-ident", "unicode-ident",
] ]
@@ -3203,7 +3262,7 @@ checksum = "b3a8fb4672e840a587a66fc577a5491375df51ddb88f2a2c2a792598c326fe14"
dependencies = [ dependencies = [
"quote", "quote",
"rand 0.8.5", "rand 0.8.5",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -3236,7 +3295,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rust-embed-utils", "rust-embed-utils",
"syn 2.0.112", "syn 2.0.114",
"walkdir", "walkdir",
] ]
@@ -3273,7 +3332,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical" name = "rustical"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"argon2", "argon2",
@@ -3284,6 +3343,7 @@ dependencies = [
"figment", "figment",
"headers", "headers",
"http", "http",
"ical 0.11.0 (git+https://github.com/lennart-k/ical-rs?branch=dev)",
"insta", "insta",
"opentelemetry", "opentelemetry",
"opentelemetry-otlp", "opentelemetry-otlp",
@@ -3306,7 +3366,7 @@ dependencies = [
"serde", "serde",
"sqlx", "sqlx",
"tokio", "tokio",
"toml 0.9.10+spec-1.1.0", "toml 0.9.11+spec-1.1.0",
"tower", "tower",
"tower-http", "tower-http",
"tower-sessions", "tower-sessions",
@@ -3318,7 +3378,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_caldav" name = "rustical_caldav"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"async-std", "async-std",
"async-trait", "async-trait",
@@ -3331,7 +3391,7 @@ dependencies = [
"futures-util", "futures-util",
"headers", "headers",
"http", "http",
"ical", "ical 0.11.0 (git+https://github.com/lennart-k/ical-rs?rev=7c2ab1f3)",
"insta", "insta",
"percent-encoding", "percent-encoding",
"quick-xml", "quick-xml",
@@ -3360,7 +3420,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_carddav" name = "rustical_carddav"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum", "axum",
@@ -3370,7 +3430,7 @@ dependencies = [
"derive_more", "derive_more",
"futures-util", "futures-util",
"http", "http",
"ical", "ical 0.11.0 (git+https://github.com/lennart-k/ical-rs?rev=7c2ab1f3)",
"insta", "insta",
"percent-encoding", "percent-encoding",
"quick-xml", "quick-xml",
@@ -3394,7 +3454,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_dav" name = "rustical_dav"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum", "axum",
@@ -3403,7 +3463,7 @@ dependencies = [
"futures-util", "futures-util",
"headers", "headers",
"http", "http",
"ical", "ical 0.11.0 (git+https://github.com/lennart-k/ical-rs?rev=7c2ab1f3)",
"itertools 0.14.0", "itertools 0.14.0",
"log", "log",
"matchit 0.9.1", "matchit 0.9.1",
@@ -3420,7 +3480,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_dav_push" name = "rustical_dav_push"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum", "axum",
@@ -3445,7 +3505,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_frontend" name = "rustical_frontend"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"askama", "askama",
"askama_web", "askama_web",
@@ -3481,24 +3541,26 @@ dependencies = [
[[package]] [[package]]
name = "rustical_ical" name = "rustical_ical"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"axum", "axum",
"chrono", "chrono",
"chrono-tz", "chrono-tz",
"derive_more", "derive_more",
"ical", "ical 0.11.0 (git+https://github.com/lennart-k/ical-rs?rev=7c2ab1f3)",
"regex", "regex",
"rrule", "rrule",
"rstest",
"rustical_xml", "rustical_xml",
"serde", "serde",
"sha2", "sha2",
"similar-asserts",
"thiserror 2.0.17", "thiserror 2.0.17",
] ]
[[package]] [[package]]
name = "rustical_oidc" name = "rustical_oidc"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum", "axum",
@@ -3514,7 +3576,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_store" name = "rustical_store"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@@ -3526,7 +3588,7 @@ dependencies = [
"futures-core", "futures-core",
"headers", "headers",
"http", "http",
"ical", "ical 0.11.0 (git+https://github.com/lennart-k/ical-rs?rev=7c2ab1f3)",
"regex", "regex",
"rrule", "rrule",
"rstest", "rstest",
@@ -3547,7 +3609,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_store_sqlite" name = "rustical_store_sqlite"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
@@ -3556,6 +3618,7 @@ dependencies = [
"password-auth", "password-auth",
"password-hash", "password-hash",
"pbkdf2", "pbkdf2",
"regex",
"rstest", "rstest",
"rustical_ical", "rustical_ical",
"rustical_store", "rustical_store",
@@ -3570,7 +3633,7 @@ dependencies = [
[[package]] [[package]]
name = "rustical_xml" name = "rustical_xml"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"quick-xml", "quick-xml",
"thiserror 2.0.17", "thiserror 2.0.17",
@@ -3592,9 +3655,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.35" version = "0.23.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"ring", "ring",
@@ -3733,14 +3796,14 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.148" version = "1.0.149"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
dependencies = [ dependencies = [
"itoa", "itoa",
"memchr", "memchr",
@@ -3809,7 +3872,7 @@ dependencies = [
"chrono", "chrono",
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.12.1", "indexmap 2.13.0",
"schemars 0.9.0", "schemars 0.9.0",
"schemars 1.2.0", "schemars 1.2.0",
"serde_core", "serde_core",
@@ -3827,7 +3890,7 @@ dependencies = [
"darling 0.21.3", "darling 0.21.3",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -3989,7 +4052,7 @@ dependencies = [
"futures-util", "futures-util",
"hashbrown 0.15.5", "hashbrown 0.15.5",
"hashlink", "hashlink",
"indexmap 2.12.1", "indexmap 2.13.0",
"log", "log",
"memchr", "memchr",
"once_cell", "once_cell",
@@ -4016,7 +4079,7 @@ dependencies = [
"quote", "quote",
"sqlx-core", "sqlx-core",
"sqlx-macros-core", "sqlx-macros-core",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4039,7 +4102,7 @@ dependencies = [
"sqlx-mysql", "sqlx-mysql",
"sqlx-postgres", "sqlx-postgres",
"sqlx-sqlite", "sqlx-sqlite",
"syn 2.0.112", "syn 2.0.114",
"tokio", "tokio",
"url", "url",
] ]
@@ -4191,7 +4254,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4213,9 +4276,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.112" version = "2.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21f182278bf2d2bcb3c88b1b08a37df029d71ce3d3ae26168e3c653b213b99d4" checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4239,7 +4302,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4281,7 +4344,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4292,7 +4355,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4372,9 +4435,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.48.0" version = "1.49.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86"
dependencies = [ dependencies = [
"bytes", "bytes",
"libc", "libc",
@@ -4396,7 +4459,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4411,9 +4474,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-stream" name = "tokio-stream"
version = "0.1.17" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"pin-project-lite", "pin-project-lite",
@@ -4422,9 +4485,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.17" version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",
@@ -4447,11 +4510,11 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.9.10+spec-1.1.0" version = "0.9.11+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46"
dependencies = [ dependencies = [
"indexmap 2.12.1", "indexmap 2.13.0",
"serde_core", "serde_core",
"serde_spanned 1.0.4", "serde_spanned 1.0.4",
"toml_datetime 0.7.5+spec-1.1.0", "toml_datetime 0.7.5+spec-1.1.0",
@@ -4484,7 +4547,7 @@ version = "0.22.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [ dependencies = [
"indexmap 2.12.1", "indexmap 2.13.0",
"serde", "serde",
"serde_spanned 0.6.9", "serde_spanned 0.6.9",
"toml_datetime 0.6.11", "toml_datetime 0.6.11",
@@ -4498,7 +4561,7 @@ version = "0.23.10+spec-1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269"
dependencies = [ dependencies = [
"indexmap 2.12.1", "indexmap 2.13.0",
"toml_datetime 0.7.5+spec-1.1.0", "toml_datetime 0.7.5+spec-1.1.0",
"toml_parser", "toml_parser",
"winnow", "winnow",
@@ -4570,7 +4633,7 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-util", "futures-util",
"indexmap 2.12.1", "indexmap 2.13.0",
"pin-project-lite", "pin-project-lite",
"slab", "slab",
"sync_wrapper", "sync_wrapper",
@@ -4708,7 +4771,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -4792,9 +4855,9 @@ dependencies = [
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.8.1" version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
@@ -4843,14 +4906,15 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.7" version = "2.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
"percent-encoding", "percent-encoding",
"serde", "serde",
"serde_derive",
] ]
[[package]] [[package]]
@@ -4908,7 +4972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6728de8767c8dea44f41b88115a205ed23adc3302e1b4342be59d922934dae5" checksum = "f6728de8767c8dea44f41b88115a205ed23adc3302e1b4342be59d922934dae5"
dependencies = [ dependencies = [
"glob", "glob",
"phf", "phf 0.12.1",
"phf_codegen", "phf_codegen",
] ]
@@ -4997,7 +5061,7 @@ dependencies = [
"bumpalo", "bumpalo",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -5032,9 +5096,9 @@ dependencies = [
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "1.0.4" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c"
dependencies = [ dependencies = [
"rustls-pki-types", "rustls-pki-types",
] ]
@@ -5101,7 +5165,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -5112,7 +5176,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -5393,14 +5457,14 @@ checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
[[package]] [[package]]
name = "xml_derive" name = "xml_derive"
version = "0.11.8" version = "0.11.15"
dependencies = [ dependencies = [
"darling 0.23.0", "darling 0.23.0",
"heck", "heck",
"itertools 0.14.0", "itertools 0.14.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -5428,28 +5492,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
"synstructure", "synstructure",
] ]
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.31" version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.8.31" version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
@@ -5469,7 +5533,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
"synstructure", "synstructure",
] ]
@@ -5509,11 +5573,11 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.112", "syn 2.0.114",
] ]
[[package]] [[package]]
name = "zmij" name = "zmij"
version = "1.0.5" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3280a1b827474fcd5dbef4b35a674deb52ba5c312363aef9135317df179d81b" checksum = "2fc5a66a20078bf1251bde995aa2fdcc4b800c70b5d92dd2c62abc5c60f679f8"

View File

@@ -2,7 +2,7 @@
members = ["crates/*"] members = ["crates/*"]
[workspace.package] [workspace.package]
version = "0.11.8" version = "0.11.15"
rust-version = "1.92" rust-version = "1.92"
edition = "2024" edition = "2024"
description = "A CalDAV server" description = "A CalDAV server"
@@ -107,9 +107,7 @@ strum = "0.27"
strum_macros = "0.27" strum_macros = "0.27"
serde_json = { version = "1.0", features = ["raw_value"] } serde_json = { version = "1.0", features = ["raw_value"] }
sqlx-sqlite = { version = "0.8", features = ["bundled"] } sqlx-sqlite = { version = "0.8", features = ["bundled"] }
ical = { git = "https://github.com/lennart-k/ical-rs", features = [ ical = { git = "https://github.com/lennart-k/ical-rs", rev = "7c2ab1f3" }
"chrono-tz",
] }
toml = "0.9" toml = "0.9"
tower = "0.5" tower = "0.5"
tower-http = { version = "0.6", features = [ tower-http = { version = "0.6", features = [
@@ -201,3 +199,7 @@ tower-http.workspace = true
axum-extra.workspace = true axum-extra.workspace = true
headers.workspace = true headers.workspace = true
http.workspace = true http.workspace = true
# TODO: Remove in next major release
ical_dev = { package = "ical", git = "https://github.com/lennart-k/ical-rs", branch = "dev", features = [
"chrono-tz",
] }

View File

@@ -90,14 +90,14 @@ pub async fn route_mkcalendar<C: CalendarStore, S: SubscriptionStore>(
let calendar = IcalParser::new(tz.as_bytes()) let calendar = IcalParser::new(tz.as_bytes())
.next() .next()
.ok_or_else(|| rustical_dav::Error::BadRequest("No timezone data provided".to_owned()))? .ok_or_else(|| rustical_dav::Error::BadRequest("No timezone data provided".to_owned()))?
.map_err(|_| rustical_dav::Error::BadRequest("No timezone data provided".to_owned()))?; .map_err(|_| rustical_dav::Error::BadRequest("Error parsing timezone".to_owned()))?;
let timezone = calendar.timezones.first().ok_or_else(|| { let timezone = calendar.timezones.first().ok_or_else(|| {
rustical_dav::Error::BadRequest("No timezone data provided".to_owned()) rustical_dav::Error::BadRequest("No timezone data provided".to_owned())
})?; })?;
let timezone: chrono_tz::Tz = timezone let timezone: chrono_tz::Tz = timezone.try_into().map_err(|_| {
.try_into() rustical_dav::Error::BadRequest("Cannot translate VTIMEZONE into IANA TZID".to_owned())
.map_err(|_| rustical_dav::Error::BadRequest("No timezone data provided".to_owned()))?; })?;
Some(timezone.name().to_owned()) Some(timezone.name().to_owned())
} else { } else {

View File

@@ -174,7 +174,7 @@ mod tests {
prop: rustical_dav::xml::PropfindType::Prop(PropElement(vec![ prop: rustical_dav::xml::PropfindType::Prop(PropElement(vec![
CalendarObjectPropWrapperName::CalendarObject(CalendarObjectPropName::Getetag), CalendarObjectPropWrapperName::CalendarObject(CalendarObjectPropName::Getetag),
CalendarObjectPropWrapperName::CalendarObject(CalendarObjectPropName::CalendarData( CalendarObjectPropWrapperName::CalendarObject(CalendarObjectPropName::CalendarData(
CalendarData { comp: None, expand: Some(ExpandElement { CalendarData { comp: None, prop: None, expand: Some(ExpandElement {
start: <UtcDateTime as ValueDeserialize>::deserialize("20250426T220000Z").unwrap(), start: <UtcDateTime as ValueDeserialize>::deserialize("20250426T220000Z").unwrap(),
end: <UtcDateTime as ValueDeserialize>::deserialize("20250503T220000Z").unwrap(), end: <UtcDateTime as ValueDeserialize>::deserialize("20250503T220000Z").unwrap(),
}), limit_recurrence_set: None, limit_freebusy_set: None } }), limit_recurrence_set: None, limit_freebusy_set: None }

View File

@@ -42,7 +42,7 @@ pub enum CalendarProp {
SupportedCalendarData(SupportedCalendarData), SupportedCalendarData(SupportedCalendarData),
#[xml(ns = "rustical_dav::namespace::NS_CALDAV", skip_deserializing)] #[xml(ns = "rustical_dav::namespace::NS_CALDAV", skip_deserializing)]
SupportedCollationSet(SupportedCollationSet), SupportedCollationSet(SupportedCollationSet),
#[xml(ns = "rustical_dav::namespace::NS_DAV")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
MaxResourceSize(i64), MaxResourceSize(i64),
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
#[xml(ns = "rustical_dav::namespace::NS_DAV")] #[xml(ns = "rustical_dav::namespace::NS_DAV")]

View File

@@ -135,7 +135,7 @@ END:VCALENDAR
<supported-collation xmlns="urn:ietf:params:xml:ns:caldav">i;unicode-casemap</supported-collation> <supported-collation xmlns="urn:ietf:params:xml:ns:caldav">i;unicode-casemap</supported-collation>
<supported-collation xmlns="urn:ietf:params:xml:ns:caldav">i;octet</supported-collation> <supported-collation xmlns="urn:ietf:params:xml:ns:caldav">i;octet</supported-collation>
</supported-collation-set> </supported-collation-set>
<max-resource-size xmlns="DAV:">10000000</max-resource-size> <max-resource-size xmlns="urn:ietf:params:xml:ns:caldav">10000000</max-resource-size>
<supported-report-set xmlns="DAV:"> <supported-report-set xmlns="DAV:">
<supported-report xmlns="DAV:"> <supported-report xmlns="DAV:">
<report xmlns="DAV:"> <report xmlns="DAV:">

View File

@@ -16,7 +16,7 @@ expression: output
<supported-calendar-component-set xmlns="urn:ietf:params:xml:ns:caldav"/> <supported-calendar-component-set xmlns="urn:ietf:params:xml:ns:caldav"/>
<supported-calendar-data xmlns="urn:ietf:params:xml:ns:caldav"/> <supported-calendar-data xmlns="urn:ietf:params:xml:ns:caldav"/>
<supported-collation-set xmlns="urn:ietf:params:xml:ns:caldav"/> <supported-collation-set xmlns="urn:ietf:params:xml:ns:caldav"/>
<max-resource-size xmlns="DAV:"/> <max-resource-size xmlns="urn:ietf:params:xml:ns:caldav"/>
<supported-report-set xmlns="DAV:"/> <supported-report-set xmlns="DAV:"/>
<source xmlns="http://calendarserver.org/ns/"/> <source xmlns="http://calendarserver.org/ns/"/>
<min-date-time xmlns="urn:ietf:params:xml:ns:caldav"/> <min-date-time xmlns="urn:ietf:params:xml:ns:caldav"/>

View File

@@ -6,7 +6,7 @@ use axum::extract::{Path, State};
use axum::response::{IntoResponse, Response}; use axum::response::{IntoResponse, Response};
use axum_extra::TypedHeader; use axum_extra::TypedHeader;
use headers::{ContentType, ETag, HeaderMapExt, IfNoneMatch}; use headers::{ContentType, ETag, HeaderMapExt, IfNoneMatch};
use http::{HeaderMap, Method, StatusCode}; use http::{HeaderMap, HeaderValue, Method, StatusCode};
use rustical_ical::CalendarObject; use rustical_ical::CalendarObject;
use rustical_store::CalendarStore; use rustical_store::CalendarStore;
use rustical_store::auth::Principal; use rustical_store::auth::Principal;
@@ -73,7 +73,23 @@ pub async fn put_event<C: CalendarStore>(
} }
let overwrite = if let Some(TypedHeader(if_none_match)) = if_none_match { let overwrite = if let Some(TypedHeader(if_none_match)) = if_none_match {
if_none_match == IfNoneMatch::any() // TODO: Put into transaction?
let existing = match cal_store
.get_object(&principal, &calendar_id, &object_id, false)
.await
{
Ok(existing) => Some(existing),
Err(rustical_store::Error::NotFound) => None,
Err(err) => Err(err)?,
};
existing.is_none_or(|existing| {
if_none_match.precondition_passes(
&existing
.get_etag()
.parse()
.expect("We only generate valid ETags"),
)
})
} else { } else {
true true
}; };
@@ -82,9 +98,15 @@ pub async fn put_event<C: CalendarStore>(
debug!("invalid calendar data:\n{body}"); debug!("invalid calendar data:\n{body}");
return Err(Error::PreconditionFailed(Precondition::ValidCalendarData)); return Err(Error::PreconditionFailed(Precondition::ValidCalendarData));
}; };
let etag = object.get_etag();
cal_store cal_store
.put_object(principal, calendar_id, object, overwrite) .put_object(principal, calendar_id, object, overwrite)
.await?; .await?;
Ok(StatusCode::CREATED.into_response()) let mut headers = HeaderMap::new();
headers.insert(
"ETag",
HeaderValue::from_str(&etag).expect("Contains no invalid characters"),
);
Ok((StatusCode::CREATED, headers).into_response())
} }

View File

@@ -1,6 +1,6 @@
use rustical_dav::extensions::CommonPropertiesProp; use rustical_dav::extensions::CommonPropertiesProp;
use rustical_ical::UtcDateTime; use rustical_ical::UtcDateTime;
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize}; use rustical_xml::{EnumVariants, PropName, Unparsed, XmlDeserialize, XmlSerialize};
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)] #[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
#[xml(unit_variants_ident = "CalendarObjectPropName")] #[xml(unit_variants_ident = "CalendarObjectPropName")]
@@ -35,7 +35,9 @@ pub struct ExpandElement {
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Default, Eq, Hash)] #[derive(XmlDeserialize, Clone, Debug, PartialEq, Default, Eq, Hash)]
pub struct CalendarData { pub struct CalendarData {
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
pub(crate) comp: Option<()>, pub(crate) comp: Option<Unparsed>,
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
pub(crate) prop: Option<Unparsed>,
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
pub(crate) expand: Option<ExpandElement>, pub(crate) expand: Option<ExpandElement>,
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]

View File

@@ -7,6 +7,7 @@ use axum::extract::{Path, State};
use axum::response::{IntoResponse, Response}; use axum::response::{IntoResponse, Response};
use axum_extra::TypedHeader; use axum_extra::TypedHeader;
use axum_extra::headers::{ContentType, ETag, HeaderMapExt, IfNoneMatch}; use axum_extra::headers::{ContentType, ETag, HeaderMapExt, IfNoneMatch};
use http::HeaderValue;
use http::Method; use http::Method;
use http::{HeaderMap, StatusCode}; use http::{HeaderMap, StatusCode};
use rustical_dav::privileges::UserPrivilege; use rustical_dav::privileges::UserPrivilege;
@@ -81,15 +82,37 @@ pub async fn put_object<AS: AddressbookStore>(
} }
let overwrite = if let Some(TypedHeader(if_none_match)) = if_none_match { let overwrite = if let Some(TypedHeader(if_none_match)) = if_none_match {
if_none_match == IfNoneMatch::any() // TODO: Put into transaction?
let existing = match addr_store
.get_object(&principal, &addressbook_id, &object_id, false)
.await
{
Ok(existing) => Some(existing),
Err(rustical_store::Error::NotFound) => None,
Err(err) => Err(err)?,
};
existing.is_none_or(|existing| {
if_none_match.precondition_passes(
&existing
.get_etag()
.parse()
.expect("We only generate valid ETags"),
)
})
} else { } else {
true true
}; };
let object = AddressObject::from_vcf(object_id, body)?; let object = AddressObject::from_vcf(object_id, body)?;
let etag = object.get_etag();
addr_store addr_store
.put_object(principal, addressbook_id, object, overwrite) .put_object(principal, addressbook_id, object, overwrite)
.await?; .await?;
Ok(StatusCode::CREATED.into_response()) let mut headers = HeaderMap::new();
headers.insert(
"ETag",
HeaderValue::from_str(&etag).expect("Contains no invalid characters"),
);
Ok((StatusCode::CREATED, headers).into_response())
} }

View File

@@ -82,6 +82,11 @@ pub struct FilterElement {
impl FilterElement { impl FilterElement {
#[must_use] #[must_use]
pub fn matches(&self, addr_object: &AddressObject) -> bool { pub fn matches(&self, addr_object: &AddressObject) -> bool {
if self.prop_filter.is_empty() {
// Filter empty
return true;
}
let Allof(allof) = self.test; let Allof(allof) = self.test;
let mut results = self let mut results = self
.prop_filter .prop_filter
@@ -105,4 +110,30 @@ pub struct AddressbookQueryRequest {
pub prop: PropfindType<AddressObjectPropWrapperName>, pub prop: PropfindType<AddressObjectPropWrapperName>,
#[xml(ns = "rustical_dav::namespace::NS_CARDDAV")] #[xml(ns = "rustical_dav::namespace::NS_CARDDAV")]
pub(crate) filter: FilterElement, pub(crate) filter: FilterElement,
#[xml(ns = "rustical_dav::namespace::NS_CARDDAV")]
pub(crate) limit: Option<LimitElement>,
} }
// https://datatracker.ietf.org/doc/html/rfc5323#section-5.17
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq)]
pub struct LimitElement {
#[xml(ns = "rustical_dav::namespace::NS_CARDDAV")]
pub nresults: NresultsElement,
}
impl From<u64> for LimitElement {
fn from(value: u64) -> Self {
Self {
nresults: NresultsElement(value),
}
}
}
impl From<LimitElement> for u64 {
fn from(value: LimitElement) -> Self {
value.nresults.0
}
}
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq)]
pub struct NresultsElement(#[xml(ty = "text")] pub u64);

View File

@@ -32,6 +32,10 @@ pub struct PropFilterElement {
impl PropFilterElement { impl PropFilterElement {
#[must_use] #[must_use]
pub fn match_property(&self, property: &Property) -> bool { pub fn match_property(&self, property: &Property) -> bool {
if self.param_filter.is_empty() && self.text_match.is_empty() {
// Filter empty
return true;
}
let Allof(allof) = self.test; let Allof(allof) = self.test;
let text_matches = self let text_matches = self
.text_match .text_match

View File

@@ -159,7 +159,7 @@ mod tests {
use crate::{ use crate::{
address_object::AddressObjectPropName, address_object::AddressObjectPropName,
addressbook::methods::report::addressbook_query::{ addressbook::methods::report::addressbook_query::{
Allof, FilterElement, PropFilterElement, Allof, FilterElement, LimitElement, NresultsElement, PropFilterElement,
}, },
}; };
use rustical_dav::xml::{PropElement, sync_collection::SyncLevel}; use rustical_dav::xml::{PropElement, sync_collection::SyncLevel};
@@ -237,6 +237,9 @@ mod tests {
<card:filter> <card:filter>
<card:prop-filter name="FN"/> <card:prop-filter name="FN"/>
</card:filter> </card:filter>
<card:limit>
<card:nresults>100</card:nresults>
</card:limit>
</card:addressbook-query> </card:addressbook-query>
"#, "#,
) )
@@ -259,8 +262,11 @@ mod tests {
text_match: vec![], text_match: vec![],
param_filter: vec![], param_filter: vec![],
test: Allof::default() test: Allof::default()
}] }],
} },
limit: Some(LimitElement {
nresults: NresultsElement(100)
})
}) })
); );
} }

View File

@@ -19,7 +19,7 @@ pub enum AddressbookProp {
SupportedCollationSet(SupportedCollationSet), SupportedCollationSet(SupportedCollationSet),
#[xml(ns = "rustical_dav::namespace::NS_DAV", skip_deserializing)] #[xml(ns = "rustical_dav::namespace::NS_DAV", skip_deserializing)]
SupportedReportSet(SupportedReportSet<ReportMethod>), SupportedReportSet(SupportedReportSet<ReportMethod>),
#[xml(ns = "rustical_dav::namespace::NS_DAV")] #[xml(ns = "rustical_dav::namespace::NS_CARDDAV")]
MaxResourceSize(i64), MaxResourceSize(i64),
} }

View File

@@ -28,7 +28,7 @@ expression: response.serialize_to_string().unwrap()
</report> </report>
</supported-report> </supported-report>
</supported-report-set> </supported-report-set>
<max-resource-size xmlns="DAV:">10000000</max-resource-size> <max-resource-size xmlns="urn:ietf:params:xml:ns:carddav">10000000</max-resource-size>
<sync-token xmlns="DAV:">github.com/lennart-k/rustical/ns/0</sync-token> <sync-token xmlns="DAV:">github.com/lennart-k/rustical/ns/0</sync-token>
<getctag xmlns="http://calendarserver.org/ns/">github.com/lennart-k/rustical/ns/0</getctag> <getctag xmlns="http://calendarserver.org/ns/">github.com/lennart-k/rustical/ns/0</getctag>
<transports xmlns="https://bitfire.at/webdav-push"> <transports xmlns="https://bitfire.at/webdav-push">

View File

@@ -52,13 +52,12 @@ pub async fn route_delete<R: ResourceService>(
return Err(Error::Unauthorized.into()); return Err(Error::Unauthorized.into());
} }
if let Some(if_match) = if_match { if let Some(if_match) = if_match
dbg!(&if_match); && !resource.satisfies_if_match(&if_match)
if !resource.satisfies_if_match(&if_match) { {
// Precondition failed // Precondition failed
return Err(crate::Error::PreconditionFailed.into()); return Err(crate::Error::PreconditionFailed.into());
} }
}
if let Some(if_none_match) = if_none_match if let Some(if_none_match) = if_none_match
&& resource.satisfies_if_none_match(&if_none_match) && resource.satisfies_if_none_match(&if_none_match)
{ {

View File

@@ -21,3 +21,5 @@ rrule.workspace = true
serde.workspace = true serde.workspace = true
sha2.workspace = true sha2.workspace = true
axum.workspace = true axum.workspace = true
rstest.workspace = true
similar-asserts.workspace = true

View File

@@ -67,6 +67,8 @@ impl EventObject {
}; };
let mut rrule_set = RRuleSet::new(dtstart); let mut rrule_set = RRuleSet::new(dtstart);
// TODO: Make nice, this is just a bodge to get correct behaviour
let mut empty = true;
for prop in &self.event.properties { for prop in &self.event.properties {
rrule_set = match prop.name.as_str() { rrule_set = match prop.name.as_str() {
@@ -76,49 +78,63 @@ impl EventObject {
})?)? })?)?
.validate(dtstart) .validate(dtstart)
.unwrap(); .unwrap();
empty = false;
rrule_set.rrule(rrule) rrule_set.rrule(rrule)
} }
"RDATE" => { "RDATE" => {
let rdate = CalDateTime::parse_prop(prop, &self.timezones)?.into(); let rdate = CalDateTime::parse_prop(prop, &self.timezones)?.into();
empty = false;
rrule_set.rdate(rdate) rrule_set.rdate(rdate)
} }
"EXDATE" => { "EXDATE" => {
let exdate = CalDateTime::parse_prop(prop, &self.timezones)?.into(); let exdate = CalDateTime::parse_prop(prop, &self.timezones)?.into();
empty = false;
rrule_set.exdate(exdate) rrule_set.exdate(exdate)
} }
_ => rrule_set, _ => rrule_set,
} }
} }
if empty {
return Ok(None);
}
Ok(Some(rrule_set)) Ok(Some(rrule_set))
} }
// The returned calendar components MUST NOT use recurrence
// properties (i.e., EXDATE, EXRULE, RDATE, and RRULE) and MUST NOT
// have reference to or include VTIMEZONE components. Date and local
// time with reference to time zone information MUST be converted
// into date with UTC time.
pub fn expand_recurrence( pub fn expand_recurrence(
&self, &self,
start: Option<DateTime<Utc>>, start: Option<DateTime<Utc>>,
end: Option<DateTime<Utc>>, end: Option<DateTime<Utc>>,
overrides: &[Self], overrides: &[Self],
) -> Result<Vec<IcalEvent>, Error> { ) -> Result<Vec<IcalEvent>, Error> {
let Some(mut rrule_set) = self.recurrence_ruleset()? else { let mut events = vec![];
return Ok(vec![self.event.clone()]); let dtstart = self.get_dtstart()?.expect("We must have a DTSTART here");
}; let computed_duration = self
.get_dtend()?
.map(|dtend| dtend.as_datetime().into_owned() - dtstart.as_datetime().as_ref());
let Some(mut rrule_set) = self.recurrence_ruleset()? else {
// If ruleset empty simply return main event AND all overrides
return Ok(std::iter::once(self.clone())
.chain(overrides.iter().cloned())
.map(|event| event.event)
.collect());
};
if let Some(start) = start { if let Some(start) = start {
rrule_set = rrule_set.after(start.with_timezone(&rrule::Tz::UTC)); rrule_set = rrule_set.after(start.with_timezone(&rrule::Tz::UTC));
} }
if let Some(end) = end { if let Some(end) = end {
rrule_set = rrule_set.before(end.with_timezone(&rrule::Tz::UTC)); rrule_set = rrule_set.before(end.with_timezone(&rrule::Tz::UTC));
} }
let mut events = vec![];
let dates = rrule_set.all(2048).dates; let dates = rrule_set.all(2048).dates;
let dtstart = self.get_dtstart()?.expect("We must have a DTSTART here");
let computed_duration = self
.get_dtend()?
.map(|dtend| dtend.as_datetime().into_owned() - dtstart.as_datetime().as_ref());
'recurrence: for date in dates { 'recurrence: for date in dates {
let date = CalDateTime::from(date); let date = CalDateTime::from(date.to_utc());
let dateformat = if dtstart.is_date() { let recurrence_id = if dtstart.is_date() {
date.format_date() date.format_date()
} else { } else {
date.format() date.format()
@@ -131,7 +147,7 @@ impl EventObject {
.as_ref() .as_ref()
.expect("overrides have a recurrence id") .expect("overrides have a recurrence id")
.value .value
&& override_id == &dateformat && override_id == &recurrence_id
{ {
// We have an override for this occurence // We have an override for this occurence
// //
@@ -154,13 +170,13 @@ impl EventObject {
ev.set_property(Property { ev.set_property(Property {
name: "RECURRENCE-ID".to_string(), name: "RECURRENCE-ID".to_string(),
value: Some(dateformat.clone()), value: Some(recurrence_id.clone()),
params: vec![], params: vec![],
}); });
ev.set_property(Property { ev.set_property(Property {
name: "DTSTART".to_string(), name: "DTSTART".to_string(),
value: Some(dateformat), value: Some(recurrence_id),
params: dtstart_prop.params.clone(), params: vec![],
}); });
if let Some(duration) = computed_duration { if let Some(duration) = computed_duration {
let dtend = date + duration; let dtend = date + duration;
@@ -183,10 +199,12 @@ impl EventObject {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::CalendarObject; use crate::{CalDateTime, CalendarObject};
use chrono::{DateTime, Utc};
use ical::generator::Emitter; use ical::generator::Emitter;
use rstest::rstest;
const ICS: &str = r"BEGIN:VCALENDAR const ICS_1: &str = r"BEGIN:VCALENDAR
CALSCALE:GREGORIAN CALSCALE:GREGORIAN
VERSION:2.0 VERSION:2.0
BEGIN:VTIMEZONE BEGIN:VTIMEZONE
@@ -206,16 +224,16 @@ RRULE:FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,TH,SU
END:VEVENT END:VEVENT
END:VCALENDAR"; END:VCALENDAR";
const EXPANDED: [&str; 4] = [ const EXPANDED_1: &[&str] = &[
"BEGIN:VEVENT\r "BEGIN:VEVENT\r
UID:318ec6503573d9576818daf93dac07317058d95c\r UID:318ec6503573d9576818daf93dac07317058d95c\r
DTSTAMP:20250502T132758Z\r DTSTAMP:20250502T132758Z\r
SEQUENCE:2\r SEQUENCE:2\r
SUMMARY:weekly stuff\r SUMMARY:weekly stuff\r
TRANSP:OPAQUE\r TRANSP:OPAQUE\r
RECURRENCE-ID:20250506T090000\r RECURRENCE-ID:20250506T070000Z\r
DTSTART;TZID=Europe/Berlin:20250506T090000\r DTSTART:20250506T070000Z\r
DTEND;TZID=Europe/Berlin:20250506T092500\r DTEND:20250506T072500Z\r
END:VEVENT\r\n", END:VEVENT\r\n",
"BEGIN:VEVENT\r "BEGIN:VEVENT\r
UID:318ec6503573d9576818daf93dac07317058d95c\r UID:318ec6503573d9576818daf93dac07317058d95c\r
@@ -223,9 +241,9 @@ DTSTAMP:20250502T132758Z\r
SEQUENCE:2\r SEQUENCE:2\r
SUMMARY:weekly stuff\r SUMMARY:weekly stuff\r
TRANSP:OPAQUE\r TRANSP:OPAQUE\r
RECURRENCE-ID:20250508T090000\r RECURRENCE-ID:20250508T070000Z\r
DTSTART;TZID=Europe/Berlin:20250508T090000\r DTSTART:20250508T070000Z\r
DTEND;TZID=Europe/Berlin:20250508T092500\r DTEND:20250508T072500Z\r
END:VEVENT\r\n", END:VEVENT\r\n",
"BEGIN:VEVENT\r "BEGIN:VEVENT\r
UID:318ec6503573d9576818daf93dac07317058d95c\r UID:318ec6503573d9576818daf93dac07317058d95c\r
@@ -234,8 +252,8 @@ SEQUENCE:2\r
SUMMARY:weekly stuff\r SUMMARY:weekly stuff\r
TRANSP:OPAQUE\r TRANSP:OPAQUE\r
RECURRENCE-ID:20250511T090000\r RECURRENCE-ID:20250511T090000\r
DTSTART;TZID=Europe/Berlin:20250511T090000\r DTSTART:20250511T070000Z\r
DTEND;TZID=Europe/Berlin:20250511T092500\r DTEND:20250511T072500Z\r
END:VEVENT\r\n", END:VEVENT\r\n",
"BEGIN:VEVENT\r "BEGIN:VEVENT\r
UID:318ec6503573d9576818daf93dac07317058d95c\r UID:318ec6503573d9576818daf93dac07317058d95c\r
@@ -244,25 +262,124 @@ SEQUENCE:2\r
SUMMARY:weekly stuff\r SUMMARY:weekly stuff\r
TRANSP:OPAQUE\r TRANSP:OPAQUE\r
RECURRENCE-ID:20250520T090000\r RECURRENCE-ID:20250520T090000\r
DTSTART;TZID=Europe/Berlin:20250520T090000\r DTSTA:20250520T070000Z\r
DTEND;TZID=Europe/Berlin:20250520T092500\r DTEND:20250520T072500Z\r
END:VEVENT\r\n", END:VEVENT\r\n",
]; ];
#[test] const ICS_2: &str = r"BEGIN:VCALENDAR
fn test_expand_recurrence() { CALSCALE:GREGORIAN
let event = CalendarObject::from_ics(ICS.to_string(), None).unwrap(); VERSION:2.0
BEGIN:VTIMEZONE
TZID:US/Eastern
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060102T120000
DURATION:PT1H
RRULE:FREQ=DAILY;COUNT=5
SUMMARY:Event #2
UID:abcd2
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060104T140000
DURATION:PT1H
RECURRENCE-ID;TZID=US/Eastern:20060104T120000
SUMMARY:Event #2 bis
UID:abcd2
END:VEVENT
END:VCALENDAR
";
const EXPANDED_2: &[&str] = &[
"BEGIN:VEVENT\r
DTSTAMP:20060206T001121Z\r
DURATION:PT1H\r
SUMMARY:Event #2\r
UID:abcd2\r
RECURRENCE-ID:20060103T170000\r
DTSTART:20060103T170000\r
END:VEVENT\r\n",
"BEGIN:VEVENT\r
DTSTAMP:20060206T001121Z\r
DURATION:PT1H\r
SUMMARY:Event #2 bis\r
UID:abcd2\r
RECURRENCE-ID:20060104T170000\r
DTSTART:20060104T190000\r
END:VEVENT\r
END:VCALENDAR\r\n",
];
const ICS_3: &str = r"BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:US/Eastern
END:VTIMEZONE
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:abcd3
END:VEVENT
END:VCALENDAR
";
const EXPANDED_3: &[&str] = &["BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART:20060104T150000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:abcd3
X-ABC-GUID:E1CX5Dr-0007ym-Hz@example.com
END:VEVENT"];
#[rstest]
#[case(ICS_1, EXPANDED_1, None, None)]
// from https://datatracker.ietf.org/doc/html/rfc4791#section-7.8.3
#[case(ICS_2, EXPANDED_2,
Some(CalDateTime::parse("20060103T000000Z", Some(chrono_tz::US::Eastern)).unwrap().utc()),
Some(CalDateTime::parse("20060105T000000Z", Some(chrono_tz::US::Eastern)).unwrap().utc())
)]
#[case(ICS_3, EXPANDED_3,
Some(CalDateTime::parse("20060103T000000Z", Some(chrono_tz::US::Eastern)).unwrap().utc()),
Some(CalDateTime::parse("20060105T000000Z", Some(chrono_tz::US::Eastern)).unwrap().utc())
)]
fn test_expand_recurrence(
#[case] ics: &'static str,
#[case] expanded: &[&str],
#[case] from: Option<DateTime<Utc>>,
#[case] to: Option<DateTime<Utc>>,
) {
let event = CalendarObject::from_ics(ics.to_string(), None).unwrap();
let crate::CalendarObjectComponent::Event(event, overrides) = event.get_data() else { let crate::CalendarObjectComponent::Event(event, overrides) = event.get_data() else {
panic!() panic!()
}; };
let events: Vec<String> = event let events: Vec<String> = event
.expand_recurrence(None, None, overrides) .expand_recurrence(from, to, overrides)
.unwrap() .unwrap()
.into_iter() .into_iter()
.map(|event| Emitter::generate(&event)) .map(|event| Emitter::generate(&event))
.collect(); .collect();
assert_eq!(events.as_slice()[0], EXPANDED[0]); assert_eq!(events.len(), expanded.len());
assert_eq!(events.as_slice(), &EXPANDED); for (output, reference) in events.iter().zip(expanded) {
similar_asserts::assert_eq!(output, reference);
}
} }
} }

View File

@@ -89,10 +89,19 @@ impl From<&CalendarObjectComponent> for CalendarObjectType {
impl CalendarObjectComponent { impl CalendarObjectComponent {
fn from_events(mut events: Vec<EventObject>) -> Result<Self, Error> { fn from_events(mut events: Vec<EventObject>) -> Result<Self, Error> {
let main_event = events // A calendar object does not necessarily have to contain a main VOBJECT
if events.is_empty() {
return Err(Error::MissingCalendar);
}
#[allow(clippy::option_if_let_else)]
let main_event = if let Some(main) = events
.extract_if(.., |event| event.event.get_recurrence_id().is_none()) .extract_if(.., |event| event.event.get_recurrence_id().is_none())
.next() .next()
.expect("there must be one main event"); {
main
} else {
events.remove(0)
};
let overrides = events; let overrides = events;
for event in &overrides { for event in &overrides {
if event.get_uid() != main_event.get_uid() { if event.get_uid() != main_event.get_uid() {
@@ -109,10 +118,19 @@ impl CalendarObjectComponent {
Ok(Self::Event(main_event, overrides)) Ok(Self::Event(main_event, overrides))
} }
fn from_todos(mut todos: Vec<IcalTodo>) -> Result<Self, Error> { fn from_todos(mut todos: Vec<IcalTodo>) -> Result<Self, Error> {
let main_todo = todos // A calendar object does not necessarily have to contain a main VOBJECT
if todos.is_empty() {
return Err(Error::MissingCalendar);
}
#[allow(clippy::option_if_let_else)]
let main_todo = if let Some(main) = todos
.extract_if(.., |todo| todo.get_recurrence_id().is_none()) .extract_if(.., |todo| todo.get_recurrence_id().is_none())
.next() .next()
.expect("there must be one main event"); {
main
} else {
todos.remove(0)
};
let overrides = todos; let overrides = todos;
for todo in &overrides { for todo in &overrides {
if todo.get_uid() != main_todo.get_uid() { if todo.get_uid() != main_todo.get_uid() {
@@ -129,10 +147,19 @@ impl CalendarObjectComponent {
Ok(Self::Todo(main_todo, overrides)) Ok(Self::Todo(main_todo, overrides))
} }
fn from_journals(mut journals: Vec<IcalJournal>) -> Result<Self, Error> { fn from_journals(mut journals: Vec<IcalJournal>) -> Result<Self, Error> {
let main_journal = journals // A calendar object does not necessarily have to contain a main VOBJECT
if journals.is_empty() {
return Err(Error::MissingCalendar);
}
#[allow(clippy::option_if_let_else)]
let main_journal = if let Some(main) = journals
.extract_if(.., |journal| journal.get_recurrence_id().is_none()) .extract_if(.., |journal| journal.get_recurrence_id().is_none())
.next() .next()
.expect("there must be one main event"); {
main
} else {
journals.remove(0)
};
let overrides = journals; let overrides = journals;
for journal in &overrides { for journal in &overrides {
if journal.get_uid() != main_journal.get_uid() { if journal.get_uid() != main_journal.get_uid() {

View File

@@ -198,6 +198,14 @@ impl CalDateTime {
} }
} }
#[must_use]
pub fn with_timezone(&self, tz: &ICalTimezone) -> Self {
match self {
Self::DateTime(datetime) => Self::DateTime(datetime.with_timezone(tz)),
Self::Date(date, _) => Self::Date(date.to_owned(), tz.to_owned()),
}
}
pub fn parse(value: &str, timezone: Option<Tz>) -> Result<Self, CalDateTimeError> { pub fn parse(value: &str, timezone: Option<Tz>) -> Result<Self, CalDateTimeError> {
if let Ok(datetime) = NaiveDateTime::parse_from_str(value, LOCAL_DATE_TIME) { if let Ok(datetime) = NaiveDateTime::parse_from_str(value, LOCAL_DATE_TIME) {
if let Some(timezone) = timezone { if let Some(timezone) = timezone {

View File

@@ -104,9 +104,7 @@ pub async fn route_post_oidc(
TypedHeader(host): TypedHeader<Host>, TypedHeader(host): TypedHeader<Host>,
Form(GetOidcForm { redirect_uri }): Form<GetOidcForm>, Form(GetOidcForm { redirect_uri }): Form<GetOidcForm>,
) -> Result<Response, OidcError> { ) -> Result<Response, OidcError> {
dbg!(&host);
let callback_uri = format!("https://{host}/frontend/login/oidc/callback"); let callback_uri = format!("https://{host}/frontend/login/oidc/callback");
dbg!(&callback_uri);
let http_client = get_http_client(); let http_client = get_http_client();
let oidc_client = get_oidc_client( let oidc_client = get_oidc_client(

View File

@@ -36,3 +36,4 @@ pbkdf2.workspace = true
rustical_ical.workspace = true rustical_ical.workspace = true
rstest = { workspace = true, optional = true } rstest = { workspace = true, optional = true }
sha2.workspace = true sha2.workspace = true
regex.workspace = true

View File

@@ -3,6 +3,7 @@ use crate::BEGIN_IMMEDIATE;
use async_trait::async_trait; use async_trait::async_trait;
use chrono::TimeDelta; use chrono::TimeDelta;
use derive_more::derive::Constructor; use derive_more::derive::Constructor;
use regex::Regex;
use rustical_ical::{CalDateTime, CalendarObject, CalendarObjectType}; use rustical_ical::{CalDateTime, CalendarObject, CalendarObjectType};
use rustical_store::calendar_store::CalendarQuery; use rustical_store::calendar_store::CalendarQuery;
use rustical_store::synctoken::format_synctoken; use rustical_store::synctoken::format_synctoken;
@@ -145,6 +146,83 @@ impl SqliteCalendarStore {
} }
} }
/// In the past exports generated objects with invalid VERSION:4.0
/// This repair sets them to VERSION:2.0
#[allow(clippy::missing_panics_doc)]
pub async fn repair_invalid_version_4_0(&self) -> Result<(), Error> {
struct Row {
principal: String,
cal_id: String,
id: String,
ics: String,
}
let mut tx = self
.db
.begin_with(BEGIN_IMMEDIATE)
.await
.map_err(crate::Error::from)?;
#[allow(clippy::missing_panics_doc)]
let version_pattern = Regex::new(r"(?mi)^VERSION:4.0").unwrap();
let repairs: Vec<Row> = sqlx::query_as!(
Row,
r#"SELECT principal, cal_id, id, ics FROM calendarobjects WHERE ics LIKE '%VERSION:4.0%';"#
)
.fetch_all(&mut *tx)
.await
.map_err(crate::Error::from)?
.into_iter()
.filter_map(|mut row| {
version_pattern.find(&row.ics)?;
let new_ics = version_pattern.replace(&row.ics, "VERSION:2.0");
// Safeguard that we really only changed the version
assert_eq!(row.ics.len(), new_ics.len());
row.ics = new_ics.to_string();
Some(row)
})
.collect();
if repairs.is_empty() {
return Ok(());
}
warn!(
"Found {} calendar objects with invalid VERSION:4.0. Repairing by setting to VERSION:2.0",
repairs.len()
);
for repair in &repairs {
// calendarobjectchangelog is used by sync-collection to fetch changes
// By deleting entries we will later regenerate new entries such that clients will notice
// the objects have changed
warn!(
"Repairing VERSION for {}/{}/{}.ics",
repair.principal, repair.cal_id, repair.id
);
sqlx::query!(
"DELETE FROM calendarobjectchangelog WHERE (principal, cal_id, object_id) = (?, ?, ?);",
repair.principal, repair.cal_id, repair.id
).execute(&mut *tx).await
.map_err(crate::Error::from)?;
sqlx::query!(
"UPDATE calendarobjects SET ics = ? WHERE (principal, cal_id, id) = (?, ?, ?);",
repair.ics,
repair.principal,
repair.cal_id,
repair.id
)
.execute(&mut *tx)
.await
.map_err(crate::Error::from)?;
}
tx.commit().await.map_err(crate::Error::from)?;
Ok(())
}
// Commit "orphaned" objects to the changelog table // Commit "orphaned" objects to the changelog table
pub async fn repair_orphans(&self) -> Result<(), Error> { pub async fn repair_orphans(&self) -> Result<(), Error> {
struct Row { struct Row {

View File

@@ -5,14 +5,14 @@ use quick_xml::events::BytesStart;
use crate::{XmlDeserialize, XmlError}; use crate::{XmlDeserialize, XmlError};
// TODO: actually implement // TODO: actually implement
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Unparsed(BytesStart<'static>); pub struct Unparsed(String);
impl Unparsed { impl Unparsed {
#[must_use] #[must_use]
pub fn tag_name(&self) -> String { pub fn tag_name(&self) -> String {
// TODO: respect namespace? // TODO: respect namespace?
String::from_utf8_lossy(self.0.local_name().as_ref()).to_string() self.0.clone()
} }
} }
@@ -27,6 +27,7 @@ impl XmlDeserialize for Unparsed {
let mut buf = vec![]; let mut buf = vec![];
reader.read_to_end_into(start.name(), &mut buf)?; reader.read_to_end_into(start.name(), &mut buf)?;
} }
Ok(Self(start.to_owned())) let tag_name = String::from_utf8_lossy(start.local_name().as_ref()).to_string();
Ok(Self(tag_name))
} }
} }

View File

@@ -0,0 +1,253 @@
# RFC 4791 (CalDAV)
## ☑ 1. Introduction
### ☑ 1.1 Notational Conventions
### ☑ 1.2 XML Namespaces and Processing
### ☐ 1.3 Method Preconditions and Postconditions
## ☐ 2. Requirements Overview
- [x] MUST support iCalendar [RFC2445] as a media type for the calendar
object resource format;
- [ ] MUST support WebDAV Class 1 [RFC2518] (note that [rfc2518bis]
describes clarifications to [RFC2518] that aid interoperability);
- [x] MUST support WebDAV ACL [RFC3744] with the additional privilege
defined in Section 6.1 of this document;
- [x] MUST support transport over TLS [RFC2246] as defined in [RFC2818]
(note that [RFC2246] has been obsoleted by [RFC4346]);
- [x] MUST support ETags [RFC2616] with additional requirements
specified in Section 5.3.4 of this document;
- [ ] MUST support all calendaring reports defined in Section 7 of this
document; and
- [x] MUST advertise support on all calendar collections and calendar
object resources for the calendaring reports in the DAV:supported-
report-set property, as defined in Versioning Extensions to WebDAV
[RFC3253].
In addition, a server:
- [x] SHOULD support the MKCALENDAR method defined in Section 5.3.1 of
this document.
## ☑ 3. Calendaring Data Model
### ☑ 3.1 Calendar Server
### ☑ 3.2 Recurrence and the Data Model
## ☑ 4. Calendar Resources
### ☑ 4.1 Calendar Object Resources
### ☑ 4.2 Calendar Collection
## ☐ 5. Calendar Access Feature
### ☑ 5.1 Calendar Access Support
#### ☑ 5.1.1 Example: Using OPTIONS for the Discovery of Calendar Access Support
### ☑ 5.2 Calendar Collection Properties
#### ☑ 5.2.1 CALDAV:calendar-description Property
#### ☑ 5.2.2 CALDAV:calendar-timezone Property
#### ☑ 5.2.3 CALDAV:supported-calendar-component-set Property
#### ☑ 5.2.4 CALDAV:supported-calendar-data Property
#### ☑ 5.2.5 CALDAV:max-resource-size Property
#### ☑ 5.2.6 CALDAV:min-date-time Property
#### ☑ 5.2.7 CALDAV:max-date-time Property
#### ☐ 5.2.8 CALDAV:max-instances Property (Maybe set this :))
#### ☑ 5.2.9 CALDAV:max-attendees-per-instance Property (does not apply)
#### ☑ 5.2.10 Additional Precondition for PROPPATCH
### ☑ 5.3 Creating Resources
#### ☑ 5.3.1 MKCALENDAR Method
##### ☑ 5.3.1.1 Status Codes
##### ☑ 5.3.1.2 Example: Successful MKCALENDAR Request
- Example fails because of the tzid is not in the Olson database, but that's okay
#### ☑ 5.3.2 Creating Calendar Object Resources
##### ☐ 5.3.2.1 Additional Preconditions for PUT, COPY, and MOVE
### ☑ 5.3.3 Non-Standard Components, Properties, and Parameters
### ☑ 5.3.4 Calendar Object Resource Entity Tag
## ☐ 6. Calendaring Access Control
### ☐ 6.1 Calendaring Privilege
#### ☐ 6.1.1 CALDAV:read-free-busy Privilege
### ☑ 6.2 Additional Principal Property
#### ☑ 6.2.1 CALDAV:calendar-home-set Property
## ☐ 7. Calendaring Reports
- [ ] `DAV:expand-property`
### ☑ 7.1 REPORT Method
### ☑ 7.2 Ordinary Collections
### ☑ 7.3 Date and Floating Time
### ☑ 7.4 Time Range Filtering
### ☑ 7.5 Searching Text: Collations
#### ☑ 7.5.1 CALDAV:supported-collation-set Property
### ☐ 7.6 Partial Retrieval
### ☑ 7.7 Non-Standard Components, Properties, and Parameters
### ☑ 7.8 CALDAV:calendar-query REPORT
#### ☐ 7.8.1 Example: Partial Retrieval of Events by Time Range
#### ☐ 7.8.2 Example: Partial Retrieval of Recurring Events
#### ☐ 7.8.3 Example: Expanded Retrieval of Recurring Events
#### ☐ 7.8.4 Example: Partial Retrieval of Stored Free Busy Components
#### ☐ 7.8.5 Example: Retrieval of To-Dos by Alarm Time Range
#### ☐ 7.8.6 Example: Retrieval of Event by UID
#### ☐ 7.8.7 Example: Retrieval of Events by PARTSTAT
#### ☐ 7.8.8 Example: Retrieval of Events Only
#### ☐ 7.8.9 Example: Retrieval of All Pending To-Dos
#### ☐ 7.8.10 Example: Attempt to Query Unsupported Property
### ☐ 7.9 CALDAV:calendar-multiget REPORT
#### ☐ 7.9.1 Example: Successful CALDAV:calendar-multiget REPORT
### ☐ 7.10 CALDAV:free-busy-query REPORT
#### ☐ 7.10.1 Example: Successful CALDAV:free-busy-query REPORT
## ☐ 8. Guidelines
### ☐ 8.1 Client-to-Client Interoperability
### ☐ 8.2 Synchronization Operations
#### ☐ 8.2.1 Use of Reports
##### ☐ 8.2.1.1 Restrict the Time Range
##### ☐ 8.2.1.2 Synchronize by Time Range
##### ☐ 8.2.1.3 Synchronization Process
#### ☐ 8.2.2 Restrict the Properties Returned
### ☐ 8.3 Use of Locking
### ☐ 8.4 Finding Calendars
### ☐ 8.5 Storing and Using Attachments
#### ☐ 8.5.1 Inline Attachments
#### ☐ 8.5.2 External Attachments
### ☐ 8.6 Storing and Using Alarms
## ☐ 9. XML Element Definitions
### ☐ 9.1 CALDAV:calendar XML Element
### ☐ 9.2 CALDAV:mkcalendar XML Element
### ☐ 9.3 CALDAV:mkcalendar-response XML Element
### ☐ 9.4 CALDAV:supported-collation XML Element
### ☐ 9.5 CALDAV:calendar-query XML Element
### ☐ 9.6 CALDAV:calendar-data XML Element
#### ☐ 9.6.1 CALDAV:comp XML Element
#### ☐ 9.6.2 CALDAV:allcomp XML Element
#### ☐ 9.6.3 CALDAV:allprop XML Element
#### ☐ 9.6.4 CALDAV:prop XML Element
#### ☐ 9.6.5 CALDAV:expand XML Element
#### ☐ 9.6.6 CALDAV:limit-recurrence-set XML Element
#### ☐ 9.6.7 CALDAV:limit-freebusy-set XML Element
### ☐ 9.7 CALDAV:filter XML Element
#### ☐ 9.7.1 CALDAV:comp-filter XML Element
#### ☐ 9.7.2 CALDAV:prop-filter XML Element
#### ☐ 9.7.3 CALDAV:param-filter XML Element
#### ☐ 9.7.4 CALDAV:is-not-defined XML Element
#### ☐ 9.7.5 CALDAV:text-match XML Element
### ☐ 9.8 CALDAV:timezone XML Element
### ☐ 9.9 CALDAV:time-range XML Element
### ☐ 9.10 CALDAV:calendar-multiget XML Element
### ☐ 9.11 CALDAV:free-busy-query XML Element
## ☐ 10. Internationalization Considerations
## ☐ 11. Security Considerations
## ☐ 12. IANA Considerations
### ☐ 12.1 Namespace Registration
## ☐ 13. Acknowledgements
## ☐ 14. References
### ☐ 14.1 Normative References
### ☐ 14.2 Informative References
## ☐ A. CalDAV Method Privilege Table (Normative)
## ☐ B. Calendar Collections Used in the Examples

View File

@@ -0,0 +1,175 @@
# RFC 6352 (CardDAV)
## ☑ 1. Introduction and Overview
## ☑ 2. Conventions
## ☐ 3. Requirements Overview
## ☑ 4. Address Book Data Model
### ☑ 4.1 Address Book Server
## ☐ 5. Address Book Resources
### ☐ 5.1 Address Object Resources
- vCard objects MUST have a unique UID
- Right now the uniqueness is not enforced in store_sqlite :(
#### ☐ 5.1.1 Data Type Conversion
Again, the client can use content negotiation to
request that data be returned in a specific media type by specifying
appropriate attributes on the CARDDAV:address-data XML element used
in the request body (see Section 10.4).
- [ ] Accept address-data attributes
#### ☐ 5.1.1.1 Additional Precondition for GET
- Make sure that Accept header matches content type
### ☐ 5.2 Address Book Collections
## ☑ 6. Address Book Feature
### ☑ 6.1 Address Book Support
#### ☑ 6.1.1 Example: Using OPTIONS for the Discovery of Support for CardDAV
### ☐ 6.2 Address Book Properties
#### ☑ 6.2.1 CARDDAV:addressbook-description Property
#### ☑ 6.2.2 CARDDAV:supported-address-data Property
#### ☑ 6.2.3 CARDDAV:max-resource-size Property
### ☐ 6.3 Creating Resources
#### ☑ 6.3.1 Extended MKCOL Method
##### ☑ 6.3.1.1 Example - Successful MKCOL Request
#### ☐ 6.3.2 Creating Address Object Resources
- [x] If-None-Match support
##### ☐ 6.3.2.1 Additional Preconditions for PUT, COPY, and MOVE
- [ ] Make sure UID is unique
##### ☑ 6.3.2.2 Non-Standard vCard Properties and Parameters
##### ☑ 6.3.2.3 Address Object Resource Entity Tag
## ☑ 7. Address Book Access Control
### ☑ 7.1 Additional Principal Properties
#### ☑ 7.1.1 CARDDAV:addressbook-home-set Property
#### ☑ 7.1.2 CARDDAV:principal-address Property
## ☐ 8. Address Book Reports
### ☐ 8.1 REPORT Method
- [ ] DAV:expand-property REPORT
### ☑ 8.2 Ordinary Collections
### ☑ 8.3 Searching Text: Collations
#### ☑ 8.3.1 CARDDAV:supported-collation-set Property
### ☐ 8.4 Partial Retrieval (Optional)
### ☑ 8.5 Non-Standard Properties and Parameters
### ☑ 8.6 CARDDAV:addressbook-query Report
#### ☐ 8.6.1 Limiting Results
#### ☑ 8.6.2 Truncation of Results (does not apply)
#### ☐ 8.6.3 Example: Partial Retrieval of vCards Matching NICKNAME
#### ☐ 8.6.4 Example: Partial Retrieval of vCards Matching a Full Name or Email Address
#### ☐ 8.6.5 Example: Truncated Results
### ☐ 8.7 CARDDAV:addressbook-multiget Report
#### ☑ 8.7.1 Example: CARDDAV:addressbook-multiget Report
#### ☐ 8.7.2 Example: CARDDAV:addressbook-multiget Report
- [ ] Check for content-type of requested data
```
<C:address-data content-type='text/vcard' version='4.0'/>
```
## ☑ 9. Client Guidelines
### ☑ 9.1 Restrict the Properties Returned
### ☑ 9.2 Avoiding Lost Updates
### ☑ 9.3 Client Configuration
### ☐ 9.4 Finding Other Users' Address Books
- [ ] Implement DAV:principal-property-search REPORT [RFC3744]
## ☑ 10. XML Element Definitions
### ☑ 10.1 CARDDAV:addressbook XML Element
### ☑ 10.2 CARDDAV:supported-collation XML Element
### ☑ 10.3 CARDDAV:addressbook-query XML Element
### ☑ 10.4 CARDDAV:address-data XML Element
- [ ] Support content-type and version
#### ☐ 10.4.1 CARDDAV:allprop XML Element (does not apply, is for vCard props)
#### ☐ 10.4.2 CARDDAV:prop XML Element (does not apply, is for vCard props)
### ☑ 10.5 CARDDAV:filter XML Element
#### ☑ 10.5.1 CARDDAV:prop-filter XML Element
#### ☑ 10.5.2 CARDDAV:param-filter XML Element
#### ☑ 10.5.3 CARDDAV:is-not-defined XML Element
#### ☑ 10.5.4 CARDDAV:text-match XML Element
### ☑ 10.6 CARDDAV:limit XML Element
#### ☑ 10.6.1 CARDDAV:nresults XML Element
### ☑ 10.7 CARDDAV:addressbook-multiget XML Element
## ☑ 11. Service Discovery via SRV Records
## ☑ 12. Internationalization Considerations
## ☑ 13. Security Considerations
## ☑ 14. IANA Consideration
### ☑ 14.1 Namespace Registration
## ☑ 15. Acknowledgments
## ☑ 16. References
### ☑ 16.1 Normative References
### ☑ 16.2 Informative References

View File

@@ -59,6 +59,8 @@ markdown_extensions:
- admonition - admonition
- attr_list - attr_list
- pymdownx.tabbed - pymdownx.tabbed
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.emoji: - pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg emoji_generator: !!python/name:material.extensions.emoji.to_svg
@@ -73,7 +75,9 @@ nav:
- OpenID Connect: setup/oidc.md - OpenID Connect: setup/oidc.md
- Developers: - Developers:
- developers/index.md - developers/index.md
- Relevant RFCs: developers/rfcs.md - Relevant RFCs:
- developers/rfcs.md
- RFC 6352: developers/rfcs/rfc6352.md
- Frontend: developers/frontend.md - Frontend: developers/frontend.md
- Debugging: developers/debugging.md - Debugging: developers/debugging.md
- Cargo docs: /rustical/_crate/rustical/ - Cargo docs: /rustical/_crate/rustical/

View File

@@ -17,6 +17,7 @@ pub fn cmd_gen_config(_args: GenConfigArgs) -> anyhow::Result<()> {
http: HttpConfig::default(), http: HttpConfig::default(),
data_store: DataStoreConfig::Sqlite(SqliteDataStoreConfig { data_store: DataStoreConfig::Sqlite(SqliteDataStoreConfig {
db_url: "/var/lib/rustical/db.sqlite3".to_owned(), db_url: "/var/lib/rustical/db.sqlite3".to_owned(),
run_repairs: true,
}), }),
tracing: TracingConfig::default(), tracing: TracingConfig::default(),
frontend: FrontendConfig { frontend: FrontendConfig {

View File

@@ -26,6 +26,8 @@ impl Default for HttpConfig {
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct SqliteDataStoreConfig { pub struct SqliteDataStoreConfig {
pub db_url: String, pub db_url: String,
#[serde(default = "default_true")]
pub run_repairs: bool,
} }
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]

View File

@@ -29,12 +29,34 @@ fn mkcalendar_template(
<displayname>{displayname}</displayname> <displayname>{displayname}</displayname>
<CAL:calendar-description>{description}</CAL:calendar-description> <CAL:calendar-description>{description}</CAL:calendar-description>
<n0:calendar-color xmlns:n0="http://apple.com/ns/ical/">{color}</n0:calendar-color> <n0:calendar-color xmlns:n0="http://apple.com/ns/ical/">{color}</n0:calendar-color>
<CAL:calendar-timezone-id>Europe/Berlin</CAL:calendar-timezone-id>
<CAL:supported-calendar-component-set> <CAL:supported-calendar-component-set>
<CAL:comp name="VEVENT"/> <CAL:comp name="VEVENT"/>
<CAL:comp name="VTODO"/> <CAL:comp name="VTODO"/>
<CAL:comp name="VJOURNAL"/> <CAL:comp name="VJOURNAL"/>
</CAL:supported-calendar-component-set> </CAL:supported-calendar-component-set>
<CAL:calendar-timezone><![CDATA[BEGIN:VCALENDAR
PRODID:-//Example Corp.//CalDAV Client//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:US/Eastern
LAST-MODIFIED:19870101T000000Z
BEGIN:STANDARD
DTSTART:19671029T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:Eastern Standard Time (US & Canada)
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19870405T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:Eastern Daylight Time (US & Canada)
END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
]]></CAL:calendar-timezone>
</prop> </prop>
</set> </set>
</CAL:mkcalendar> </CAL:mkcalendar>
@@ -209,3 +231,106 @@ async fn test_caldav_calendar(
Err(rustical_store::Error::NotFound) Err(rustical_store::Error::NotFound)
)); ));
} }
#[rstest]
#[tokio::test]
async fn test_rfc4791_5_3_2(
#[from(test_store_context)]
#[future]
context: TestStoreContext,
) {
let context = context.await;
let app = get_app(context.clone());
let calendar_meta = CalendarMetadata {
displayname: Some("Calendar".to_string()),
description: Some("Description".to_string()),
color: Some("#00FF00".to_string()),
order: 0,
};
let (principal, cal_id) = ("user", "calendar");
let url = format!("/caldav/principal/{principal}/{cal_id}");
let request_template = || {
Request::builder()
.method("MKCALENDAR")
.uri(&url)
.body(Body::from(mkcalendar_template(&calendar_meta)))
.unwrap()
};
// Try with correct credentials
let mut request = request_template();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let ical = r"BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VEVENT
UID:20010712T182145Z-123401@example.com
DTSTAMP:20060712T182145Z
DTSTART:20060714T170000Z
DTEND:20060715T040000Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR";
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/qwue23489.ics"))
.header("If-None-Match", "*")
.header("Content-Type", "text/calendar")
.body(Body::from(ical))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/qwue23489.ics"))
.header("If-None-Match", "*")
.header("Content-Type", "text/calendar")
.body(Body::from(ical))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CONFLICT);
let mut request = Request::builder()
.method("REPORT")
.uri(&url)
.header("Depth", "infinity")
.header("Content-Type", "text/xml; charset=\"utf-8\"")
.body(Body::from(format!(
r#"
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-multiget xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop>
<D:getetag/>
</D:prop>
<D:href>{url}/qwue23489.ics</D:href>
<D:href>/home/bernard/addressbook/vcf1.vcf</D:href>
</C:calendar-multiget>
"#
)))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::MULTI_STATUS);
let body = response.extract_string().await;
insta::assert_snapshot!("multiget_body", body);
}

View File

@@ -0,0 +1,98 @@
use crate::integration_tests::{ResponseExtractString, get_app};
use axum::body::Body;
use axum::extract::Request;
use headers::{Authorization, HeaderMapExt};
use http::StatusCode;
use rstest::rstest;
use rustical_store_sqlite::tests::{TestStoreContext, test_store_context};
use tower::ServiceExt;
const ICAL: &str = r"
BEGIN:VCALENDAR
PRODID:-//Example Corp.//CalDAV Client//EN
VERSION:2.0
BEGIN:VEVENT
UID:1@example.com
SUMMARY:One-off Meeting
DTSTAMP:20041210T183904Z
DTSTART:20041207T120000Z
DTEND:20041207T130000Z
END:VEVENT
BEGIN:VEVENT
UID:2@example.com
SUMMARY:Weekly Meeting
DTSTAMP:20041210T183838Z
DTSTART:20041206T120000Z
DTEND:20041206T130000Z
RRULE:FREQ=WEEKLY
END:VEVENT
BEGIN:VEVENT
UID:2@example.com
SUMMARY:Weekly Meeting
RECURRENCE-ID:20041213T120000Z
DTSTAMP:20041210T183838Z
DTSTART:20041213T130000Z
DTEND:20041213T140000Z
END:VEVENT
END:VCALENDAR
";
#[rstest]
#[case(0, ICAL)]
#[case(1, include_str!("resources/rfc4791_appb.ics"))]
#[tokio::test]
async fn test_import(
#[from(test_store_context)]
#[future]
context: TestStoreContext,
#[case] case: usize,
#[case] ical: &'static str,
) {
let context = context.await;
let app = get_app(context.clone());
let (principal, addr_id) = ("user", "calendar");
let url = format!("/caldav/principal/{principal}/{addr_id}");
let request_template = || {
Request::builder()
.method("IMPORT")
.uri(&url)
.body(Body::from(ical))
.unwrap()
};
// Try without authentication
let request = request_template();
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
// Try with correct credentials
let mut request = request_template();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::OK);
let body = response.extract_string().await;
insta::assert_snapshot!(format!("{case}_import_body"), body);
let mut request = Request::builder()
.method("GET")
.uri(&url)
.body(Body::empty())
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::OK);
let body = response.extract_string().await;
insta::with_settings!({
filters => vec![
(r"UID:.+", "UID:[UID]")
]
}, {
insta::assert_snapshot!(format!("{case}_get_body"), body);
});
}

View File

@@ -0,0 +1,196 @@
use crate::integration_tests::{ResponseExtractString, get_app};
use axum::body::Body;
use axum::extract::Request;
use headers::{Authorization, HeaderMapExt};
use http::StatusCode;
use rstest::rstest;
use rustical_store_sqlite::tests::{TestStoreContext, test_store_context};
use tower::ServiceExt;
const ICS_1: &str = include_str!("resources/rfc4791_appb.ics");
const REPORT_7_8_1: &str = r#"
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop>
<D:getetag/>
<C:calendar-data>
<C:comp name="VCALENDAR">
<C:prop name="VERSION"/>
<C:comp name="VEVENT">
<C:prop name="SUMMARY"/>
<C:prop name="UID"/>
<C:prop name="DTSTART"/>
<C:prop name="DTEND"/>
<C:prop name="DURATION"/>
<C:prop name="RRULE"/>
<C:prop name="RDATE"/>
<C:prop name="EXRULE"/>
<C:prop name="EXDATE"/>
<C:prop name="RECURRENCE-ID"/>
</C:comp>
<C:comp name="VTIMEZONE"/>
</C:comp>
</C:calendar-data>
</D:prop>
<C:filter>
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VEVENT">
<C:time-range start="20060104T000000Z"
end="20060105T000000Z"/>
</C:comp-filter>
</C:comp-filter>
</C:filter>
</C:calendar-query>
"#;
const REPORT_7_8_2: &str = r#"
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop>
<C:calendar-data>
<C:limit-recurrence-set start="20060103T000000Z"
end="20060105T000000Z"/>
</C:calendar-data>
</D:prop>
<C:filter>
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VEVENT">
<C:time-range start="20060103T000000Z"
end="20060105T000000Z"/>
</C:comp-filter>
</C:comp-filter>
</C:filter>
</C:calendar-query>
"#;
const REPORT_7_8_3: &str = r#"
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop>
<C:calendar-data>
<C:expand start="20060103T000000Z"
end="20060105T000000Z"/>
</C:calendar-data>
</D:prop>
<C:filter>
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VEVENT">
<C:time-range start="20060103T000000Z"
end="20060105T000000Z"/>
</C:comp-filter>
</C:comp-filter>
</C:filter>
</C:calendar-query>
"#;
const OUTPUT_7_8_3: &str = r#"
<D:response>
<D:href>http://cal.example.com/bernard/work/abcd2.ics</D:href>
<D:propstat>
<D:prop>
<D:getetag>"fffff-abcd2"</D:getetag>
<C:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART:20060103T170000
DURATION:PT1H
RECURRENCE-ID:20060103T170000
SUMMARY:Event #2
UID:00959BC664CA650E933C892C@example.com
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART:20060104T190000
DURATION:PT1H
RECURRENCE-ID:20060104T170000
SUMMARY:Event #2 bis
UID:00959BC664CA650E933C892C@example.com
END:VEVENT
END:VCALENDAR
</C:calendar-data>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>http://cal.example.com/bernard/work/abcd3.ics</D:href>
<D:propstat>
<D:prop>
<D:getetag>"fffff-abcd3"</D:getetag>
<C:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART:20060104T150000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:DC6C50A017428C5216A2F1CD@example.com
X-ABC-GUID:E1CX5Dr-0007ym-Hz@example.com
END:VEVENT
END:VCALENDAR
</C:calendar-data>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
"#;
#[rstest]
#[case(0, ICS_1, REPORT_7_8_1)]
#[case(1, ICS_1, REPORT_7_8_2)]
#[case(2, ICS_1, REPORT_7_8_3)]
#[tokio::test]
async fn test_report(
#[from(test_store_context)]
#[future]
context: TestStoreContext,
#[case] case: usize,
#[case] ics: &'static str,
#[case] report: &'static str,
) {
let context = context.await;
let app = get_app(context.clone());
let (principal, addr_id) = ("user", "calendar");
let url = format!("/caldav/principal/{principal}/{addr_id}");
let request_template = || {
Request::builder()
.method("IMPORT")
.uri(&url)
.body(Body::from(ics))
.unwrap()
};
// Try with correct credentials
let mut request = request_template();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::OK);
let mut request = Request::builder()
.method("REPORT")
.uri(&url)
.body(Body::from(report))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::MULTI_STATUS);
let body = response.extract_string().await;
insta::assert_snapshot!(format!("{case}_report_body"), body);
}

View File

@@ -8,6 +8,8 @@ use rustical_store_sqlite::tests::{TestStoreContext, test_store_context};
use tower::ServiceExt; use tower::ServiceExt;
mod calendar; mod calendar;
mod calendar_import;
mod calendar_report;
#[rstest] #[rstest]
#[tokio::test] #[tokio::test]

View File

@@ -0,0 +1,102 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20060206T001102Z
DTSTART;TZID=US/Eastern:20060102T100000
DURATION:PT1H
SUMMARY:Event #1
Description:Go Steelers!
UID:abcd1
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060102T120000
DURATION:PT1H
RRULE:FREQ=DAILY;COUNT=5
SUMMARY:Event #2
UID:abcd2
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060104T140000
DURATION:PT1H
RECURRENCE-ID;TZID=US/Eastern:20060104T120000
SUMMARY:Event #2 bis
UID:abcd2
END:VEVENT
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:abcd3
END:VEVENT
BEGIN:VTODO
DTSTAMP:20060205T235335Z
DUE;VALUE=DATE:20060104
STATUS:NEEDS-ACTION
SUMMARY:Task #1
UID:abcd4
BEGIN:VALARM
ACTION:AUDIO
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VTODO
BEGIN:VTODO
DTSTAMP:20060205T235300Z
DUE;VALUE=DATE:20060106
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:NEEDS-ACTION
SUMMARY:Task #2
UID:abcd5
BEGIN:VALARM
ACTION:AUDIO
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VTODO
BEGIN:VTODO
COMPLETED:20051223T122322Z
DTSTAMP:20060205T235400Z
DUE;VALUE=DATE:20051225
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:COMPLETED
SUMMARY:Task #3
UID:abcd6
END:VTODO
BEGIN:VTODO
DTSTAMP:20060205T235600Z
DUE;VALUE=DATE:20060101
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:CANCELLED
SUMMARY:Task #4
UID:abcd7
END:VTODO
END:VCALENDAR

View File

@@ -8,5 +8,5 @@ CALSCALE:GREGORIAN
PRODID:RustiCal PRODID:RustiCal
X-WR-CALNAME:Calendar X-WR-CALNAME:Calendar
X-WR-CALDESC:Description X-WR-CALDESC:Description
X-WR-TIMEZONE:Europe/Berlin X-WR-TIMEZONE:US/Eastern
END:VCALENDAR END:VCALENDAR

View File

@@ -0,0 +1,20 @@
---
source: src/integration_tests/caldav/calendar.rs
expression: body
---
<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
<response>
<href>/caldav/principal/user/calendar/qwue23489.ics</href>
<propstat>
<prop>
<getetag>&quot;aea50382a7775bb9742bfec277382e3a260b6066f503b5f5ae34548d7215ee46&quot;</getetag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/home/bernard/addressbook/vcf1.vcf</href>
<status>HTTP/1.1 404 Not Found</status>
</response>
</multistatus>

View File

@@ -14,109 +14,117 @@ expression: body
PRODID:-//github.com/lennart-k/vzic-rs//RustiCal Calendar server//EN PRODID:-//github.com/lennart-k/vzic-rs//RustiCal Calendar server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VTIMEZONE BEGIN:VTIMEZONE
TZID:Europe/Berlin TZID:America/New_York
LAST-MODIFIED:20250723T190331Z LAST-MODIFIED:20250723T190331Z
X-LIC-LOCATION:Europe/Berlin X-LIC-LOCATION:America/New_York
X-PROLEPTIC-TZNAME:LMT X-PROLEPTIC-TZNAME:LMT
BEGIN:STANDARD BEGIN:STANDARD
TZNAME:CET TZNAME:EST
TZOFFSETFROM:+005328 TZOFFSETFROM:-045602
TZOFFSETTO:+0100 TZOFFSETTO:-0500
DTSTART:18930401T000000 DTSTART:18831118T120358
END:STANDARD END:STANDARD
BEGIN:DAYLIGHT BEGIN:DAYLIGHT
TZNAME:CEST TZNAME:EDT
TZOFFSETFROM:+0100 TZOFFSETFROM:-0500
TZOFFSETTO:+0200 TZOFFSETTO:-0400
DTSTART:19160430T230000 DTSTART:19180331T020000
RDATE:19400401T020000 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU;UNTIL=19200328T070000Z
RDATE:19430329T020000
RDATE:19460414T020000
RDATE:19470406T030000
RDATE:19480418T020000
RDATE:19490410T020000
RDATE:19800406T020000
END:DAYLIGHT END:DAYLIGHT
BEGIN:STANDARD BEGIN:STANDARD
TZNAME:CET TZNAME:EST
TZOFFSETFROM:+0200 TZOFFSETFROM:-0400
TZOFFSETTO:+0100 TZOFFSETTO:-0500
DTSTART:19161001T010000 DTSTART:19181027T020000
RDATE:19421102T030000 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU;UNTIL=19201031T060000Z
RDATE:19431004T030000
RDATE:19441002T030000
RDATE:19451118T030000
RDATE:19461007T030000
END:STANDARD END:STANDARD
BEGIN:DAYLIGHT BEGIN:DAYLIGHT
TZNAME:CEST TZNAME:EDT
TZOFFSETFROM:+0100 TZOFFSETFROM:-0500
TZOFFSETTO:+0200 TZOFFSETTO:-0400
DTSTART:19170416T020000 DTSTART:19210424T020000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=3MO;UNTIL=19180415T010000Z RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=-1SU;UNTIL=19410427T070000Z
END:DAYLIGHT END:DAYLIGHT
BEGIN:STANDARD BEGIN:STANDARD
TZNAME:CET TZNAME:EST
TZOFFSETFROM:+0200 TZOFFSETFROM:-0400
TZOFFSETTO:+0100 TZOFFSETTO:-0500
DTSTART:19170917T030000 DTSTART:19210925T020000
RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=3MO;UNTIL=19180916T010000Z RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=-1SU;UNTIL=19410928T060000Z
END:STANDARD END:STANDARD
BEGIN:DAYLIGHT BEGIN:DAYLIGHT
TZNAME:CEST TZNAME:EWT
TZOFFSETFROM:+0100 TZOFFSETFROM:-0500
TZOFFSETTO:+0200 TZOFFSETTO:-0400
DTSTART:19440403T020000 DTSTART:19420209T020000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1MO;UNTIL=19450402T010000Z
END:DAYLIGHT END:DAYLIGHT
BEGIN:DAYLIGHT BEGIN:DAYLIGHT
TZNAME:CEMT TZNAME:EPT
TZOFFSETFROM:+0200 TZOFFSETFROM:-0400
TZOFFSETTO:+0300 TZOFFSETTO:-0400
DTSTART:19450524T020000 DTSTART:19450814T190000
RDATE:19470511T030000
END:DAYLIGHT
BEGIN:DAYLIGHT
TZNAME:CEST
TZOFFSETFROM:+0300
TZOFFSETTO:+0200
DTSTART:19450924T030000
RDATE:19470629T030000
END:DAYLIGHT END:DAYLIGHT
BEGIN:STANDARD BEGIN:STANDARD
TZNAME:CET TZNAME:EST
TZOFFSETFROM:+0100 TZOFFSETFROM:-0400
TZOFFSETTO:+0100 TZOFFSETTO:-0500
DTSTART:19460101T000000 DTSTART:19450930T020000
RDATE:19800101T000000
END:STANDARD
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19471005T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=1SU;UNTIL=19491002T010000Z
END:STANDARD
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19800928T030000
RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=-1SU;UNTIL=19950924T010000Z
END:STANDARD END:STANDARD
BEGIN:DAYLIGHT BEGIN:DAYLIGHT
TZNAME:CEST TZNAME:EDT
TZOFFSETFROM:+0100 TZOFFSETFROM:-0500
TZOFFSETTO:+0200 TZOFFSETTO:-0400
DTSTART:19810329T020000 DTSTART:19460428T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=-1SU;UNTIL=19730429T070000Z
END:DAYLIGHT END:DAYLIGHT
BEGIN:STANDARD BEGIN:STANDARD
TZNAME:CET TZNAME:EST
TZOFFSETFROM:+0200 TZOFFSETFROM:-0400
TZOFFSETTO:+0100 TZOFFSETTO:-0500
DTSTART:19961027T030000 DTSTART:19460929T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=-1SU;UNTIL=19540926T060000Z
END:STANDARD
BEGIN:STANDARD
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
DTSTART:19551030T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU;UNTIL=20061029T060000Z
END:STANDARD
BEGIN:DAYLIGHT
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
DTSTART:19740106T020000
RDATE:19750223T020000
END:DAYLIGHT
BEGIN:DAYLIGHT
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
DTSTART:19760425T020000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=-1SU;UNTIL=19860427T070000Z
END:DAYLIGHT
BEGIN:DAYLIGHT
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
DTSTART:19870405T020000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU;UNTIL=20060402T070000Z
END:DAYLIGHT
BEGIN:DAYLIGHT
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD END:STANDARD
END:VTIMEZONE END:VTIMEZONE
END:VCALENDAR END:VCALENDAR
@@ -124,7 +132,7 @@ END:VCALENDAR
<CAL:timezone-service-set> <CAL:timezone-service-set>
<href>https://www.iana.org/time-zones</href> <href>https://www.iana.org/time-zones</href>
</CAL:timezone-service-set> </CAL:timezone-service-set>
<CAL:calendar-timezone-id>Europe/Berlin</CAL:calendar-timezone-id> <CAL:calendar-timezone-id>US/Eastern</CAL:calendar-timezone-id>
<calendar-order xmlns="http://apple.com/ns/ical/">0</calendar-order> <calendar-order xmlns="http://apple.com/ns/ical/">0</calendar-order>
<CAL:supported-calendar-component-set> <CAL:supported-calendar-component-set>
<CAL:comp name="VEVENT"/> <CAL:comp name="VEVENT"/>
@@ -139,7 +147,7 @@ END:VCALENDAR
<CAL:supported-collation>i;unicode-casemap</CAL:supported-collation> <CAL:supported-collation>i;unicode-casemap</CAL:supported-collation>
<CAL:supported-collation>i;octet</CAL:supported-collation> <CAL:supported-collation>i;octet</CAL:supported-collation>
</CAL:supported-collation-set> </CAL:supported-collation-set>
<max-resource-size>10000000</max-resource-size> <CAL:max-resource-size>10000000</CAL:max-resource-size>
<supported-report-set> <supported-report-set>
<supported-report> <supported-report>
<report> <report>

View File

@@ -0,0 +1,32 @@
---
source: src/integration_tests/caldav/calendar_import.rs
expression: body
---
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:RustiCal
BEGIN:VEVENT
UID:[UID]
SUMMARY:One-off Meeting
DTSTAMP:20041210T183904Z
DTSTART:20041207T120000Z
DTEND:20041207T130000Z
END:VEVENT
BEGIN:VEVENT
UID:[UID]
SUMMARY:Weekly Meeting
DTSTAMP:20041210T183838Z
DTSTART:20041206T120000Z
DTEND:20041206T130000Z
RRULE:FREQ=WEEKLY
END:VEVENT
BEGIN:VEVENT
UID:[UID]
SUMMARY:Weekly Meeting
RECURRENCE-ID:20041213T120000Z
DTSTAMP:20041210T183838Z
DTSTART:20041213T130000Z
DTEND:20041213T140000Z
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,5 @@
---
source: src/integration_tests/caldav/calendar_import.rs
expression: body
---

View File

@@ -0,0 +1,107 @@
---
source: src/integration_tests/caldav/calendar_import.rs
expression: body
---
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:RustiCal
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20060206T001102Z
DTSTART;TZID=US/Eastern:20060102T100000
DURATION:PT1H
SUMMARY:Event #1
Description:Go Steelers!
UID:[UID]
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060102T120000
DURATION:PT1H
RRULE:FREQ=DAILY;COUNT=5
SUMMARY:Event #2
UID:[UID]
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060104T140000
DURATION:PT1H
RECURRENCE-ID;TZID=US/Eastern:20060104T120000
SUMMARY:Event #2 bis
UID:[UID]
END:VEVENT
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:[UID]
END:VEVENT
BEGIN:VTODO
DTSTAMP:20060205T235335Z
DUE;VALUE=DATE:20060104
STATUS:NEEDS-ACTION
SUMMARY:Task #1
UID:[UID]
BEGIN:VALARM
ACTION:AUDIO
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VTODO
BEGIN:VTODO
DTSTAMP:20060205T235300Z
DUE;VALUE=DATE:20060106
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:NEEDS-ACTION
SUMMARY:Task #2
UID:[UID]
BEGIN:VALARM
ACTION:AUDIO
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VTODO
BEGIN:VTODO
COMPLETED:20051223T122322Z
DTSTAMP:20060205T235400Z
DUE;VALUE=DATE:20051225
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:COMPLETED
SUMMARY:Task #3
UID:[UID]
END:VTODO
BEGIN:VTODO
DTSTAMP:20060205T235600Z
DUE;VALUE=DATE:20060101
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:CANCELLED
SUMMARY:Task #4
UID:[UID]
END:VTODO
END:VCALENDAR

View File

@@ -0,0 +1,5 @@
---
source: src/integration_tests/caldav/calendar_import.rs
expression: body
---

View File

@@ -0,0 +1,107 @@
---
source: src/integration_tests/caldav/calendar_import.rs
expression: body
---
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:RustiCal
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060104T140000
DURATION:PT1H
RECURRENCE-ID;TZID=US/Eastern:20060104T120000
SUMMARY:Event #2 bis
UID:[UID]
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001102Z
DTSTART;TZID=US/Eastern:20060102T100000
DURATION:PT1H
SUMMARY:Event #1
Description:Go Steelers!
UID:[UID]
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060102T120000
DURATION:PT1H
RRULE:FREQ=DAILY;COUNT=5
SUMMARY:Event #2
UID:[UID]
END:VEVENT
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:[UID]
END:VEVENT
BEGIN:VTODO
DTSTAMP:20060205T235335Z
DUE;VALUE=DATE:20060104
STATUS:NEEDS-ACTION
SUMMARY:Task #1
UID:[UID]
BEGIN:VALARM
ACTION:AUDIO
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VTODO
BEGIN:VTODO
DTSTAMP:20060205T235300Z
DUE;VALUE=DATE:20060106
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:NEEDS-ACTION
SUMMARY:Task #2
UID:[UID]
BEGIN:VALARM
ACTION:AUDIO
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VTODO
BEGIN:VTODO
COMPLETED:20051223T122322Z
DTSTAMP:20060205T235400Z
DUE;VALUE=DATE:20051225
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:COMPLETED
SUMMARY:Task #3
UID:[UID]
END:VTODO
BEGIN:VTODO
DTSTAMP:20060205T235600Z
DUE;VALUE=DATE:20060101
LAST-MODIFIED:20060205T235308Z
SEQUENCE:1
STATUS:CANCELLED
SUMMARY:Task #4
UID:[UID]
END:VTODO
END:VCALENDAR

View File

@@ -0,0 +1,5 @@
---
source: src/integration_tests/caldav/calendar_import.rs
expression: body
---

View File

@@ -0,0 +1,100 @@
---
source: src/integration_tests/caldav/calendar_report.rs
expression: body
---
<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
<response>
<href>/caldav/principal/user/calendar/abcd2.ics</href>
<propstat>
<prop>
<getetag>&quot;7d80077c5655339885a36b6dbe97336767fb85e6b12c94668bcac100ed971fac&quot;</getetag>
<CAL:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060102T120000
DURATION:PT1H
RRULE:FREQ=DAILY;COUNT=5
SUMMARY:Event #2
UID:abcd2
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060104T140000
DURATION:PT1H
RECURRENCE-ID;TZID=US/Eastern:20060104T120000
SUMMARY:Event #2 bis
UID:abcd2
END:VEVENT
END:VCALENDAR
</CAL:calendar-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav/principal/user/calendar/abcd3.ics</href>
<propstat>
<prop>
<getetag>&quot;c6a5b1cf6985805686df99e7f2e1cf286567dcb3383fc6fa1b12ce42d3fbc01c&quot;</getetag>
<CAL:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:abcd3
END:VEVENT
END:VCALENDAR
</CAL:calendar-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@@ -0,0 +1,98 @@
---
source: src/integration_tests/caldav/calendar_report.rs
expression: body
---
<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
<response>
<href>/caldav/principal/user/calendar/abcd2.ics</href>
<propstat>
<prop>
<CAL:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060102T120000
DURATION:PT1H
RRULE:FREQ=DAILY;COUNT=5
SUMMARY:Event #2
UID:abcd2
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DTSTART;TZID=US/Eastern:20060104T140000
DURATION:PT1H
RECURRENCE-ID;TZID=US/Eastern:20060104T120000
SUMMARY:Event #2 bis
UID:abcd2
END:VEVENT
END:VCALENDAR
</CAL:calendar-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav/principal/user/calendar/abcd3.ics</href>
<propstat>
<prop>
<CAL:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:abcd3
END:VEVENT
END:VCALENDAR
</CAL:calendar-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@@ -0,0 +1,62 @@
---
source: src/integration_tests/caldav/calendar_report.rs
expression: body
---
<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
<response>
<href>/caldav/principal/user/calendar/abcd2.ics</href>
<propstat>
<prop>
<CAL:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DURATION:PT1H
SUMMARY:Event #2
UID:abcd2
RECURRENCE-ID:20060103T170000Z
DTSTART:20060103T170000Z
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20060206T001121Z
DURATION:PT1H
SUMMARY:Event #2
UID:abcd2
RECURRENCE-ID:20060104T170000Z
DTSTART:20060104T170000Z
END:VEVENT
END:VCALENDAR
</CAL:calendar-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav/principal/user/calendar/abcd3.ics</href>
<propstat>
<prop>
<CAL:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com
DTSTAMP:20060206T001220Z
DTSTART;TZID=US/Eastern:20060104T100000
DURATION:PT1H
LAST-MODIFIED:20060206T001330Z
ORGANIZER:mailto:cyrus@example.com
SEQUENCE:1
STATUS:TENTATIVE
SUMMARY:Event #3
UID:abcd3
END:VEVENT
END:VCALENDAR
</CAL:calendar-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@@ -192,3 +192,256 @@ async fn test_carddav_addressbook(
Err(rustical_store::Error::NotFound) Err(rustical_store::Error::NotFound)
)); ));
} }
#[rstest]
#[tokio::test]
async fn test_mkcol_rfc6352_6_3_1_1(
#[from(test_store_context)]
#[future]
context: TestStoreContext,
) {
let context = context.await;
let app = get_app(context.clone());
let addr_store = context.addr_store;
let (displayname, description) = (
"Lisa's Contacts".to_owned(),
"My primary address book.".to_owned(),
);
let (principal, addr_id) = ("user", "contacts");
let url = format!("/carddav/principal/{principal}/{addr_id}");
let mut request = Request::builder()
.method("MKCOL")
.uri(&url)
.body(Body::from(format!(
r#"<?xml version="1.0" encoding="utf-8" ?>
<D:mkcol xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:set>
<D:prop>
<D:resourcetype>
<D:collection/>
<C:addressbook/>
</D:resourcetype>
<D:displayname>{displayname}</D:displayname>
<C:addressbook-description xml:lang="en"
>{description}</C:addressbook-description>
</D:prop>
</D:set>
</D:mkcol>"#
)))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let body = response.extract_string().await;
insta::assert_snapshot!("mkcol_body", body);
let saved_addressbook = addr_store
.get_addressbook(principal, addr_id, false)
.await
.unwrap();
assert_eq!(
(
saved_addressbook.displayname.unwrap(),
saved_addressbook.description.unwrap()
),
(displayname, description)
);
let vcard = r"BEGIN:VCARD
VERSION:3.0
FN:Cyrus Daboo
N:Daboo;Cyrus
ADR;TYPE=POSTAL:;2822 Email HQ;Suite 2821;RFCVille;PA;15213;USA
EMAIL;TYPE=INTERNET,PREF:cyrus@example.com
NICKNAME:me
NOTE:Example VCard.
ORG:Self Employed
TEL;TYPE=WORK,VOICE:412 605 0499
TEL;TYPE=FAX:412 605 0705
URL:http://www.example.com
UID:1234-5678-9000-1
END:VCARD
";
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/newcard.vcf"))
.header("If-None-Match", "*")
.header("Content-Type", "text/vcard")
.body(Body::from(vcard))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let etag = response.headers().get("ETag").unwrap();
// This should overwrite
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/newcard.vcf"))
.header("If-None-Match", "\"somearbitraryetag\"")
.header("Content-Type", "text/vcard")
.body(Body::from(vcard))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/newcard.vcf"))
.header("If-None-Match", etag)
.header("Content-Type", "text/vcard")
.body(Body::from(vcard))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CONFLICT);
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/newcard.vcf"))
.header("If-None-Match", "*")
.header("Content-Type", "text/vcard")
.body(Body::from(vcard))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CONFLICT);
}
#[rstest]
#[tokio::test]
async fn test_rfc6352_8_7_1(
#[from(test_store_context)]
#[future]
context: TestStoreContext,
) {
let context = context.await;
let app = get_app(context.clone());
let addr_store = context.addr_store;
let (displayname, description) = (
"Lisa's Contacts".to_owned(),
"My primary address book.".to_owned(),
);
let (principal, addr_id) = ("user", "contacts");
let url = format!("/carddav/principal/{principal}/{addr_id}");
let mut request = Request::builder()
.method("MKCOL")
.uri(&url)
.body(Body::from(format!(
r#"<?xml version="1.0" encoding="utf-8" ?>
<D:mkcol xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:set>
<D:prop>
<D:resourcetype>
<D:collection/>
<C:addressbook/>
</D:resourcetype>
<D:displayname>{displayname}</D:displayname>
<C:addressbook-description xml:lang="en"
>{description}</C:addressbook-description>
</D:prop>
</D:set>
</D:mkcol>"#
)))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let body = response.extract_string().await;
insta::assert_snapshot!("mkcol_body", body);
let saved_addressbook = addr_store
.get_addressbook(principal, addr_id, false)
.await
.unwrap();
assert_eq!(
(
saved_addressbook.displayname.unwrap(),
saved_addressbook.description.unwrap()
),
(displayname, description)
);
let vcard = r"BEGIN:VCARD
VERSION:3.0
FN:Cyrus Daboo
N:Daboo;Cyrus
ADR;TYPE=POSTAL:;2822 Email HQ;Suite 2821;RFCVille;PA;15213;USA
EMAIL;TYPE=INTERNET,PREF:cyrus@example.com
NICKNAME:me
NOTE:Example VCard.
ORG:Self Employed
TEL;TYPE=WORK,VOICE:412 605 0499
TEL;TYPE=FAX:412 605 0705
URL:http://www.example.com
UID:1234-5678-9000-1
END:VCARD
";
let mut request = Request::builder()
.method("PUT")
.uri(format!("{url}/newcard.vcf"))
.header("If-None-Match", "*")
.header("Content-Type", "text/vcard")
.body(Body::from(vcard))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::CREATED);
let mut request = Request::builder()
.method("REPORT")
.uri(&url)
.header("Depth", "infinity")
.header("Content-Type", "text/xml; charset=\"utf-8\"")
.body(Body::from(format!(
r#"
<?xml version="1.0" encoding="utf-8" ?>
<C:addressbook-multiget xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<D:getetag/>
<C:address-data>
<C:prop name="VERSION"/>
<C:prop name="UID"/>
<C:prop name="NICKNAME"/>
<C:prop name="EMAIL"/>
<C:prop name="FN"/>
</C:address-data>
</D:prop>
<D:href>{url}/newcard.vcf</D:href>
<D:href>/home/bernard/addressbook/vcf1.vcf</D:href>
</C:addressbook-multiget>
"#
)))
.unwrap();
request
.headers_mut()
.typed_insert(Authorization::basic("user", "pass"));
let response = app.clone().oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::MULTI_STATUS);
let body = response.extract_string().await;
insta::assert_snapshot!("multiget_body", body);
}

View File

@@ -0,0 +1,35 @@
---
source: src/integration_tests/carddav/addressbook.rs
expression: body
---
<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
<response>
<href>/carddav/principal/user/contacts/newcard.vcf</href>
<propstat>
<prop>
<getetag>&quot;24835b6c11816c864f9edadd4c7c296234c643892afcbbc5fbf5c9b7ac935cf8&quot;</getetag>
<CARD:address-data>BEGIN:VCARD
VERSION:3.0
FN:Cyrus Daboo
N:Daboo;Cyrus
ADR;TYPE=POSTAL:;2822 Email HQ;Suite 2821;RFCVille;PA;15213;USA
EMAIL;TYPE=INTERNET,PREF:cyrus@example.com
NICKNAME:me
NOTE:Example VCard.
ORG:Self Employed
TEL;TYPE=WORK,VOICE:412 605 0499
TEL;TYPE=FAX:412 605 0705
URL:http://www.example.com
UID:1234-5678-9000-1
END:VCARD
</CARD:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/home/bernard/addressbook/vcf1.vcf</href>
<status>HTTP/1.1 404 Not Found</status>
</response>
</multistatus>

View File

@@ -30,7 +30,7 @@ expression: body
</report> </report>
</supported-report> </supported-report>
</supported-report-set> </supported-report-set>
<max-resource-size>10000000</max-resource-size> <CARD:max-resource-size>10000000</CARD:max-resource-size>
<sync-token>github.com/lennart-k/rustical/ns/0</sync-token> <sync-token>github.com/lennart-k/rustical/ns/0</sync-token>
<CS:getctag>github.com/lennart-k/rustical/ns/0</CS:getctag> <CS:getctag>github.com/lennart-k/rustical/ns/0</CS:getctag>
<PUSH:transports> <PUSH:transports>

View File

@@ -25,7 +25,7 @@ use std::sync::Arc;
use tokio::sync::mpsc::Receiver; use tokio::sync::mpsc::Receiver;
use tower::Layer; use tower::Layer;
use tower_http::normalize_path::NormalizePathLayer; use tower_http::normalize_path::NormalizePathLayer;
use tracing::info; use tracing::{info, warn};
mod app; mod app;
mod commands; mod commands;
@@ -34,6 +34,9 @@ mod config;
pub mod integration_tests; pub mod integration_tests;
mod setup_tracing; mod setup_tracing;
mod migration_0_12;
use migration_0_12::{validate_address_objects_0_12, validate_calendar_objects_0_12};
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)] #[command(author, version, about, long_about = None)]
struct Args { struct Args {
@@ -67,15 +70,22 @@ async fn get_data_stores(
Receiver<CollectionOperation>, Receiver<CollectionOperation>,
)> { )> {
Ok(match &config { Ok(match &config {
DataStoreConfig::Sqlite(SqliteDataStoreConfig { db_url }) => { DataStoreConfig::Sqlite(SqliteDataStoreConfig {
db_url,
run_repairs,
}) => {
let db = create_db_pool(db_url, migrate).await?; let db = create_db_pool(db_url, migrate).await?;
// Channel to watch for changes (for DAV Push) // Channel to watch for changes (for DAV Push)
let (send, recv) = tokio::sync::mpsc::channel(1000); let (send, recv) = tokio::sync::mpsc::channel(1000);
let addressbook_store = Arc::new(SqliteAddressbookStore::new(db.clone(), send.clone())); let addressbook_store = Arc::new(SqliteAddressbookStore::new(db.clone(), send.clone()));
addressbook_store.repair_orphans().await?;
let cal_store = Arc::new(SqliteCalendarStore::new(db.clone(), send)); let cal_store = Arc::new(SqliteCalendarStore::new(db.clone(), send));
if *run_repairs {
info!("Running repair tasks");
addressbook_store.repair_orphans().await?;
cal_store.repair_invalid_version_4_0().await?;
cal_store.repair_orphans().await?; cal_store.repair_orphans().await?;
}
let subscription_store = Arc::new(SqliteStore::new(db.clone())); let subscription_store = Arc::new(SqliteStore::new(db.clone()));
let principal_store = Arc::new(SqlitePrincipalStore::new(db)); let principal_store = Arc::new(SqlitePrincipalStore::new(db));
( (
@@ -115,6 +125,14 @@ async fn main() -> Result<()> {
let (addr_store, cal_store, subscription_store, principal_store, update_recv) = let (addr_store, cal_store, subscription_store, principal_store, update_recv) =
get_data_stores(!args.no_migrations, &config.data_store).await?; get_data_stores(!args.no_migrations, &config.data_store).await?;
warn!(
"Validating calendar data against the next-version ical parser.
In the next major release these will be rejected and cause errors.
If any errors occur, please open an issue so they can be fixed before the next major release."
);
validate_calendar_objects_0_12(principal_store.as_ref(), cal_store.as_ref()).await?;
validate_address_objects_0_12(principal_store.as_ref(), addr_store.as_ref()).await?;
let mut tasks = vec![]; let mut tasks = vec![];
if config.dav_push.enabled { if config.dav_push.enabled {

80
src/migration_0_12.rs Normal file
View File

@@ -0,0 +1,80 @@
use rustical_store::{AddressbookStore, CalendarStore, auth::AuthenticationProvider};
use tracing::{error, info};
pub async fn validate_calendar_objects_0_12(
principal_store: &impl AuthenticationProvider,
cal_store: &impl CalendarStore,
) -> Result<(), rustical_store::Error> {
let mut success = true;
for principal in principal_store.get_principals().await? {
for calendar in cal_store.get_calendars(&principal.id).await? {
for object in cal_store
.get_objects(&calendar.principal, &calendar.id)
.await?
{
if let Err(err) =
ical_dev::parser::ical::IcalObjectParser::new(object.get_ics().as_bytes())
.expect_one()
{
success = false;
error!(
"An error occured parsing a calendar object: principal={principal}, calendar={calendar}, object_id={object_id}: {err}",
principal = principal.id,
calendar = calendar.id,
object_id = object.get_id()
);
println!("{}", object.get_ics());
}
}
}
}
if success {
info!("Your calendar data seems to be valid in the next major version.");
} else {
error!(
"Not all calendar objects will be successfully parsed in the next major version (v0.12).
This will not cause issues in this version, but please comment under the tracking issue on GitHub:
https://github.com/lennart-k/rustical/issues/165"
);
}
Ok(())
}
pub async fn validate_address_objects_0_12(
principal_store: &impl AuthenticationProvider,
addr_store: &impl AddressbookStore,
) -> Result<(), rustical_store::Error> {
let mut success = true;
for principal in principal_store.get_principals().await? {
for addressbook in addr_store.get_addressbooks(&principal.id).await? {
for object in addr_store
.get_objects(&addressbook.principal, &addressbook.id)
.await?
{
if let Err(err) =
ical_dev::parser::vcard::VcardParser::new(object.get_vcf().as_bytes())
.expect_one()
{
success = false;
error!(
"An error occured parsing an address object: principal={principal}, addressbook={addressbook}, object_id={object_id}: {err}",
principal = principal.id,
addressbook = addressbook.id,
object_id = object.get_id()
);
println!("{}", object.get_vcf());
}
}
}
}
if success {
info!("Your addressbook data seems to be valid in the next major version.");
} else {
error!(
"Not all address objects will be successfully parsed in the next major version (v0.12).
This will not cause issues in this version, but please comment under the tracking issue on GitHub:
https://github.com/lennart-k/rustical/issues/165"
);
}
Ok(())
}