Update caldata-rs

This commit is contained in:
Lennart K
2026-01-31 14:17:10 +01:00
parent cc333f7182
commit 41eed732eb
9 changed files with 21 additions and 40 deletions

21
Cargo.lock generated
View File

@@ -567,18 +567,18 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
[[package]] [[package]]
name = "caldata" name = "caldata"
version = "0.14.0" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36de4a8034d98c95e7fe874b828272d823cfbd68e9571fe7bf6c419e852cbe2" checksum = "e18d0b0cbc271e44b6f0dc262c9469f10f10f8af3fa00c3ebcc10e49ac91d478"
dependencies = [ dependencies = [
"chrono", "chrono",
"chrono-tz", "chrono-tz",
"derive_more", "derive_more",
"itertools 0.14.0", "itertools 0.14.0",
"lazy_static", "lazy_static",
"log",
"phf 0.13.1", "phf 0.13.1",
"regex", "regex",
"rrule",
"thiserror 2.0.18", "thiserror 2.0.18",
"vtimezones-rs", "vtimezones-rs",
] ]
@@ -3169,19 +3169,6 @@ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
[[package]]
name = "rrule"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "720acfb4980b9d8a6a430f6d7a11933e701ebbeba5eee39cc9d8c5f932aaff74"
dependencies = [
"chrono",
"chrono-tz",
"log",
"regex",
"thiserror 2.0.18",
]
[[package]] [[package]]
name = "rsa" name = "rsa"
version = "0.9.10" version = "0.9.10"
@@ -3530,7 +3517,6 @@ dependencies = [
"chrono-tz", "chrono-tz",
"derive_more", "derive_more",
"regex", "regex",
"rrule",
"rstest", "rstest",
"rustical_xml", "rustical_xml",
"serde", "serde",
@@ -3571,7 +3557,6 @@ dependencies = [
"headers", "headers",
"http", "http",
"regex", "regex",
"rrule",
"rstest", "rstest",
"rstest_reuse", "rstest_reuse",
"rustical_dav", "rustical_dav",

View File

@@ -111,7 +111,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"] }
caldata = { version = "0.14.0", features = ["chrono-tz", "vtimezones-rs"] } caldata = { version = "0.15.0", features = ["chrono-tz", "vtimezones-rs"] }
toml = "0.9" toml = "0.9"
tower = "0.5" tower = "0.5"
tower-http = { version = "0.6", features = [ tower-http = { version = "0.6", features = [
@@ -124,7 +124,6 @@ chrono-tz = "0.10"
chrono-humanize = "0.2" chrono-humanize = "0.2"
rand = "0.9" rand = "0.9"
axum-extra = { version = "0.12", features = ["typed-header"] } axum-extra = { version = "0.12", features = ["typed-header"] }
rrule = "0.14"
argon2 = "0.5" argon2 = "0.5"
rpassword = "7.4" rpassword = "7.4"
password-hash = { version = "0.5" } password-hash = { version = "0.5" }

View File

@@ -43,28 +43,28 @@ pub async fn route_get<C: CalendarStore, S: SubscriptionStore>(
if let Some(displayname) = calendar.meta.displayname { if let Some(displayname) = calendar.meta.displayname {
props.push(ContentLine { props.push(ContentLine {
name: "X-WR-CALNAME".to_owned(), name: "X-WR-CALNAME".to_owned(),
value: Some(displayname), value: displayname,
params: vec![].into(), params: vec![].into(),
}); });
} }
if let Some(description) = calendar.meta.description { if let Some(description) = calendar.meta.description {
props.push(ContentLine { props.push(ContentLine {
name: "X-WR-CALDESC".to_owned(), name: "X-WR-CALDESC".to_owned(),
value: Some(description), value: description,
params: vec![].into(), params: vec![].into(),
}); });
} }
if let Some(color) = calendar.meta.color { if let Some(color) = calendar.meta.color {
props.push(ContentLine { props.push(ContentLine {
name: "X-WR-CALCOLOR".to_owned(), name: "X-WR-CALCOLOR".to_owned(),
value: Some(color), value: color,
params: vec![].into(), params: vec![].into(),
}); });
} }
if let Some(timezone_id) = calendar.timezone_id { if let Some(timezone_id) = calendar.timezone_id {
props.push(ContentLine { props.push(ContentLine {
name: "X-WR-TIMEZONE".to_owned(), name: "X-WR-TIMEZONE".to_owned(),
value: Some(timezone_id), value: timezone_id,
params: vec![].into(), params: vec![].into(),
}); });
} }

View File

@@ -35,16 +35,16 @@ pub async fn route_import<C: CalendarStore, S: SubscriptionStore>(
// Extract calendar metadata // Extract calendar metadata
let displayname = cal let displayname = cal
.get_property("X-WR-CALNAME") .get_property("X-WR-CALNAME")
.and_then(|prop| prop.value.clone()); .map(|prop| prop.value.clone());
let description = cal let description = cal
.get_property("X-WR-CALDESC") .get_property("X-WR-CALDESC")
.and_then(|prop| prop.value.clone()); .map(|prop| prop.value.clone());
let color = cal let color = cal
.get_property("X-WR-CALCOLOR") .get_property("X-WR-CALCOLOR")
.and_then(|prop| prop.value.clone()); .map(|prop| prop.value.clone());
let timezone_id = cal let timezone_id = cal
.get_property("X-WR-TIMEZONE") .get_property("X-WR-TIMEZONE")
.and_then(|prop| prop.value.clone()); .map(|prop| prop.value.clone());
// These properties should not appear in the expanded calendar objects // These properties should not appear in the expanded calendar objects
cal.remove_property("X-WR-CALNAME"); cal.remove_property("X-WR-CALNAME");
cal.remove_property("X-WR-CALDESC"); cal.remove_property("X-WR-CALDESC");

View File

@@ -34,7 +34,7 @@ pub async fn route_import<AS: AddressbookStore, S: SubscriptionStore>(
let mut card_mut = card.mutable(); let mut card_mut = card.mutable();
card_mut.add_content_line(ContentLine { card_mut.add_content_line(ContentLine {
name: "UID".to_owned(), name: "UID".to_owned(),
value: Some(uuid::Uuid::new_v4().to_string()), value: uuid::Uuid::new_v4().to_string(),
params: vec![].into(), params: vec![].into(),
}); });
card = card_mut.build(&ParserOptions::default(), None).unwrap(); card = card_mut.build(&ParserOptions::default(), None).unwrap();

View File

@@ -129,8 +129,7 @@ impl TextMatchElement {
} }
#[must_use] #[must_use]
pub fn match_property(&self, property: &ContentLine) -> bool { pub fn match_property(&self, property: &ContentLine) -> bool {
let text = property.value.as_deref().unwrap_or(""); self.match_text(&property.value)
self.match_text(text)
} }
} }

View File

@@ -17,7 +17,6 @@ derive_more.workspace = true
rustical_xml.workspace = true rustical_xml.workspace = true
caldata.workspace = true caldata.workspace = true
regex.workspace = true regex.workspace = true
rrule.workspace = true
serde.workspace = true serde.workspace = true
sha2.workspace = true sha2.workspace = true
axum.workspace = true axum.workspace = true

View File

@@ -13,7 +13,7 @@ use caldata::{
IcalUIDProperty, IcalVERSIONProperty, IcalVersion, VcardANNIVERSARYProperty, IcalUIDProperty, IcalVERSIONProperty, IcalVersion, VcardANNIVERSARYProperty,
VcardBDAYProperty, VcardFNProperty, VcardBDAYProperty, VcardFNProperty,
}, },
types::{CalDate, PartialDate, Timezone}, types::{CalDate, PartialDate, Tz},
}; };
use chrono::{NaiveDate, Utc}; use chrono::{NaiveDate, Utc};
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
@@ -73,7 +73,7 @@ impl AddressObject {
let Some(dtstart) = NaiveDate::from_ymd_opt(year.unwrap_or(1900), month, day) else { let Some(dtstart) = NaiveDate::from_ymd_opt(year.unwrap_or(1900), month, day) else {
return Ok(None); return Ok(None);
}; };
let start_date = CalDate(dtstart, Timezone::Local); let start_date = CalDate(dtstart, Tz::Local);
let Some(end_date) = start_date.succ_opt() else { let Some(end_date) = start_date.succ_opt() else {
// start_date is MAX_DATE, this should never happen but FAPP also not raise an error // start_date is MAX_DATE, this should never happen but FAPP also not raise an error
return Ok(None); return Ok(None);
@@ -90,14 +90,14 @@ impl AddressObject {
IcalDTENDProperty(end_date.into(), vec![].into()).into(), IcalDTENDProperty(end_date.into(), vec![].into()).into(),
IcalUIDProperty(uid, vec![].into()).into(), IcalUIDProperty(uid, vec![].into()).into(),
IcalRRULEProperty( IcalRRULEProperty(
rrule::RRule::from_str("FREQ=YEARLY").unwrap(), caldata::rrule::RRule::from_str("FREQ=YEARLY").unwrap(),
vec![].into(), vec![].into(),
) )
.into(), .into(),
IcalSUMMARYProperty(summary.clone(), vec![].into()).into(), IcalSUMMARYProperty(summary.clone(), vec![].into()).into(),
ContentLine { ContentLine {
name: "TRANSP".to_owned(), name: "TRANSP".to_owned(),
value: Some("TRANSPARENT".to_owned()), value: "TRANSPARENT".to_owned(),
..Default::default() ..Default::default()
}, },
], ],
@@ -105,17 +105,17 @@ impl AddressObject {
properties: vec![ properties: vec![
ContentLine { ContentLine {
name: "TRIGGER".to_owned(), name: "TRIGGER".to_owned(),
value: Some("-PT0M".to_owned()), value: "-PT0M".to_owned(),
params: vec![("VALUE".to_owned(), vec!["DURATION".to_owned()])].into(), params: vec![("VALUE".to_owned(), vec!["DURATION".to_owned()])].into(),
}, },
ContentLine { ContentLine {
name: "ACTION".to_owned(), name: "ACTION".to_owned(),
value: Some("DISPLAY".to_owned()), value: "DISPLAY".to_owned(),
..Default::default() ..Default::default()
}, },
ContentLine { ContentLine {
name: "DESCRIPTION".to_owned(), name: "DESCRIPTION".to_owned(),
value: Some(summary), value: summary,
..Default::default() ..Default::default()
}, },
], ],

View File

@@ -27,7 +27,6 @@ rustical_dav.workspace = true
rustical_ical.workspace = true rustical_ical.workspace = true
axum.workspace = true axum.workspace = true
http.workspace = true http.workspace = true
rrule.workspace = true
headers.workspace = true headers.workspace = true
tower.workspace = true tower.workspace = true
futures-core.workspace = true futures-core.workspace = true