mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 14:42:30 +00:00
Compare commits
37 Commits
v0.10.1
...
607db62859
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
607db62859 | ||
|
|
eba377b980 | ||
|
|
d5c1ddc590 | ||
|
|
a79e1901b8 | ||
|
|
f29c8fa925 | ||
|
|
54f1ee0788 | ||
|
|
96f221f721 | ||
|
|
ba3b64a9c4 | ||
|
|
22a0337375 | ||
|
|
21902e108a | ||
|
|
08f526fa5b | ||
|
|
ac73f3aaff | ||
|
|
9fdc8434db | ||
|
|
85f3d89235 | ||
|
|
092604694a | ||
|
|
8ef24668ba | ||
|
|
416658d069 | ||
|
|
80eae5db9e | ||
|
|
66f541f1c7 | ||
|
|
ea7196501e | ||
|
|
33d14a9ba0 | ||
|
|
d843909084 | ||
|
|
873b40ad10 | ||
|
|
5588137f73 | ||
|
|
7bf00da0e5 | ||
|
|
be08275cd3 | ||
|
|
3a10a695f5 | ||
|
|
53c6e3b1f4 | ||
|
|
6838e8e379 | ||
|
|
9f28aaec41 | ||
|
|
381af1b877 | ||
|
|
7ec62bc6ab | ||
|
|
425d10cb99 | ||
|
|
5cdbb3b9d3 | ||
|
|
547e477eca | ||
|
|
c19c3492c3 | ||
|
|
5878b93d62 |
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -17,6 +17,8 @@ jobs:
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- run: rustup update
|
||||
|
||||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up build cache
|
||||
|
||||
38
.sqlx/query-053c17f3b54ae3e153137926115486eb19a801bd73a74230bcf72a9a7254824a.json
generated
Normal file
38
.sqlx/query-053c17f3b54ae3e153137926115486eb19a801bd73a74230bcf72a9a7254824a.json
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n SELECT principal, cal_id, id, (deleted_at IS NOT NULL) AS \"deleted: bool\"\n FROM calendarobjects\n WHERE (principal, cal_id, id) NOT IN (\n SELECT DISTINCT principal, cal_id, object_id FROM calendarobjectchangelog\n )\n ;\n ",
|
||||
"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": "deleted: bool",
|
||||
"ordinal": 3,
|
||||
"type_info": "Integer"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "053c17f3b54ae3e153137926115486eb19a801bd73a74230bcf72a9a7254824a"
|
||||
}
|
||||
12
.sqlx/query-4a05eda4e23e8652312548b179a1cc16f43768074ab9e7ab7b7783395384984e.json
generated
Normal file
12
.sqlx/query-4a05eda4e23e8652312548b179a1cc16f43768074ab9e7ab7b7783395384984e.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "UPDATE birthday_calendars SET principal = ?, id = ?, displayname = ?, description = ?, \"order\" = ?, color = ?, timezone_id = ?, push_topic = ?\n WHERE (principal, id) = (?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 10
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "4a05eda4e23e8652312548b179a1cc16f43768074ab9e7ab7b7783395384984e"
|
||||
}
|
||||
74
.sqlx/query-525fc4eab8a0f3eacff7e3c78ce809943f817abf8c8f9ae50073924bccdea2dc.json
generated
Normal file
74
.sqlx/query-525fc4eab8a0f3eacff7e3c78ce809943f817abf8c8f9ae50073924bccdea2dc.json
generated
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "SELECT principal, id, displayname, description, \"order\", color, timezone_id, deleted_at, addr_synctoken, push_topic\n FROM birthday_calendars\n INNER JOIN (\n SELECT principal AS addr_principal,\n id AS addr_id,\n synctoken AS addr_synctoken\n FROM addressbooks\n ) ON (principal, id) = (addr_principal, addr_id)\n WHERE (principal, id) = (?, ?)\n AND ((deleted_at IS NULL) OR ?)\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "principal",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "displayname",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"ordinal": 4,
|
||||
"type_info": "Integer"
|
||||
},
|
||||
{
|
||||
"name": "color",
|
||||
"ordinal": 5,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "timezone_id",
|
||||
"ordinal": 6,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"ordinal": 7,
|
||||
"type_info": "Datetime"
|
||||
},
|
||||
{
|
||||
"name": "addr_synctoken",
|
||||
"ordinal": 8,
|
||||
"type_info": "Integer"
|
||||
},
|
||||
{
|
||||
"name": "push_topic",
|
||||
"ordinal": 9,
|
||||
"type_info": "Text"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "525fc4eab8a0f3eacff7e3c78ce809943f817abf8c8f9ae50073924bccdea2dc"
|
||||
}
|
||||
74
.sqlx/query-66d57f2c99ef37b383a478aff99110e1efbc7ce9332f10da4fa69f7594fb7455.json
generated
Normal file
74
.sqlx/query-66d57f2c99ef37b383a478aff99110e1efbc7ce9332f10da4fa69f7594fb7455.json
generated
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "SELECT principal, id, displayname, description, \"order\", color, timezone_id, deleted_at, addr_synctoken, push_topic\n FROM birthday_calendars\n INNER JOIN (\n SELECT principal AS addr_principal,\n id AS addr_id,\n synctoken AS addr_synctoken\n FROM addressbooks\n ) ON (principal, id) = (addr_principal, addr_id)\n WHERE principal = ?\n AND (\n (deleted_at IS NULL AND NOT ?) -- not deleted, want not deleted\n OR (deleted_at IS NOT NULL AND ?) -- deleted, want deleted\n )\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "principal",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "displayname",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"ordinal": 4,
|
||||
"type_info": "Integer"
|
||||
},
|
||||
{
|
||||
"name": "color",
|
||||
"ordinal": 5,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "timezone_id",
|
||||
"ordinal": 6,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"ordinal": 7,
|
||||
"type_info": "Datetime"
|
||||
},
|
||||
{
|
||||
"name": "addr_synctoken",
|
||||
"ordinal": 8,
|
||||
"type_info": "Integer"
|
||||
},
|
||||
{
|
||||
"name": "push_topic",
|
||||
"ordinal": 9,
|
||||
"type_info": "Text"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "66d57f2c99ef37b383a478aff99110e1efbc7ce9332f10da4fa69f7594fb7455"
|
||||
}
|
||||
12
.sqlx/query-6c039308ad2ec29570ab492d7a0e85fb79c0a4d3b882b74ff1c2786c12324896.json
generated
Normal file
12
.sqlx/query-6c039308ad2ec29570ab492d7a0e85fb79c0a4d3b882b74ff1c2786c12324896.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "UPDATE birthday_calendars SET deleted_at = NULL WHERE (principal, id) = (?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6c039308ad2ec29570ab492d7a0e85fb79c0a4d3b882b74ff1c2786c12324896"
|
||||
}
|
||||
12
.sqlx/query-83f0aaf406785e323ac12019ac24f603c53125a1b2326f324c1e2d7b6c690adc.json
generated
Normal file
12
.sqlx/query-83f0aaf406785e323ac12019ac24f603c53125a1b2326f324c1e2d7b6c690adc.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "UPDATE birthday_calendars SET deleted_at = datetime() WHERE (principal, id) = (?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "83f0aaf406785e323ac12019ac24f603c53125a1b2326f324c1e2d7b6c690adc"
|
||||
}
|
||||
12
.sqlx/query-bfdf662cd03e741b7a36f5e2ac01d32ac367c52ce41bd70394f754248b29749c.json
generated
Normal file
12
.sqlx/query-bfdf662cd03e741b7a36f5e2ac01d32ac367c52ce41bd70394f754248b29749c.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "INSERT INTO birthday_calendars (principal, id, displayname, push_topic)\n VALUES (?, ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "bfdf662cd03e741b7a36f5e2ac01d32ac367c52ce41bd70394f754248b29749c"
|
||||
}
|
||||
38
.sqlx/query-c138b1143ac04af4930266ffae0990e82005911c11a683ad565e92335e085f4d.json
generated
Normal file
38
.sqlx/query-c138b1143ac04af4930266ffae0990e82005911c11a683ad565e92335e085f4d.json
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n SELECT principal, addressbook_id, id, (deleted_at IS NOT NULL) AS \"deleted: bool\"\n FROM addressobjects\n WHERE (principal, addressbook_id, id) NOT IN (\n SELECT DISTINCT principal, addressbook_id, object_id FROM addressobjectchangelog\n )\n ;\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "principal",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "addressbook_id",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "deleted: bool",
|
||||
"ordinal": 3,
|
||||
"type_info": "Integer"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "c138b1143ac04af4930266ffae0990e82005911c11a683ad565e92335e085f4d"
|
||||
}
|
||||
12
.sqlx/query-cadc4ac16b7ac22b71c91ab36ad9dbb1dec943798d795fcbc811f4c651fea02a.json
generated
Normal file
12
.sqlx/query-cadc4ac16b7ac22b71c91ab36ad9dbb1dec943798d795fcbc811f4c651fea02a.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "DELETE FROM birthday_calendars WHERE (principal, id) = (?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "cadc4ac16b7ac22b71c91ab36ad9dbb1dec943798d795fcbc811f4c651fea02a"
|
||||
}
|
||||
459
Cargo.lock
generated
459
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
50
Cargo.toml
50
Cargo.toml
@@ -2,7 +2,8 @@
|
||||
members = ["crates/*"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.10.1"
|
||||
version = "0.10.5"
|
||||
rust-version = "1.91"
|
||||
edition = "2024"
|
||||
description = "A CalDAV server"
|
||||
documentation = "https://lennart-k.github.io/rustical/"
|
||||
@@ -12,6 +13,7 @@ license = "AGPL-3.0-or-later"
|
||||
[package]
|
||||
name = "rustical"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -35,6 +37,17 @@ opentelemetry = [
|
||||
debug = 0
|
||||
|
||||
[workspace.dependencies]
|
||||
rustical_dav = { path = "./crates/dav/" }
|
||||
rustical_dav_push = { path = "./crates/dav_push/" }
|
||||
rustical_store = { path = "./crates/store/" }
|
||||
rustical_store_sqlite = { path = "./crates/store_sqlite/" }
|
||||
rustical_caldav = { path = "./crates/caldav/" }
|
||||
rustical_carddav = { path = "./crates/carddav/" }
|
||||
rustical_frontend = { path = "./crates/frontend/" }
|
||||
rustical_xml = { path = "./crates/xml/" }
|
||||
rustical_oidc = { path = "./crates/oidc/" }
|
||||
rustical_ical = { path = "./crates/ical/" }
|
||||
|
||||
matchit = "0.9"
|
||||
uuid = { version = "1.11", features = ["v4", "fast-rng"] }
|
||||
async-trait = "0.1"
|
||||
@@ -108,16 +121,6 @@ tower-http = { version = "0.6", features = [
|
||||
"catch-panic",
|
||||
] }
|
||||
percent-encoding = "2.3"
|
||||
rustical_dav = { path = "./crates/dav/" }
|
||||
rustical_dav_push = { path = "./crates/dav_push/" }
|
||||
rustical_store = { path = "./crates/store/" }
|
||||
rustical_store_sqlite = { path = "./crates/store_sqlite/" }
|
||||
rustical_caldav = { path = "./crates/caldav/" }
|
||||
rustical_carddav = { path = "./crates/carddav/" }
|
||||
rustical_frontend = { path = "./crates/frontend/" }
|
||||
rustical_xml = { path = "./crates/xml/" }
|
||||
rustical_oidc = { path = "./crates/oidc/" }
|
||||
rustical_ical = { path = "./crates/ical/" }
|
||||
chrono-tz = "0.10"
|
||||
chrono-humanize = "0.2"
|
||||
rand = "0.9"
|
||||
@@ -130,7 +133,7 @@ syn = { version = "2.0", features = ["full"] }
|
||||
quote = "1.0"
|
||||
proc-macro2 = "1.0"
|
||||
heck = "0.5"
|
||||
darling = "0.21"
|
||||
darling = "0.23"
|
||||
reqwest = { version = "0.12", features = [
|
||||
"rustls-tls",
|
||||
"charset",
|
||||
@@ -145,21 +148,22 @@ ece = { version = "2.3", default-features = false, features = [
|
||||
] }
|
||||
openssl = { version = "0.10", features = ["vendored"] }
|
||||
async-std = { version = "1.13", features = ["attributes"] }
|
||||
similar-asserts = "1.7"
|
||||
|
||||
[dependencies]
|
||||
rustical_store = { workspace = true }
|
||||
rustical_store_sqlite = { workspace = true }
|
||||
rustical_caldav = { workspace = true }
|
||||
rustical_store.workspace = true
|
||||
rustical_store_sqlite.workspace = true
|
||||
rustical_caldav.workspace = true
|
||||
rustical_carddav.workspace = true
|
||||
rustical_frontend = { workspace = true }
|
||||
toml = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
rustical_frontend.workspace = true
|
||||
toml.workspace = true
|
||||
serde.workspace = true
|
||||
tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
anyhow.workspace = true
|
||||
clap.workspace = true
|
||||
sqlx = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
sqlx.workspace = true
|
||||
async-trait.workspace = true
|
||||
uuid.workspace = true
|
||||
axum.workspace = true
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_caldav"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -17,21 +18,21 @@ serde_json.workspace = true
|
||||
axum.workspace = true
|
||||
axum-extra.workspace = true
|
||||
tower.workspace = true
|
||||
async-trait = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
quick-xml = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
derive_more = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
url = { workspace = true }
|
||||
rustical_dav = { workspace = true }
|
||||
rustical_store = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
chrono-tz = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
async-trait.workspace = true
|
||||
thiserror.workspace = true
|
||||
quick-xml.workspace = true
|
||||
tracing.workspace = true
|
||||
futures-util.workspace = true
|
||||
derive_more.workspace = true
|
||||
base64.workspace = true
|
||||
serde.workspace = true
|
||||
tokio.workspace = true
|
||||
url.workspace = true
|
||||
rustical_dav.workspace = true
|
||||
rustical_store.workspace = true
|
||||
chrono.workspace = true
|
||||
chrono-tz.workspace = true
|
||||
sha2.workspace = true
|
||||
ical.workspace = true
|
||||
percent-encoding.workspace = true
|
||||
rustical_xml.workspace = true
|
||||
@@ -44,3 +45,4 @@ tower-http.workspace = true
|
||||
strum.workspace = true
|
||||
strum_macros.workspace = true
|
||||
vtimezones-rs.workspace = true
|
||||
similar-asserts.workspace = true
|
||||
|
||||
@@ -26,16 +26,18 @@ pub async fn get_objects_calendar_multiget<C: CalendarStore>(
|
||||
let mut not_found = vec![];
|
||||
|
||||
for href in &cal_query.href {
|
||||
if let Some(filename) = href.strip_prefix(path) {
|
||||
if let Ok(href) = percent_encoding::percent_decode_str(href).decode_utf8()
|
||||
&& let Some(filename) = href.strip_prefix(path)
|
||||
{
|
||||
let filename = filename.trim_start_matches('/');
|
||||
if let Some(object_id) = filename.strip_suffix(".ics") {
|
||||
match store.get_object(principal, cal_id, object_id, false).await {
|
||||
Ok(object) => result.push(object),
|
||||
Err(rustical_store::Error::NotFound) => not_found.push(href.to_owned()),
|
||||
Err(rustical_store::Error::NotFound) => not_found.push(href.to_string()),
|
||||
Err(err) => return Err(err.into()),
|
||||
}
|
||||
} else {
|
||||
not_found.push(href.to_owned());
|
||||
not_found.push(href.to_string());
|
||||
}
|
||||
} else {
|
||||
not_found.push(href.to_owned());
|
||||
|
||||
@@ -317,16 +317,11 @@ impl Resource for CalendarResource {
|
||||
}
|
||||
|
||||
fn get_user_privileges(&self, user: &Principal) -> Result<UserPrivilegeSet, Self::Error> {
|
||||
if self.cal.subscription_url.is_some() {
|
||||
if self.cal.subscription_url.is_some() || self.read_only {
|
||||
return Ok(UserPrivilegeSet::owner_write_properties(
|
||||
user.is_principal(&self.cal.principal),
|
||||
));
|
||||
}
|
||||
if self.read_only {
|
||||
return Ok(UserPrivilegeSet::owner_read(
|
||||
user.is_principal(&self.cal.principal),
|
||||
));
|
||||
}
|
||||
|
||||
Ok(UserPrivilegeSet::owner_only(
|
||||
user.is_principal(&self.cal.principal),
|
||||
|
||||
@@ -211,6 +211,9 @@ END:VCALENDAR
|
||||
<privilege>
|
||||
<read/>
|
||||
</privilege>
|
||||
<privilege>
|
||||
<write-properties/>
|
||||
</privilege>
|
||||
<privilege>
|
||||
<read-acl/>
|
||||
</privilege>
|
||||
|
||||
@@ -39,9 +39,7 @@ async fn test_propfind() {
|
||||
.unwrap()
|
||||
.trim()
|
||||
.replace("\r\n", "\n");
|
||||
println!("{output}");
|
||||
println!("{}, {} \n\n\n", output.len(), expected_output.len());
|
||||
assert_eq!(output, expected_output);
|
||||
similar_asserts::assert_eq!(expected_output, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_carddav"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -11,19 +12,19 @@ publish = false
|
||||
axum.workspace = true
|
||||
axum-extra.workspace = true
|
||||
tower.workspace = true
|
||||
async-trait = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
quick-xml = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
derive_more = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
url = { workspace = true }
|
||||
rustical_dav = { workspace = true }
|
||||
rustical_store = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
async-trait.workspace = true
|
||||
thiserror.workspace = true
|
||||
quick-xml.workspace = true
|
||||
tracing.workspace = true
|
||||
futures-util.workspace = true
|
||||
derive_more.workspace = true
|
||||
base64.workspace = true
|
||||
serde.workspace = true
|
||||
tokio.workspace = true
|
||||
url.workspace = true
|
||||
rustical_dav.workspace = true
|
||||
rustical_store.workspace = true
|
||||
chrono.workspace = true
|
||||
rustical_xml.workspace = true
|
||||
uuid.workspace = true
|
||||
rustical_dav_push.workspace = true
|
||||
|
||||
@@ -34,7 +34,9 @@ pub async fn get_objects_addressbook_multiget<AS: AddressbookStore>(
|
||||
let mut not_found = vec![];
|
||||
|
||||
for href in &addressbook_multiget.href {
|
||||
if let Some(filename) = href.strip_prefix(path) {
|
||||
if let Ok(href) = percent_encoding::percent_decode_str(href).decode_utf8()
|
||||
&& let Some(filename) = href.strip_prefix(path)
|
||||
{
|
||||
let filename = filename.trim_start_matches('/');
|
||||
if let Some(object_id) = filename.strip_suffix(".vcf") {
|
||||
match store
|
||||
@@ -42,11 +44,11 @@ pub async fn get_objects_addressbook_multiget<AS: AddressbookStore>(
|
||||
.await
|
||||
{
|
||||
Ok(object) => result.push(object),
|
||||
Err(rustical_store::Error::NotFound) => not_found.push(href.to_owned()),
|
||||
Err(rustical_store::Error::NotFound) => not_found.push(href.to_string()),
|
||||
Err(err) => return Err(err.into()),
|
||||
}
|
||||
} else {
|
||||
not_found.push(href.to_owned());
|
||||
not_found.push(href.to_string());
|
||||
}
|
||||
} else {
|
||||
not_found.push(href.to_owned());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_dav"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_dav_push"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -9,15 +10,15 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
rustical_xml.workspace = true
|
||||
async-trait = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
quick-xml = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
log = { workspace = true }
|
||||
derive_more = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
async-trait.workspace = true
|
||||
futures-util.workspace = true
|
||||
quick-xml.workspace = true
|
||||
serde.workspace = true
|
||||
thiserror.workspace = true
|
||||
itertools.workspace = true
|
||||
log.workspace = true
|
||||
derive_more.workspace = true
|
||||
tracing.workspace = true
|
||||
reqwest.workspace = true
|
||||
tokio.workspace = true
|
||||
rustical_dav.workspace = true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_frontend"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
"imports": {
|
||||
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.5",
|
||||
"lit": "npm:lit@^3.3.1",
|
||||
"vite": "npm:vite@^7.1.7"
|
||||
"vite": "npm:vite@^7.1.12"
|
||||
}
|
||||
}
|
||||
|
||||
214
crates/frontend/js-components/deno.lock
generated
214
crates/frontend/js-components/deno.lock
generated
@@ -1,145 +1,145 @@
|
||||
{
|
||||
"version": "5",
|
||||
"specifiers": {
|
||||
"npm:@deno/vite-plugin@^1.0.5": "1.0.5_vite@7.1.7__picomatch@4.0.3",
|
||||
"npm:@deno/vite-plugin@^1.0.5": "1.0.5_vite@7.1.12__picomatch@4.0.3",
|
||||
"npm:lit@^3.3.1": "3.3.1",
|
||||
"npm:vite@*": "7.1.7_picomatch@4.0.3",
|
||||
"npm:vite@^7.1.7": "7.1.7_picomatch@4.0.3"
|
||||
"npm:vite@*": "7.1.12_picomatch@4.0.3",
|
||||
"npm:vite@^7.1.12": "7.1.12_picomatch@4.0.3"
|
||||
},
|
||||
"npm": {
|
||||
"@deno/vite-plugin@1.0.5_vite@7.1.7__picomatch@4.0.3": {
|
||||
"@deno/vite-plugin@1.0.5_vite@7.1.12__picomatch@4.0.3": {
|
||||
"integrity": "sha512-tLja5n4dyMhcze1NzvSs2iiriBymfBlDCZIrjMTxb9O2ru0gvmV6mn5oBD2teNw5Sd92cj3YJzKwsAs8tMJXlg==",
|
||||
"dependencies": [
|
||||
"vite"
|
||||
]
|
||||
},
|
||||
"@esbuild/aix-ppc64@0.25.10": {
|
||||
"integrity": "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==",
|
||||
"@esbuild/aix-ppc64@0.25.12": {
|
||||
"integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
|
||||
"os": ["aix"],
|
||||
"cpu": ["ppc64"]
|
||||
},
|
||||
"@esbuild/android-arm64@0.25.10": {
|
||||
"integrity": "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg==",
|
||||
"@esbuild/android-arm64@0.25.12": {
|
||||
"integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
|
||||
"os": ["android"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/android-arm@0.25.10": {
|
||||
"integrity": "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w==",
|
||||
"@esbuild/android-arm@0.25.12": {
|
||||
"integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
|
||||
"os": ["android"],
|
||||
"cpu": ["arm"]
|
||||
},
|
||||
"@esbuild/android-x64@0.25.10": {
|
||||
"integrity": "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg==",
|
||||
"@esbuild/android-x64@0.25.12": {
|
||||
"integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
|
||||
"os": ["android"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/darwin-arm64@0.25.10": {
|
||||
"integrity": "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA==",
|
||||
"@esbuild/darwin-arm64@0.25.12": {
|
||||
"integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
|
||||
"os": ["darwin"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/darwin-x64@0.25.10": {
|
||||
"integrity": "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg==",
|
||||
"@esbuild/darwin-x64@0.25.12": {
|
||||
"integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
|
||||
"os": ["darwin"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/freebsd-arm64@0.25.10": {
|
||||
"integrity": "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg==",
|
||||
"@esbuild/freebsd-arm64@0.25.12": {
|
||||
"integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
|
||||
"os": ["freebsd"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/freebsd-x64@0.25.10": {
|
||||
"integrity": "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA==",
|
||||
"@esbuild/freebsd-x64@0.25.12": {
|
||||
"integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
|
||||
"os": ["freebsd"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/linux-arm64@0.25.10": {
|
||||
"integrity": "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ==",
|
||||
"@esbuild/linux-arm64@0.25.12": {
|
||||
"integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/linux-arm@0.25.10": {
|
||||
"integrity": "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg==",
|
||||
"@esbuild/linux-arm@0.25.12": {
|
||||
"integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm"]
|
||||
},
|
||||
"@esbuild/linux-ia32@0.25.10": {
|
||||
"integrity": "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ==",
|
||||
"@esbuild/linux-ia32@0.25.12": {
|
||||
"integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["ia32"]
|
||||
},
|
||||
"@esbuild/linux-loong64@0.25.10": {
|
||||
"integrity": "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg==",
|
||||
"@esbuild/linux-loong64@0.25.12": {
|
||||
"integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["loong64"]
|
||||
},
|
||||
"@esbuild/linux-mips64el@0.25.10": {
|
||||
"integrity": "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA==",
|
||||
"@esbuild/linux-mips64el@0.25.12": {
|
||||
"integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["mips64el"]
|
||||
},
|
||||
"@esbuild/linux-ppc64@0.25.10": {
|
||||
"integrity": "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA==",
|
||||
"@esbuild/linux-ppc64@0.25.12": {
|
||||
"integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["ppc64"]
|
||||
},
|
||||
"@esbuild/linux-riscv64@0.25.10": {
|
||||
"integrity": "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA==",
|
||||
"@esbuild/linux-riscv64@0.25.12": {
|
||||
"integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["riscv64"]
|
||||
},
|
||||
"@esbuild/linux-s390x@0.25.10": {
|
||||
"integrity": "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew==",
|
||||
"@esbuild/linux-s390x@0.25.12": {
|
||||
"integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["s390x"]
|
||||
},
|
||||
"@esbuild/linux-x64@0.25.10": {
|
||||
"integrity": "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA==",
|
||||
"@esbuild/linux-x64@0.25.12": {
|
||||
"integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/netbsd-arm64@0.25.10": {
|
||||
"integrity": "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A==",
|
||||
"@esbuild/netbsd-arm64@0.25.12": {
|
||||
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
|
||||
"os": ["netbsd"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/netbsd-x64@0.25.10": {
|
||||
"integrity": "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig==",
|
||||
"@esbuild/netbsd-x64@0.25.12": {
|
||||
"integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
|
||||
"os": ["netbsd"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/openbsd-arm64@0.25.10": {
|
||||
"integrity": "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw==",
|
||||
"@esbuild/openbsd-arm64@0.25.12": {
|
||||
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
|
||||
"os": ["openbsd"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/openbsd-x64@0.25.10": {
|
||||
"integrity": "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw==",
|
||||
"@esbuild/openbsd-x64@0.25.12": {
|
||||
"integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
|
||||
"os": ["openbsd"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/openharmony-arm64@0.25.10": {
|
||||
"integrity": "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag==",
|
||||
"@esbuild/openharmony-arm64@0.25.12": {
|
||||
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
|
||||
"os": ["openharmony"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/sunos-x64@0.25.10": {
|
||||
"integrity": "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ==",
|
||||
"@esbuild/sunos-x64@0.25.12": {
|
||||
"integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
|
||||
"os": ["sunos"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@esbuild/win32-arm64@0.25.10": {
|
||||
"integrity": "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw==",
|
||||
"@esbuild/win32-arm64@0.25.12": {
|
||||
"integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@esbuild/win32-ia32@0.25.10": {
|
||||
"integrity": "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw==",
|
||||
"@esbuild/win32-ia32@0.25.12": {
|
||||
"integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["ia32"]
|
||||
},
|
||||
"@esbuild/win32-x64@0.25.10": {
|
||||
"integrity": "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw==",
|
||||
"@esbuild/win32-x64@0.25.12": {
|
||||
"integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
@@ -152,113 +152,113 @@
|
||||
"@lit-labs/ssr-dom-shim"
|
||||
]
|
||||
},
|
||||
"@rollup/rollup-android-arm-eabi@4.52.2": {
|
||||
"integrity": "sha512-o3pcKzJgSGt4d74lSZ+OCnHwkKBeAbFDmbEm5gg70eA8VkyCuC/zV9TwBnmw6VjDlRdF4Pshfb+WE9E6XY1PoQ==",
|
||||
"@rollup/rollup-android-arm-eabi@4.52.5": {
|
||||
"integrity": "sha512-8c1vW4ocv3UOMp9K+gToY5zL2XiiVw3k7f1ksf4yO1FlDFQ1C2u72iACFnSOceJFsWskc2WZNqeRhFRPzv+wtQ==",
|
||||
"os": ["android"],
|
||||
"cpu": ["arm"]
|
||||
},
|
||||
"@rollup/rollup-android-arm64@4.52.2": {
|
||||
"integrity": "sha512-cqFSWO5tX2vhC9hJTK8WAiPIm4Q8q/cU8j2HQA0L3E1uXvBYbOZMhE2oFL8n2pKB5sOCHY6bBuHaRwG7TkfJyw==",
|
||||
"@rollup/rollup-android-arm64@4.52.5": {
|
||||
"integrity": "sha512-mQGfsIEFcu21mvqkEKKu2dYmtuSZOBMmAl5CFlPGLY94Vlcm+zWApK7F/eocsNzp8tKmbeBP8yXyAbx0XHsFNA==",
|
||||
"os": ["android"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-darwin-arm64@4.52.2": {
|
||||
"integrity": "sha512-vngduywkkv8Fkh3wIZf5nFPXzWsNsVu1kvtLETWxTFf/5opZmflgVSeLgdHR56RQh71xhPhWoOkEBvbehwTlVA==",
|
||||
"@rollup/rollup-darwin-arm64@4.52.5": {
|
||||
"integrity": "sha512-takF3CR71mCAGA+v794QUZ0b6ZSrgJkArC+gUiG6LB6TQty9T0Mqh3m2ImRBOxS2IeYBo4lKWIieSvnEk2OQWA==",
|
||||
"os": ["darwin"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-darwin-x64@4.52.2": {
|
||||
"integrity": "sha512-h11KikYrUCYTrDj6h939hhMNlqU2fo/X4NB0OZcys3fya49o1hmFaczAiJWVAFgrM1NCP6RrO7lQKeVYSKBPSQ==",
|
||||
"@rollup/rollup-darwin-x64@4.52.5": {
|
||||
"integrity": "sha512-W901Pla8Ya95WpxDn//VF9K9u2JbocwV/v75TE0YIHNTbhqUTv9w4VuQ9MaWlNOkkEfFwkdNhXgcLqPSmHy0fA==",
|
||||
"os": ["darwin"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@rollup/rollup-freebsd-arm64@4.52.2": {
|
||||
"integrity": "sha512-/eg4CI61ZUkLXxMHyVlmlGrSQZ34xqWlZNW43IAU4RmdzWEx0mQJ2mN/Cx4IHLVZFL6UBGAh+/GXhgvGb+nVxw==",
|
||||
"@rollup/rollup-freebsd-arm64@4.52.5": {
|
||||
"integrity": "sha512-QofO7i7JycsYOWxe0GFqhLmF6l1TqBswJMvICnRUjqCx8b47MTo46W8AoeQwiokAx3zVryVnxtBMcGcnX12LvA==",
|
||||
"os": ["freebsd"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-freebsd-x64@4.52.2": {
|
||||
"integrity": "sha512-QOWgFH5X9+p+S1NAfOqc0z8qEpJIoUHf7OWjNUGOeW18Mx22lAUOiA9b6r2/vpzLdfxi/f+VWsYjUOMCcYh0Ng==",
|
||||
"@rollup/rollup-freebsd-x64@4.52.5": {
|
||||
"integrity": "sha512-jr21b/99ew8ujZubPo9skbrItHEIE50WdV86cdSoRkKtmWa+DDr6fu2c/xyRT0F/WazZpam6kk7IHBerSL7LDQ==",
|
||||
"os": ["freebsd"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@rollup/rollup-linux-arm-gnueabihf@4.52.2": {
|
||||
"integrity": "sha512-kDWSPafToDd8LcBYd1t5jw7bD5Ojcu12S3uT372e5HKPzQt532vW+rGFFOaiR0opxePyUkHrwz8iWYEyH1IIQA==",
|
||||
"@rollup/rollup-linux-arm-gnueabihf@4.52.5": {
|
||||
"integrity": "sha512-PsNAbcyv9CcecAUagQefwX8fQn9LQ4nZkpDboBOttmyffnInRy8R8dSg6hxxl2Re5QhHBf6FYIDhIj5v982ATQ==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm"]
|
||||
},
|
||||
"@rollup/rollup-linux-arm-musleabihf@4.52.2": {
|
||||
"integrity": "sha512-gKm7Mk9wCv6/rkzwCiUC4KnevYhlf8ztBrDRT9g/u//1fZLapSRc+eDZj2Eu2wpJ+0RzUKgtNijnVIB4ZxyL+w==",
|
||||
"@rollup/rollup-linux-arm-musleabihf@4.52.5": {
|
||||
"integrity": "sha512-Fw4tysRutyQc/wwkmcyoqFtJhh0u31K+Q6jYjeicsGJJ7bbEq8LwPWV/w0cnzOqR2m694/Af6hpFayLJZkG2VQ==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm"]
|
||||
},
|
||||
"@rollup/rollup-linux-arm64-gnu@4.52.2": {
|
||||
"integrity": "sha512-66lA8vnj5mB/rtDNwPgrrKUOtCLVQypkyDa2gMfOefXK6rcZAxKLO9Fy3GkW8VkPnENv9hBkNOFfGLf6rNKGUg==",
|
||||
"@rollup/rollup-linux-arm64-gnu@4.52.5": {
|
||||
"integrity": "sha512-a+3wVnAYdQClOTlyapKmyI6BLPAFYs0JM8HRpgYZQO02rMR09ZcV9LbQB+NL6sljzG38869YqThrRnfPMCDtZg==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-linux-arm64-musl@4.52.2": {
|
||||
"integrity": "sha512-s+OPucLNdJHvuZHuIz2WwncJ+SfWHFEmlC5nKMUgAelUeBUnlB4wt7rXWiyG4Zn07uY2Dd+SGyVa9oyLkVGOjA==",
|
||||
"@rollup/rollup-linux-arm64-musl@4.52.5": {
|
||||
"integrity": "sha512-AvttBOMwO9Pcuuf7m9PkC1PUIKsfaAJ4AYhy944qeTJgQOqJYJ9oVl2nYgY7Rk0mkbsuOpCAYSs6wLYB2Xiw0Q==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-linux-loong64-gnu@4.52.2": {
|
||||
"integrity": "sha512-8wTRM3+gVMDLLDdaT6tKmOE3lJyRy9NpJUS/ZRWmLCmOPIJhVyXwjBo+XbrrwtV33Em1/eCTd5TuGJm4+DmYjw==",
|
||||
"@rollup/rollup-linux-loong64-gnu@4.52.5": {
|
||||
"integrity": "sha512-DkDk8pmXQV2wVrF6oq5tONK6UHLz/XcEVow4JTTerdeV1uqPeHxwcg7aFsfnSm9L+OO8WJsWotKM2JJPMWrQtA==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["loong64"]
|
||||
},
|
||||
"@rollup/rollup-linux-ppc64-gnu@4.52.2": {
|
||||
"integrity": "sha512-6yqEfgJ1anIeuP2P/zhtfBlDpXUb80t8DpbYwXQ3bQd95JMvUaqiX+fKqYqUwZXqdJDd8xdilNtsHM2N0cFm6A==",
|
||||
"@rollup/rollup-linux-ppc64-gnu@4.52.5": {
|
||||
"integrity": "sha512-W/b9ZN/U9+hPQVvlGwjzi+Wy4xdoH2I8EjaCkMvzpI7wJUs8sWJ03Rq96jRnHkSrcHTpQe8h5Tg3ZzUPGauvAw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["ppc64"]
|
||||
},
|
||||
"@rollup/rollup-linux-riscv64-gnu@4.52.2": {
|
||||
"integrity": "sha512-sshYUiYVSEI2B6dp4jMncwxbrUqRdNApF2c3bhtLAU0qA8Lrri0p0NauOsTWh3yCCCDyBOjESHMExonp7Nzc0w==",
|
||||
"@rollup/rollup-linux-riscv64-gnu@4.52.5": {
|
||||
"integrity": "sha512-sjQLr9BW7R/ZiXnQiWPkErNfLMkkWIoCz7YMn27HldKsADEKa5WYdobaa1hmN6slu9oWQbB6/jFpJ+P2IkVrmw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["riscv64"]
|
||||
},
|
||||
"@rollup/rollup-linux-riscv64-musl@4.52.2": {
|
||||
"integrity": "sha512-duBLgd+3pqC4MMwBrKkFxaZerUxZcYApQVC5SdbF5/e/589GwVvlRUnyqMFbM8iUSb1BaoX/3fRL7hB9m2Pj8Q==",
|
||||
"@rollup/rollup-linux-riscv64-musl@4.52.5": {
|
||||
"integrity": "sha512-hq3jU/kGyjXWTvAh2awn8oHroCbrPm8JqM7RUpKjalIRWWXE01CQOf/tUNWNHjmbMHg/hmNCwc/Pz3k1T/j/Lg==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["riscv64"]
|
||||
},
|
||||
"@rollup/rollup-linux-s390x-gnu@4.52.2": {
|
||||
"integrity": "sha512-tzhYJJidDUVGMgVyE+PmxENPHlvvqm1KILjjZhB8/xHYqAGeizh3GBGf9u6WdJpZrz1aCpIIHG0LgJgH9rVjHQ==",
|
||||
"@rollup/rollup-linux-s390x-gnu@4.52.5": {
|
||||
"integrity": "sha512-gn8kHOrku8D4NGHMK1Y7NA7INQTRdVOntt1OCYypZPRt6skGbddska44K8iocdpxHTMMNui5oH4elPH4QOLrFQ==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["s390x"]
|
||||
},
|
||||
"@rollup/rollup-linux-x64-gnu@4.52.2": {
|
||||
"integrity": "sha512-opH8GSUuVcCSSyHHcl5hELrmnk4waZoVpgn/4FDao9iyE4WpQhyWJ5ryl5M3ocp4qkRuHfyXnGqg8M9oKCEKRA==",
|
||||
"@rollup/rollup-linux-x64-gnu@4.52.5": {
|
||||
"integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@rollup/rollup-linux-x64-musl@4.52.2": {
|
||||
"integrity": "sha512-LSeBHnGli1pPKVJ79ZVJgeZWWZXkEe/5o8kcn23M8eMKCUANejchJbF/JqzM4RRjOJfNRhKJk8FuqL1GKjF5oQ==",
|
||||
"@rollup/rollup-linux-x64-musl@4.52.5": {
|
||||
"integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@rollup/rollup-openharmony-arm64@4.52.2": {
|
||||
"integrity": "sha512-uPj7MQ6/s+/GOpolavm6BPo+6CbhbKYyZHUDvZ/SmJM7pfDBgdGisFX3bY/CBDMg2ZO4utfhlApkSfZ92yXw7Q==",
|
||||
"@rollup/rollup-openharmony-arm64@4.52.5": {
|
||||
"integrity": "sha512-QoFqB6+/9Rly/RiPjaomPLmR/13cgkIGfA40LHly9zcH1S0bN2HVFYk3a1eAyHQyjs3ZJYlXvIGtcCs5tko9Cw==",
|
||||
"os": ["openharmony"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-win32-arm64-msvc@4.52.2": {
|
||||
"integrity": "sha512-Z9MUCrSgIaUeeHAiNkm3cQyst2UhzjPraR3gYYfOjAuZI7tcFRTOD+4cHLPoS/3qinchth+V56vtqz1Tv+6KPA==",
|
||||
"@rollup/rollup-win32-arm64-msvc@4.52.5": {
|
||||
"integrity": "sha512-w0cDWVR6MlTstla1cIfOGyl8+qb93FlAVutcor14Gf5Md5ap5ySfQ7R9S/NjNaMLSFdUnKGEasmVnu3lCMqB7w==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@rollup/rollup-win32-ia32-msvc@4.52.2": {
|
||||
"integrity": "sha512-+GnYBmpjldD3XQd+HMejo+0gJGwYIOfFeoBQv32xF/RUIvccUz20/V6Otdv+57NE70D5pa8W/jVGDoGq0oON4A==",
|
||||
"@rollup/rollup-win32-ia32-msvc@4.52.5": {
|
||||
"integrity": "sha512-Aufdpzp7DpOTULJCuvzqcItSGDH73pF3ko/f+ckJhxQyHtp67rHw3HMNxoIdDMUITJESNE6a8uh4Lo4SLouOUg==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["ia32"]
|
||||
},
|
||||
"@rollup/rollup-win32-x64-gnu@4.52.2": {
|
||||
"integrity": "sha512-ApXFKluSB6kDQkAqZOKXBjiaqdF1BlKi+/eqnYe9Ee7U2K3pUDKsIyr8EYm/QDHTJIM+4X+lI0gJc3TTRhd+dA==",
|
||||
"@rollup/rollup-win32-x64-gnu@4.52.5": {
|
||||
"integrity": "sha512-UGBUGPFp1vkj6p8wCRraqNhqwX/4kNQPS57BCFc8wYh0g94iVIW33wJtQAx3G7vrjjNtRaxiMUylM0ktp/TRSQ==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@rollup/rollup-win32-x64-msvc@4.52.2": {
|
||||
"integrity": "sha512-ARz+Bs8kY6FtitYM96PqPEVvPXqEZmPZsSkXvyX19YzDqkCaIlhCieLLMI5hxO9SRZ2XtCtm8wxhy0iJ2jxNfw==",
|
||||
"@rollup/rollup-win32-x64-msvc@4.52.5": {
|
||||
"integrity": "sha512-TAcgQh2sSkykPRWLrdyy2AiceMckNf5loITqXxFI5VuQjS5tSuw3WlwdN8qv8vzjLAUTvYaH/mVjSFpbkFbpTg==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
@@ -268,8 +268,8 @@
|
||||
"@types/trusted-types@2.0.7": {
|
||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="
|
||||
},
|
||||
"esbuild@0.25.10": {
|
||||
"integrity": "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==",
|
||||
"esbuild@0.25.12": {
|
||||
"integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
|
||||
"optionalDependencies": [
|
||||
"@esbuild/aix-ppc64",
|
||||
"@esbuild/android-arm",
|
||||
@@ -355,8 +355,8 @@
|
||||
"source-map-js"
|
||||
]
|
||||
},
|
||||
"rollup@4.52.2": {
|
||||
"integrity": "sha512-I25/2QgoROE1vYV+NQ1En9T9UFB9Cmfm2CJ83zZOlaDpvz29wGQSZXWKw7MiNXau7wYgB/T9fVIdIuEQ+KbiiA==",
|
||||
"rollup@4.52.5": {
|
||||
"integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==",
|
||||
"dependencies": [
|
||||
"@types/estree"
|
||||
],
|
||||
@@ -397,8 +397,8 @@
|
||||
"picomatch"
|
||||
]
|
||||
},
|
||||
"vite@7.1.7_picomatch@4.0.3": {
|
||||
"integrity": "sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA==",
|
||||
"vite@7.1.12_picomatch@4.0.3": {
|
||||
"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==",
|
||||
"dependencies": [
|
||||
"esbuild",
|
||||
"fdir",
|
||||
@@ -417,7 +417,7 @@
|
||||
"dependencies": [
|
||||
"npm:@deno/vite-plugin@^1.0.5",
|
||||
"npm:lit@^3.3.1",
|
||||
"npm:vite@^7.1.7"
|
||||
"npm:vite@^7.1.12"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { Ref, createRef, ref } from 'lit/directives/ref.js';
|
||||
import { escapeXml } from ".";
|
||||
import { getTimezones } from "./timezones.ts";
|
||||
|
||||
@customElement("create-calendar-form")
|
||||
export class CreateCalendarForm extends LitElement {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { i, x } from "./lit-DkXrt_Iv.mjs";
|
||||
import { n as n$1, t } from "./property-B8WoKf1Y.mjs";
|
||||
import { e, n } from "./ref-BwbQvJBB.mjs";
|
||||
import { e as escapeXml } from "./index-_IB1wMbZ.mjs";
|
||||
import { g as getTimezones } from "./timezones-B0vBBzCP.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
|
||||
@@ -2,18 +2,7 @@ import { i, x } from "./lit-DkXrt_Iv.mjs";
|
||||
import { n as n$1, t } from "./property-B8WoKf1Y.mjs";
|
||||
import { e, n } from "./ref-BwbQvJBB.mjs";
|
||||
import { e as escapeXml } from "./index-_IB1wMbZ.mjs";
|
||||
let timezonesPromise = null;
|
||||
async function getTimezones() {
|
||||
timezonesPromise ||= new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
let response = await fetch("/frontend/_timezones.json");
|
||||
resolve(await response.json());
|
||||
} catch (e2) {
|
||||
reject(e2);
|
||||
}
|
||||
});
|
||||
return await timezonesPromise;
|
||||
}
|
||||
import { g as getTimezones } from "./timezones-B0vBBzCP.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
|
||||
15
crates/frontend/public/assets/js/timezones-B0vBBzCP.mjs
Normal file
15
crates/frontend/public/assets/js/timezones-B0vBBzCP.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
let timezonesPromise = null;
|
||||
async function getTimezones() {
|
||||
timezonesPromise ||= new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
let response = await fetch("/frontend/_timezones.json");
|
||||
resolve(await response.json());
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
return await timezonesPromise;
|
||||
}
|
||||
export {
|
||||
getTimezones as g
|
||||
};
|
||||
@@ -79,9 +79,6 @@ header {
|
||||
nav {
|
||||
display: flex;
|
||||
|
||||
border-radius: 12px;
|
||||
background: color-mix(in srgb, var(--background-darker), var(--dilute-color) 5%);
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
margin: 4px 8px;
|
||||
@@ -259,19 +256,6 @@ ul.collection-list {
|
||||
margin: 8px initial;
|
||||
}
|
||||
|
||||
.comps {
|
||||
display: inline;
|
||||
|
||||
span {
|
||||
margin: 0 2px;
|
||||
background: var(--primary-color);
|
||||
color: var(--text-on-primary-color);
|
||||
font-size: .8em;
|
||||
padding: 3px 8px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.description {
|
||||
grid-area: description;
|
||||
white-space: nowrap;
|
||||
@@ -298,6 +282,7 @@ ul.collection-list {
|
||||
grid-area: actions;
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
@@ -363,3 +348,16 @@ svg.icon {
|
||||
color: var(--text-on-background-color);
|
||||
stroke: var(--text-on-background-color);
|
||||
}
|
||||
|
||||
.component-chips {
|
||||
display: inline;
|
||||
|
||||
span.chip {
|
||||
margin: 0 2px;
|
||||
background: var(--primary-color);
|
||||
color: var(--text-on-primary-color);
|
||||
font-size: .8em;
|
||||
padding: 3px 8px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<span class="title">
|
||||
{%- if calendar.principal != user.id -%}{{ calendar.principal }}/{%- endif -%}
|
||||
{{ calendar.meta.displayname.to_owned().unwrap_or(calendar.id.to_owned()) }}
|
||||
<div class="comps">
|
||||
<div class="component-chips">
|
||||
{% for comp in calendar.components %}
|
||||
<span>{{ comp }}</span>
|
||||
<span class="chip">{{ comp }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</span>
|
||||
@@ -24,7 +24,6 @@
|
||||
<form action="/caldav/principal/{{ calendar.principal }}/{{ calendar.id }}" target="_blank" method="GET">
|
||||
<button type="submit">Download</button>
|
||||
</form>
|
||||
{% if !calendar.id.starts_with("_birthdays_") %}
|
||||
<edit-calendar-form
|
||||
principal="{{ calendar.principal }}"
|
||||
cal_id="{{ calendar.id }}"
|
||||
@@ -35,7 +34,6 @@
|
||||
components="{{ calendar.components | json }}"
|
||||
></edit-calendar-form>
|
||||
<delete-button trash href="/caldav/principal/{{ calendar.principal }}/{{ calendar.id }}"></delete-button>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="metadata">
|
||||
{{ meta.len }} ({{ meta.size | filesizeformat }}) objects, {{ meta.deleted_len }} ({{ meta.deleted_size | filesizeformat }}) deleted objects
|
||||
@@ -58,9 +56,9 @@
|
||||
<span class="title">
|
||||
{%- if calendar.principal != user.id -%}{{ calendar.principal }}/{%- endif -%}
|
||||
{{ calendar.meta.displayname.to_owned().unwrap_or(calendar.id.to_owned()) }}
|
||||
<div class="comps">
|
||||
<div class="component-chips">
|
||||
{% for comp in calendar.components %}
|
||||
<span>{{ comp }}</span>
|
||||
<span class="chip">{{ comp }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
<header>
|
||||
<a class="logo" href="/frontend/user">RustiCal</a>
|
||||
{% block header_center %}{% endblock %}
|
||||
<form method="POST" action="/frontend/logout" class="logout_form">
|
||||
<button type="submit">Log out</button>
|
||||
</form>
|
||||
{% if self.get_user().is_some() %}
|
||||
<form method="POST" action="/frontend/logout" class="logout_form">
|
||||
<button type="submit">Log out</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</header>
|
||||
{% endblock %}
|
||||
<div id="app">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<h1>{{ name }}</h1>
|
||||
{% if let Some(description) = addressbook.description %}<p>{{ description }}</p>{% endif%}
|
||||
|
||||
<pre>{{ addressbook|json }}</pre>
|
||||
<h2>Debug information</h2>
|
||||
<pre>{{ addressbook|json(2) }}</pre>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -5,7 +5,15 @@
|
||||
|
||||
{% block content %}
|
||||
{% let name = calendar.meta.displayname.to_owned().unwrap_or(calendar.id.to_owned()) %}
|
||||
<h1>{{ calendar.principal }}/{{ name }}</h1>
|
||||
<h1>
|
||||
{{ calendar.principal }}/{{ name }}
|
||||
<div class="component-chips">
|
||||
{% for comp in calendar.components %}
|
||||
<span class="chip">{{ comp }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</h1>
|
||||
{% if let Some(description) = calendar.meta.description %}<p>{{ description }}</p>{% endif%}
|
||||
|
||||
{% if let Some(subscription_url) = calendar.subscription_url %}
|
||||
@@ -13,19 +21,7 @@
|
||||
<a href="{{ subscription_url }}">{{ subscription_url }}</a>
|
||||
{% endif %}
|
||||
|
||||
<h2>Components</h2>
|
||||
<ul>
|
||||
{% for comp in calendar.components %}
|
||||
<li>{{ comp.as_str() }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h2>Timezone</h2>
|
||||
|
||||
{% if let Some(timezone_id) = calendar.timezone_id %}
|
||||
<p>{{ timezone_id }}</p>
|
||||
{% endif %}
|
||||
|
||||
<pre>{{ calendar|json }}</pre>
|
||||
<h2>Debug information</h2>
|
||||
<pre>{{ calendar|json(2) }}</pre>
|
||||
|
||||
{%endblock %}
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::{
|
||||
NextcloudFlow, NextcloudFlows, NextcloudLoginPoll, NextcloudLoginResponse,
|
||||
NextcloudSuccessResponse,
|
||||
};
|
||||
use crate::routes::app_token::generate_app_token;
|
||||
use crate::{pages::DefaultLayoutData, routes::app_token::generate_app_token};
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
Extension, Form, Json,
|
||||
@@ -100,6 +100,12 @@ struct NextcloudLoginPage {
|
||||
app_name: String,
|
||||
}
|
||||
|
||||
impl DefaultLayoutData for NextcloudLoginPage {
|
||||
fn get_user(&self) -> Option<&Principal> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip(state))]
|
||||
pub async fn get_nextcloud_flow(
|
||||
Extension(state): Extension<Arc<NextcloudFlows>>,
|
||||
@@ -130,6 +136,13 @@ pub struct NextcloudAuthorizeForm {
|
||||
#[template(path = "pages/nextcloud_login/success.html")]
|
||||
struct NextcloudLoginSuccessPage {
|
||||
app_name: String,
|
||||
user: Principal,
|
||||
}
|
||||
|
||||
impl DefaultLayoutData for NextcloudLoginSuccessPage {
|
||||
fn get_user(&self) -> Option<&Principal> {
|
||||
Some(&self.user)
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip(state))]
|
||||
@@ -150,6 +163,7 @@ pub async fn post_nextcloud_flow(
|
||||
Ok(Html(
|
||||
NextcloudLoginSuccessPage {
|
||||
app_name: flow.app_name.clone(),
|
||||
user,
|
||||
}
|
||||
.render()
|
||||
.unwrap(),
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
use rustical_store::auth::Principal;
|
||||
|
||||
pub mod user;
|
||||
|
||||
/// Required by the base layout
|
||||
pub trait DefaultLayoutData {
|
||||
fn get_user(&self) -> Option<&Principal>;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ use askama::Template;
|
||||
use askama_web::WebTemplate;
|
||||
use rustical_store::auth::Principal;
|
||||
|
||||
use crate::pages::DefaultLayoutData;
|
||||
|
||||
pub trait Section: Template {
|
||||
fn name() -> &'static str;
|
||||
}
|
||||
@@ -12,3 +14,9 @@ pub struct UserPage<S: Section> {
|
||||
pub user: Principal,
|
||||
pub section: S,
|
||||
}
|
||||
|
||||
impl<S: Section> DefaultLayoutData for UserPage<S> {
|
||||
fn get_user(&self) -> Option<&Principal> {
|
||||
Some(&self.user)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,19 @@ use headers::Referer;
|
||||
use http::StatusCode;
|
||||
use rustical_store::{Addressbook, AddressbookStore, auth::Principal};
|
||||
|
||||
use crate::pages::DefaultLayoutData;
|
||||
|
||||
#[derive(Template, WebTemplate)]
|
||||
#[template(path = "pages/addressbook.html")]
|
||||
struct AddressbookPage {
|
||||
addressbook: Addressbook,
|
||||
user: Principal,
|
||||
}
|
||||
|
||||
impl DefaultLayoutData for AddressbookPage {
|
||||
fn get_user(&self) -> Option<&Principal> {
|
||||
Some(&self.user)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn route_addressbook<AS: AddressbookStore>(
|
||||
@@ -28,6 +37,7 @@ pub async fn route_addressbook<AS: AddressbookStore>(
|
||||
}
|
||||
Ok(AddressbookPage {
|
||||
addressbook: store.get_addressbook(&owner, &addrbook_id, true).await?,
|
||||
user,
|
||||
}
|
||||
.into_response())
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::pages::DefaultLayoutData;
|
||||
use askama::Template;
|
||||
use askama_web::WebTemplate;
|
||||
use axum::{
|
||||
@@ -11,11 +10,19 @@ use axum_extra::TypedHeader;
|
||||
use headers::Referer;
|
||||
use http::StatusCode;
|
||||
use rustical_store::{Calendar, CalendarStore, auth::Principal};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Template, WebTemplate)]
|
||||
#[template(path = "pages/calendar.html")]
|
||||
struct CalendarPage {
|
||||
calendar: Calendar,
|
||||
user: Principal,
|
||||
}
|
||||
|
||||
impl DefaultLayoutData for CalendarPage {
|
||||
fn get_user(&self) -> Option<&Principal> {
|
||||
Some(&self.user)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn route_calendar<C: CalendarStore>(
|
||||
@@ -28,6 +35,7 @@ pub async fn route_calendar<C: CalendarStore>(
|
||||
}
|
||||
Ok(CalendarPage {
|
||||
calendar: store.get_calendar(&owner, &cal_id, true).await?,
|
||||
user,
|
||||
}
|
||||
.into_response())
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{FrontendConfig, OidcConfig};
|
||||
use crate::{FrontendConfig, OidcConfig, pages::DefaultLayoutData};
|
||||
use askama::Template;
|
||||
use askama_web::WebTemplate;
|
||||
use axum::{
|
||||
@@ -24,6 +24,12 @@ struct LoginPage<'a> {
|
||||
allow_password_login: bool,
|
||||
}
|
||||
|
||||
impl DefaultLayoutData for LoginPage<'_> {
|
||||
fn get_user(&self) -> Option<&rustical_store::auth::Principal> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
struct OidcProviderData<'a> {
|
||||
pub name: &'a str,
|
||||
pub redirect_url: String,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_ical"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -2,7 +2,7 @@ use axum::{http::StatusCode, response::IntoResponse};
|
||||
|
||||
use crate::CalDateTimeError;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
|
||||
pub enum Error {
|
||||
#[error("Invalid ics/vcf input: {0}")]
|
||||
InvalidData(String),
|
||||
|
||||
@@ -13,7 +13,7 @@ const LOCAL_DATE_TIME: &str = "%Y%m%dT%H%M%S";
|
||||
const UTC_DATE_TIME: &str = "%Y%m%dT%H%M%SZ";
|
||||
pub const LOCAL_DATE: &str = "%Y%m%d";
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
|
||||
pub enum CalDateTimeError {
|
||||
#[error(
|
||||
"Timezone has X-LIC-LOCATION property to specify a timezone from the Olson database, however its value {0} is invalid"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_oidc"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_store"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -8,16 +9,16 @@ license.workspace = true
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
ical = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
chrono-tz = { workspace = true }
|
||||
anyhow.workspace = true
|
||||
async-trait.workspace = true
|
||||
serde.workspace = true
|
||||
sha2.workspace = true
|
||||
ical.workspace = true
|
||||
chrono.workspace = true
|
||||
regex.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
chrono-tz.workspace = true
|
||||
derive_more = { workspace = true, features = ["as_ref"] }
|
||||
rustical_xml.workspace = true
|
||||
tokio.workspace = true
|
||||
@@ -34,7 +35,7 @@ tower-sessions.workspace = true
|
||||
vtimezones-rs.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
rstest = { workspace = true }
|
||||
rstest_reuse = { workspace = true }
|
||||
rstest.workspace = true
|
||||
rstest_reuse.workspace = true
|
||||
rustical_store_sqlite.workspace = true
|
||||
tokio.workspace = true
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::synctoken::format_synctoken;
|
||||
use chrono::NaiveDateTime;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
|
||||
pub struct Addressbook {
|
||||
pub id: String,
|
||||
pub principal: String,
|
||||
|
||||
@@ -4,7 +4,7 @@ use rustical_ical::CalendarObjectType;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct CalendarMetadata {
|
||||
// Attributes that may be outsourced
|
||||
pub displayname: Option<String>,
|
||||
@@ -13,7 +13,7 @@ pub struct CalendarMetadata {
|
||||
pub color: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct Calendar {
|
||||
// Attributes that may be outsourced
|
||||
#[serde(flatten)]
|
||||
|
||||
@@ -98,5 +98,6 @@ pub trait CalendarStore: Send + Sync + 'static {
|
||||
object_id: &str,
|
||||
) -> Result<(), Error>;
|
||||
|
||||
// read_only refers to objects, metadata may still be updated
|
||||
fn is_read_only(&self, cal_id: &str) -> bool;
|
||||
}
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
use crate::{
|
||||
Addressbook, AddressbookStore, Calendar, CalendarStore, Error, calendar::CalendarMetadata,
|
||||
combined_calendar_store::PrefixedCalendarStore,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use derive_more::derive::Constructor;
|
||||
use rustical_ical::{AddressObject, CalendarObject, CalendarObjectType};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
pub const BIRTHDAYS_PREFIX: &str = "_birthdays_";
|
||||
|
||||
#[derive(Constructor, Clone)]
|
||||
pub struct ContactBirthdayStore<AS: AddressbookStore>(Arc<AS>);
|
||||
|
||||
impl<AS: AddressbookStore> PrefixedCalendarStore for ContactBirthdayStore<AS> {
|
||||
const PREFIX: &'static str = BIRTHDAYS_PREFIX;
|
||||
}
|
||||
|
||||
fn birthday_calendar(addressbook: Addressbook) -> Calendar {
|
||||
Calendar {
|
||||
principal: addressbook.principal,
|
||||
id: format!("{}{}", BIRTHDAYS_PREFIX, addressbook.id),
|
||||
meta: CalendarMetadata {
|
||||
displayname: addressbook
|
||||
.displayname
|
||||
.map(|name| format!("{name} birthdays")),
|
||||
order: 0,
|
||||
description: None,
|
||||
color: None,
|
||||
},
|
||||
timezone_id: None,
|
||||
deleted_at: addressbook.deleted_at,
|
||||
synctoken: addressbook.synctoken,
|
||||
subscription_url: None,
|
||||
push_topic: {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update("birthdays");
|
||||
hasher.update(addressbook.push_topic);
|
||||
format!("{:x}", hasher.finalize())
|
||||
},
|
||||
components: vec![CalendarObjectType::Event],
|
||||
}
|
||||
}
|
||||
|
||||
/// Objects are all prefixed with `BIRTHDAYS_PREFIX`
|
||||
#[async_trait]
|
||||
impl<AS: AddressbookStore> CalendarStore for ContactBirthdayStore<AS> {
|
||||
async fn get_calendar(
|
||||
&self,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
show_deleted: bool,
|
||||
) -> Result<Calendar, Error> {
|
||||
let id = id.strip_prefix(BIRTHDAYS_PREFIX).ok_or(Error::NotFound)?;
|
||||
let addressbook = self.0.get_addressbook(principal, id, show_deleted).await?;
|
||||
Ok(birthday_calendar(addressbook))
|
||||
}
|
||||
|
||||
async fn get_calendars(&self, principal: &str) -> Result<Vec<Calendar>, Error> {
|
||||
let addressbooks = self.0.get_addressbooks(principal).await?;
|
||||
Ok(addressbooks.into_iter().map(birthday_calendar).collect())
|
||||
}
|
||||
|
||||
async fn get_deleted_calendars(&self, principal: &str) -> Result<Vec<Calendar>, Error> {
|
||||
let addressbooks = self.0.get_deleted_addressbooks(principal).await?;
|
||||
Ok(addressbooks.into_iter().map(birthday_calendar).collect())
|
||||
}
|
||||
|
||||
async fn update_calendar(
|
||||
&self,
|
||||
_principal: String,
|
||||
_id: String,
|
||||
_calendar: Calendar,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
async fn insert_calendar(&self, _calendar: Calendar) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
async fn delete_calendar(
|
||||
&self,
|
||||
_principal: &str,
|
||||
_name: &str,
|
||||
_use_trashbin: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
async fn restore_calendar(&self, _principal: &str, _name: &str) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
async fn import_calendar(
|
||||
&self,
|
||||
_calendar: Calendar,
|
||||
_objects: Vec<CalendarObject>,
|
||||
_merge_existing: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
async fn sync_changes(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
synctoken: i64,
|
||||
) -> Result<(Vec<CalendarObject>, Vec<String>, i64), Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
let (objects, deleted_objects, new_synctoken) =
|
||||
self.0.sync_changes(principal, cal_id, synctoken).await?;
|
||||
let objects: Result<Vec<Option<CalendarObject>>, rustical_ical::Error> = objects
|
||||
.iter()
|
||||
.map(AddressObject::get_birthday_object)
|
||||
.collect();
|
||||
let objects = objects?.into_iter().flatten().collect();
|
||||
|
||||
Ok((objects, deleted_objects, new_synctoken))
|
||||
}
|
||||
|
||||
async fn calendar_metadata(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
) -> Result<crate::CollectionMetadata, Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
self.0.addressbook_metadata(principal, cal_id).await
|
||||
}
|
||||
|
||||
async fn get_objects(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
) -> Result<Vec<CalendarObject>, Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
let objects: Result<Vec<HashMap<&'static str, CalendarObject>>, rustical_ical::Error> =
|
||||
self.0
|
||||
.get_objects(principal, cal_id)
|
||||
.await?
|
||||
.iter()
|
||||
.map(AddressObject::get_significant_dates)
|
||||
.collect();
|
||||
let objects = objects?
|
||||
.into_iter()
|
||||
.flat_map(HashMap::into_values)
|
||||
.collect();
|
||||
|
||||
Ok(objects)
|
||||
}
|
||||
|
||||
async fn get_object(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
object_id: &str,
|
||||
show_deleted: bool,
|
||||
) -> Result<CalendarObject, Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
let (addressobject_id, date_type) = object_id.rsplit_once('-').ok_or(Error::NotFound)?;
|
||||
self.0
|
||||
.get_object(principal, cal_id, addressobject_id, show_deleted)
|
||||
.await?
|
||||
.get_significant_dates()?
|
||||
.remove(date_type)
|
||||
.ok_or(Error::NotFound)
|
||||
}
|
||||
|
||||
async fn put_object(
|
||||
&self,
|
||||
_principal: String,
|
||||
_cal_id: String,
|
||||
_object: CalendarObject,
|
||||
_overwrite: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
async fn delete_object(
|
||||
&self,
|
||||
_principal: &str,
|
||||
_cal_id: &str,
|
||||
_object_id: &str,
|
||||
_use_trashbin: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
async fn restore_object(
|
||||
&self,
|
||||
_principal: &str,
|
||||
_cal_id: &str,
|
||||
_object_id: &str,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
fn is_read_only(&self, _cal_id: &str) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,11 @@ impl Error {
|
||||
_ => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn is_not_found(&self) -> bool {
|
||||
matches!(self, Self::NotFound)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoResponse for Error {
|
||||
|
||||
@@ -7,7 +7,6 @@ pub use error::Error;
|
||||
pub mod auth;
|
||||
mod calendar;
|
||||
mod combined_calendar_store;
|
||||
mod contact_birthday_store;
|
||||
mod secret;
|
||||
mod subscription_store;
|
||||
pub mod synctoken;
|
||||
@@ -17,8 +16,7 @@ pub mod tests;
|
||||
|
||||
pub use addressbook_store::AddressbookStore;
|
||||
pub use calendar_store::CalendarStore;
|
||||
pub use combined_calendar_store::CombinedCalendarStore;
|
||||
pub use contact_birthday_store::ContactBirthdayStore;
|
||||
pub use combined_calendar_store::{CombinedCalendarStore, PrefixedCalendarStore};
|
||||
pub use secret::Secret;
|
||||
pub use subscription_store::*;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_store_sqlite"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -15,12 +16,12 @@ rstest.workspace = true
|
||||
|
||||
[dependencies]
|
||||
tokio.workspace = true
|
||||
rustical_store = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
rustical_store.workspace = true
|
||||
async-trait.workspace = true
|
||||
serde.workspace = true
|
||||
sqlx.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
derive_more.workspace = true
|
||||
chrono.workspace = true
|
||||
password-auth.workspace = true
|
||||
@@ -29,3 +30,4 @@ uuid.workspace = true
|
||||
pbkdf2.workspace = true
|
||||
rustical_ical.workspace = true
|
||||
rstest = { workspace = true, optional = true }
|
||||
sha2.workspace = true
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE birthday_calendars;
|
||||
@@ -0,0 +1,26 @@
|
||||
CREATE TABLE birthday_calendars (
|
||||
principal TEXT NOT NULL,
|
||||
id TEXT NOT NULL,
|
||||
displayname TEXT,
|
||||
description TEXT,
|
||||
"order" INT DEFAULT 0 NOT NULL,
|
||||
color TEXT,
|
||||
timezone_id TEXT,
|
||||
deleted_at DATETIME,
|
||||
push_topic TEXT NOT NULL,
|
||||
PRIMARY KEY (principal, id),
|
||||
CONSTRAINT fk_birthdays_addressbooks FOREIGN KEY (principal, id)
|
||||
REFERENCES addressbooks (principal, id) ON DELETE CASCADE
|
||||
-- birthday calendar stores no meaningful data so we can cascade
|
||||
);
|
||||
|
||||
INSERT INTO birthday_calendars
|
||||
(principal, id, displayname, deleted_at, push_topic)
|
||||
SELECT
|
||||
principal,
|
||||
id,
|
||||
displayname || ' birthdays' AS displayname,
|
||||
deleted_at,
|
||||
push_topic || substr(printf('%d', random()), -4) AS push_topic
|
||||
-- jank suffix to ensure that new push_topic is different :D
|
||||
FROM addressbooks;
|
||||
404
crates/store_sqlite/src/addressbook_store/birthday_calendar.rs
Normal file
404
crates/store_sqlite/src/addressbook_store/birthday_calendar.rs
Normal file
@@ -0,0 +1,404 @@
|
||||
use crate::addressbook_store::SqliteAddressbookStore;
|
||||
use async_trait::async_trait;
|
||||
use chrono::NaiveDateTime;
|
||||
use rustical_ical::{AddressObject, CalendarObject, CalendarObjectType};
|
||||
use rustical_store::{
|
||||
Addressbook, AddressbookStore, Calendar, CalendarMetadata, CalendarStore, CollectionMetadata,
|
||||
Error, PrefixedCalendarStore,
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
use sqlx::{Executor, Sqlite};
|
||||
use std::collections::HashMap;
|
||||
use tracing::instrument;
|
||||
|
||||
pub const BIRTHDAYS_PREFIX: &str = "_birthdays_";
|
||||
|
||||
struct BirthdayCalendarJoinRow {
|
||||
principal: String,
|
||||
id: String,
|
||||
displayname: Option<String>,
|
||||
description: Option<String>,
|
||||
order: i64,
|
||||
color: Option<String>,
|
||||
timezone_id: Option<String>,
|
||||
deleted_at: Option<NaiveDateTime>,
|
||||
push_topic: String,
|
||||
|
||||
addr_synctoken: i64,
|
||||
}
|
||||
|
||||
impl From<BirthdayCalendarJoinRow> for Calendar {
|
||||
fn from(value: BirthdayCalendarJoinRow) -> Self {
|
||||
Self {
|
||||
principal: value.principal,
|
||||
id: format!("{}{}", BIRTHDAYS_PREFIX, value.id),
|
||||
meta: CalendarMetadata {
|
||||
displayname: value.displayname,
|
||||
order: value.order,
|
||||
description: value.description,
|
||||
color: value.color,
|
||||
},
|
||||
deleted_at: value.deleted_at,
|
||||
components: vec![CalendarObjectType::Event],
|
||||
timezone_id: value.timezone_id,
|
||||
synctoken: value.addr_synctoken,
|
||||
subscription_url: None,
|
||||
push_topic: value.push_topic,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PrefixedCalendarStore for SqliteAddressbookStore {
|
||||
const PREFIX: &'static str = BIRTHDAYS_PREFIX;
|
||||
}
|
||||
|
||||
impl SqliteAddressbookStore {
|
||||
#[instrument]
|
||||
pub async fn _get_birthday_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
show_deleted: bool,
|
||||
) -> Result<Calendar, Error> {
|
||||
let cal = sqlx::query_as!(
|
||||
BirthdayCalendarJoinRow,
|
||||
r#"SELECT principal, id, displayname, description, "order", color, timezone_id, deleted_at, addr_synctoken, push_topic
|
||||
FROM birthday_calendars
|
||||
INNER JOIN (
|
||||
SELECT principal AS addr_principal,
|
||||
id AS addr_id,
|
||||
synctoken AS addr_synctoken
|
||||
FROM addressbooks
|
||||
) ON (principal, id) = (addr_principal, addr_id)
|
||||
WHERE (principal, id) = (?, ?)
|
||||
AND ((deleted_at IS NULL) OR ?)
|
||||
"#,
|
||||
principal,
|
||||
id,
|
||||
show_deleted
|
||||
)
|
||||
.fetch_one(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(cal.into())
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
pub async fn _get_birthday_calendars<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
deleted: bool,
|
||||
) -> Result<Vec<Calendar>, Error> {
|
||||
Ok(
|
||||
sqlx::query_as!(
|
||||
BirthdayCalendarJoinRow,
|
||||
r#"SELECT principal, id, displayname, description, "order", color, timezone_id, deleted_at, addr_synctoken, push_topic
|
||||
FROM birthday_calendars
|
||||
INNER JOIN (
|
||||
SELECT principal AS addr_principal,
|
||||
id AS addr_id,
|
||||
synctoken AS addr_synctoken
|
||||
FROM addressbooks
|
||||
) ON (principal, id) = (addr_principal, addr_id)
|
||||
WHERE principal = ?
|
||||
AND (
|
||||
(deleted_at IS NULL AND NOT ?) -- not deleted, want not deleted
|
||||
OR (deleted_at IS NOT NULL AND ?) -- deleted, want deleted
|
||||
)
|
||||
"#,
|
||||
principal,
|
||||
deleted,
|
||||
deleted
|
||||
)
|
||||
.fetch_all(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from).map(|cals| cals.into_iter().map(BirthdayCalendarJoinRow::into).collect())?)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
pub async fn _insert_birthday_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
addressbook: &Addressbook,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
let birthday_name = addressbook
|
||||
.displayname
|
||||
.as_ref()
|
||||
.map(|name| format!("{name} birthdays"));
|
||||
let birthday_push_topic = {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update("birthdays");
|
||||
hasher.update(&addressbook.push_topic);
|
||||
format!("{:x}", hasher.finalize())
|
||||
};
|
||||
|
||||
sqlx::query!(
|
||||
r#"INSERT INTO birthday_calendars (principal, id, displayname, push_topic)
|
||||
VALUES (?, ?, ?, ?)"#,
|
||||
addressbook.principal,
|
||||
addressbook.id,
|
||||
birthday_name,
|
||||
birthday_push_topic,
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn _delete_birthday_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
use_trashbin: bool,
|
||||
) -> Result<(), Error> {
|
||||
if use_trashbin {
|
||||
sqlx::query!(
|
||||
r#"UPDATE birthday_calendars SET deleted_at = datetime() WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?
|
||||
} else {
|
||||
sqlx::query!(
|
||||
r#"DELETE FROM birthday_calendars WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn _restore_birthday_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
) -> Result<(), Error> {
|
||||
sqlx::query!(
|
||||
r"UPDATE birthday_calendars SET deleted_at = NULL WHERE (principal, id) = (?, ?)",
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn _update_birthday_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
calendar: &Calendar,
|
||||
) -> Result<(), Error> {
|
||||
let result = sqlx::query!(
|
||||
r#"UPDATE birthday_calendars SET principal = ?, id = ?, displayname = ?, description = ?, "order" = ?, color = ?, timezone_id = ?, push_topic = ?
|
||||
WHERE (principal, id) = (?, ?)"#,
|
||||
calendar.principal,
|
||||
calendar.id,
|
||||
calendar.meta.displayname,
|
||||
calendar.meta.description,
|
||||
calendar.meta.order,
|
||||
calendar.meta.color,
|
||||
calendar.timezone_id,
|
||||
calendar.push_topic,
|
||||
principal,
|
||||
calendar.id,
|
||||
).execute(executor).await.map_err(crate::Error::from)?;
|
||||
if result.rows_affected() == 0 {
|
||||
return Err(rustical_store::Error::NotFound);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl CalendarStore for SqliteAddressbookStore {
|
||||
#[instrument]
|
||||
async fn get_calendar(
|
||||
&self,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
show_deleted: bool,
|
||||
) -> Result<Calendar, Error> {
|
||||
let id = id.strip_prefix(BIRTHDAYS_PREFIX).ok_or(Error::NotFound)?;
|
||||
Self::_get_birthday_calendar(&self.db, principal, id, show_deleted).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn get_calendars(&self, principal: &str) -> Result<Vec<Calendar>, Error> {
|
||||
Self::_get_birthday_calendars(&self.db, principal, false).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn get_deleted_calendars(&self, principal: &str) -> Result<Vec<Calendar>, Error> {
|
||||
Self::_get_birthday_calendars(&self.db, principal, true).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn update_calendar(
|
||||
&self,
|
||||
principal: String,
|
||||
id: String,
|
||||
mut calendar: Calendar,
|
||||
) -> Result<(), Error> {
|
||||
assert_eq!(id, calendar.id);
|
||||
calendar.id = calendar
|
||||
.id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?
|
||||
.to_string();
|
||||
Self::_update_birthday_calendar(&self.db, &principal, &calendar).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn insert_calendar(&self, _calendar: Calendar) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn delete_calendar(
|
||||
&self,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
use_trashbin: bool,
|
||||
) -> Result<(), Error> {
|
||||
let Some(id) = id.strip_prefix(BIRTHDAYS_PREFIX) else {
|
||||
return Ok(());
|
||||
};
|
||||
Self::_delete_birthday_calendar(&self.db, principal, id, use_trashbin).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn restore_calendar(&self, principal: &str, id: &str) -> Result<(), Error> {
|
||||
let Some(id) = id.strip_prefix(BIRTHDAYS_PREFIX) else {
|
||||
return Err(Error::NotFound);
|
||||
};
|
||||
Self::_restore_birthday_calendar(&self.db, principal, id).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn import_calendar(
|
||||
&self,
|
||||
_calendar: Calendar,
|
||||
_objects: Vec<CalendarObject>,
|
||||
_merge_existing: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn sync_changes(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
synctoken: i64,
|
||||
) -> Result<(Vec<CalendarObject>, Vec<String>, i64), Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
let (objects, deleted_objects, new_synctoken) =
|
||||
AddressbookStore::sync_changes(self, principal, cal_id, synctoken).await?;
|
||||
let objects: Result<Vec<Option<CalendarObject>>, rustical_ical::Error> = objects
|
||||
.iter()
|
||||
.map(AddressObject::get_birthday_object)
|
||||
.collect();
|
||||
let objects = objects?.into_iter().flatten().collect();
|
||||
|
||||
Ok((objects, deleted_objects, new_synctoken))
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn calendar_metadata(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
) -> Result<CollectionMetadata, Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
self.addressbook_metadata(principal, cal_id).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn get_objects(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
) -> Result<Vec<CalendarObject>, Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
let objects: Result<Vec<HashMap<&'static str, CalendarObject>>, rustical_ical::Error> =
|
||||
AddressbookStore::get_objects(self, principal, cal_id)
|
||||
.await?
|
||||
.iter()
|
||||
.map(AddressObject::get_significant_dates)
|
||||
.collect();
|
||||
let objects = objects?
|
||||
.into_iter()
|
||||
.flat_map(HashMap::into_values)
|
||||
.collect();
|
||||
|
||||
Ok(objects)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn get_object(
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
object_id: &str,
|
||||
show_deleted: bool,
|
||||
) -> Result<CalendarObject, Error> {
|
||||
let cal_id = cal_id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
let (addressobject_id, date_type) = object_id.rsplit_once('-').ok_or(Error::NotFound)?;
|
||||
AddressbookStore::get_object(self, principal, cal_id, addressobject_id, show_deleted)
|
||||
.await?
|
||||
.get_significant_dates()?
|
||||
.remove(date_type)
|
||||
.ok_or(Error::NotFound)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn put_object(
|
||||
&self,
|
||||
_principal: String,
|
||||
_cal_id: String,
|
||||
_object: CalendarObject,
|
||||
_overwrite: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn delete_object(
|
||||
&self,
|
||||
_principal: &str,
|
||||
_cal_id: &str,
|
||||
_object_id: &str,
|
||||
_use_trashbin: bool,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn restore_object(
|
||||
&self,
|
||||
_principal: &str,
|
||||
_cal_id: &str,
|
||||
_object_id: &str,
|
||||
) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
}
|
||||
|
||||
fn is_read_only(&self, _cal_id: &str) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,9 @@ use rustical_store::{
|
||||
};
|
||||
use sqlx::{Acquire, Executor, Sqlite, SqlitePool, Transaction};
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use tracing::{error, instrument};
|
||||
use tracing::{error, instrument, warn};
|
||||
|
||||
pub mod birthday_calendar;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct AddressObjectRow {
|
||||
@@ -32,6 +34,60 @@ pub struct SqliteAddressbookStore {
|
||||
}
|
||||
|
||||
impl SqliteAddressbookStore {
|
||||
// Commit "orphaned" objects to the changelog table
|
||||
pub async fn repair_orphans(&self) -> Result<(), Error> {
|
||||
struct Row {
|
||||
principal: String,
|
||||
addressbook_id: String,
|
||||
id: String,
|
||||
deleted: bool,
|
||||
}
|
||||
|
||||
let mut tx = self
|
||||
.db
|
||||
.begin_with(BEGIN_IMMEDIATE)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
let rows = sqlx::query_as!(
|
||||
Row,
|
||||
r#"
|
||||
SELECT principal, addressbook_id, id, (deleted_at IS NOT NULL) AS "deleted: bool"
|
||||
FROM addressobjects
|
||||
WHERE (principal, addressbook_id, id) NOT IN (
|
||||
SELECT DISTINCT principal, addressbook_id, object_id FROM addressobjectchangelog
|
||||
)
|
||||
;
|
||||
"#,
|
||||
)
|
||||
.fetch_all(&mut *tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
for row in rows {
|
||||
let operation = if row.deleted {
|
||||
ChangeOperation::Delete
|
||||
} else {
|
||||
ChangeOperation::Add
|
||||
};
|
||||
warn!(
|
||||
"Commiting orphaned addressbook object ({},{},{}), deleted={}",
|
||||
&row.principal, &row.addressbook_id, &row.id, &row.deleted
|
||||
);
|
||||
log_object_operation(
|
||||
&mut tx,
|
||||
&row.principal,
|
||||
&row.addressbook_id,
|
||||
&row.id,
|
||||
operation,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn _get_addressbook<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
@@ -90,9 +146,9 @@ impl SqliteAddressbookStore {
|
||||
|
||||
async fn _update_addressbook<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: String,
|
||||
id: String,
|
||||
addressbook: Addressbook,
|
||||
principal: &str,
|
||||
id: &str,
|
||||
addressbook: &Addressbook,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
let result = sqlx::query!(
|
||||
r#"UPDATE addressbooks SET principal = ?, id = ?, displayname = ?, description = ?, push_topic = ?
|
||||
@@ -116,7 +172,7 @@ impl SqliteAddressbookStore {
|
||||
|
||||
async fn _insert_addressbook<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
addressbook: Addressbook,
|
||||
addressbook: &Addressbook,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
sqlx::query!(
|
||||
r#"INSERT INTO addressbooks (principal, id, displayname, description, push_topic)
|
||||
@@ -283,9 +339,9 @@ impl SqliteAddressbookStore {
|
||||
|
||||
async fn _put_object<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: String,
|
||||
addressbook_id: String,
|
||||
object: AddressObject,
|
||||
principal: &str,
|
||||
addressbook_id: &str,
|
||||
object: &AddressObject,
|
||||
overwrite: bool,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
let (object_id, vcf) = (object.get_id(), object.get_vcf());
|
||||
@@ -397,7 +453,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
id: String,
|
||||
addressbook: Addressbook,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
Self::_update_addressbook(&self.db, principal, id, addressbook).await
|
||||
Self::_update_addressbook(&self.db, &principal, &id, &addressbook).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
@@ -405,7 +461,15 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
&self,
|
||||
addressbook: Addressbook,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
Self::_insert_addressbook(&self.db, addressbook).await
|
||||
let mut tx = self
|
||||
.db
|
||||
.begin_with(BEGIN_IMMEDIATE)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Self::_insert_addressbook(&mut *tx, &addressbook).await?;
|
||||
Self::_insert_birthday_calendar(&mut *tx, &addressbook).await?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
@@ -521,14 +585,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
|
||||
let object_id = object.get_id().to_owned();
|
||||
|
||||
Self::_put_object(
|
||||
&mut *tx,
|
||||
principal.clone(),
|
||||
addressbook_id.clone(),
|
||||
object,
|
||||
overwrite,
|
||||
)
|
||||
.await?;
|
||||
Self::_put_object(&mut *tx, &principal, &addressbook_id, &object, overwrite).await?;
|
||||
|
||||
let sync_token = log_object_operation(
|
||||
&mut tx,
|
||||
@@ -628,7 +685,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
.await?
|
||||
.push_topic,
|
||||
}) {
|
||||
error!("Push notification about deleted addressbook failed: {err}");
|
||||
error!("Push notification about restored addressbook object failed: {err}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -659,21 +716,44 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
return Err(Error::AlreadyExists);
|
||||
}
|
||||
if existing.is_none() {
|
||||
Self::_insert_addressbook(&mut *tx, addressbook.clone()).await?;
|
||||
Self::_insert_addressbook(&mut *tx, &addressbook).await?;
|
||||
}
|
||||
|
||||
let mut sync_token = None;
|
||||
for object in objects {
|
||||
Self::_put_object(
|
||||
&mut *tx,
|
||||
addressbook.principal.clone(),
|
||||
addressbook.id.clone(),
|
||||
object,
|
||||
&addressbook.principal,
|
||||
&addressbook.id,
|
||||
&object,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
|
||||
sync_token = Some(
|
||||
log_object_operation(
|
||||
&mut tx,
|
||||
&addressbook.principal,
|
||||
&addressbook.id,
|
||||
object.get_id(),
|
||||
ChangeOperation::Add,
|
||||
)
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
if let Some(sync_token) = sync_token
|
||||
&& let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self
|
||||
.get_addressbook(&addressbook.principal, &addressbook.id, true)
|
||||
.await?
|
||||
.push_topic,
|
||||
})
|
||||
{
|
||||
error!("Push notification about imported addressbook failed: {err}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -685,7 +765,7 @@ async fn log_object_operation(
|
||||
addressbook_id: &str,
|
||||
object_id: &str,
|
||||
operation: ChangeOperation,
|
||||
) -> Result<String, sqlx::Error> {
|
||||
) -> Result<String, Error> {
|
||||
struct Synctoken {
|
||||
synctoken: i64,
|
||||
}
|
||||
@@ -700,7 +780,8 @@ async fn log_object_operation(
|
||||
addressbook_id
|
||||
)
|
||||
.fetch_one(&mut **tx)
|
||||
.await?;
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
@@ -714,6 +795,7 @@ async fn log_object_operation(
|
||||
operation
|
||||
)
|
||||
.execute(&mut **tx)
|
||||
.await?;
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(format_synctoken(synctoken))
|
||||
}
|
||||
@@ -11,7 +11,7 @@ use rustical_store::{CollectionOperation, CollectionOperationInfo};
|
||||
use sqlx::types::chrono::NaiveDateTime;
|
||||
use sqlx::{Acquire, Executor, Sqlite, SqlitePool, Transaction};
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use tracing::{error, instrument};
|
||||
use tracing::{error, instrument, warn};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct CalendarObjectRow {
|
||||
@@ -94,6 +94,53 @@ pub struct SqliteCalendarStore {
|
||||
}
|
||||
|
||||
impl SqliteCalendarStore {
|
||||
// Commit "orphaned" objects to the changelog table
|
||||
pub async fn repair_orphans(&self) -> Result<(), Error> {
|
||||
struct Row {
|
||||
principal: String,
|
||||
cal_id: String,
|
||||
id: String,
|
||||
deleted: bool,
|
||||
}
|
||||
|
||||
let mut tx = self
|
||||
.db
|
||||
.begin_with(BEGIN_IMMEDIATE)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
let rows = sqlx::query_as!(
|
||||
Row,
|
||||
r#"
|
||||
SELECT principal, cal_id, id, (deleted_at IS NOT NULL) AS "deleted: bool"
|
||||
FROM calendarobjects
|
||||
WHERE (principal, cal_id, id) NOT IN (
|
||||
SELECT DISTINCT principal, cal_id, object_id FROM calendarobjectchangelog
|
||||
)
|
||||
;
|
||||
"#,
|
||||
)
|
||||
.fetch_all(&mut *tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
for row in rows {
|
||||
let operation = if row.deleted {
|
||||
ChangeOperation::Delete
|
||||
} else {
|
||||
ChangeOperation::Add
|
||||
};
|
||||
warn!(
|
||||
"Commiting orphaned calendar object ({},{},{}), deleted={}",
|
||||
&row.principal, &row.cal_id, &row.id, &row.deleted
|
||||
);
|
||||
log_object_operation(&mut tx, &row.principal, &row.cal_id, &row.id, operation).await?;
|
||||
}
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn _get_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
@@ -351,9 +398,9 @@ impl SqliteCalendarStore {
|
||||
#[instrument]
|
||||
async fn _put_object<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: String,
|
||||
cal_id: String,
|
||||
object: CalendarObject,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
object: &CalendarObject,
|
||||
overwrite: bool,
|
||||
) -> Result<(), Error> {
|
||||
let (object_id, uid, ics) = (object.get_id(), object.get_uid(), object.get_ics());
|
||||
@@ -600,18 +647,35 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
Self::_insert_calendar(&mut *tx, calendar.clone()).await?;
|
||||
}
|
||||
|
||||
let mut sync_token = None;
|
||||
for object in objects {
|
||||
Self::_put_object(
|
||||
&mut *tx,
|
||||
calendar.principal.clone(),
|
||||
calendar.id.clone(),
|
||||
object,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
Self::_put_object(&mut *tx, &calendar.principal, &calendar.id, &object, false).await?;
|
||||
|
||||
sync_token = Some(
|
||||
log_object_operation(
|
||||
&mut tx,
|
||||
&calendar.principal,
|
||||
&calendar.id,
|
||||
object.get_id(),
|
||||
ChangeOperation::Add,
|
||||
)
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Some(sync_token) = sync_token
|
||||
&& let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self
|
||||
.get_calendar(&calendar.principal, &calendar.id, true)
|
||||
.await?
|
||||
.push_topic,
|
||||
})
|
||||
{
|
||||
error!("Push notification about imported calendar failed: {err}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -689,14 +753,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
return Err(Error::ReadOnly);
|
||||
}
|
||||
|
||||
Self::_put_object(
|
||||
&mut *tx,
|
||||
principal.clone(),
|
||||
cal_id.clone(),
|
||||
object,
|
||||
overwrite,
|
||||
)
|
||||
.await?;
|
||||
Self::_put_object(&mut *tx, &principal, &cal_id, &object, overwrite).await?;
|
||||
|
||||
let sync_token = log_object_operation(
|
||||
&mut tx,
|
||||
@@ -774,7 +831,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self.get_calendar(principal, cal_id, true).await?.push_topic,
|
||||
}) {
|
||||
error!("Push notification about deleted calendar failed: {err}");
|
||||
error!("Push notification about restored calendar object failed: {err}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -795,6 +852,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
}
|
||||
|
||||
// Logs an operation to the events
|
||||
// TODO: Log multiple updates
|
||||
async fn log_object_operation(
|
||||
tx: &mut Transaction<'_, Sqlite>,
|
||||
principal: &str,
|
||||
|
||||
81
crates/store_sqlite/src/tests/addressbook_store.rs
Normal file
81
crates/store_sqlite/src/tests/addressbook_store.rs
Normal file
@@ -0,0 +1,81 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{addressbook_store::SqliteAddressbookStore, tests::get_test_addressbook_store};
|
||||
use rstest::rstest;
|
||||
use rustical_store::{Addressbook, AddressbookStore};
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_addressbook_store(
|
||||
#[from(get_test_addressbook_store)]
|
||||
#[future]
|
||||
addr_store: SqliteAddressbookStore,
|
||||
) {
|
||||
let addr_store = addr_store.await;
|
||||
|
||||
let cal = Addressbook {
|
||||
id: "addr".to_string(),
|
||||
principal: "fake-user".to_string(),
|
||||
displayname: None,
|
||||
description: None,
|
||||
deleted_at: None,
|
||||
synctoken: 0,
|
||||
push_topic: "alskdj".to_string(),
|
||||
};
|
||||
|
||||
assert!(
|
||||
addr_store.insert_addressbook(cal).await.is_err(),
|
||||
"This should fail due to the user not existing "
|
||||
);
|
||||
|
||||
let addr = Addressbook {
|
||||
id: "addr".to_string(),
|
||||
principal: "user".to_string(),
|
||||
displayname: None,
|
||||
description: None,
|
||||
deleted_at: None,
|
||||
synctoken: 0,
|
||||
push_topic: "alskdj".to_string(),
|
||||
};
|
||||
|
||||
addr_store.insert_addressbook(addr.clone()).await.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
addr_store
|
||||
.get_addressbook("user", "addr", false)
|
||||
.await
|
||||
.unwrap(),
|
||||
addr
|
||||
);
|
||||
|
||||
addr_store
|
||||
.delete_addressbook("user", "addr", true)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let Err(err) = addr_store.get_addressbook("user", "addr", false).await else {
|
||||
panic!()
|
||||
};
|
||||
assert!(err.is_not_found());
|
||||
|
||||
addr_store
|
||||
.get_addressbook("user", "addr", true)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
addr_store
|
||||
.restore_addressbook("user", "addr")
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
addr_store
|
||||
.delete_addressbook("user", "addr", false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let Err(err) = addr_store.get_addressbook("user", "addr", true).await else {
|
||||
panic!()
|
||||
};
|
||||
assert!(err.is_not_found());
|
||||
}
|
||||
}
|
||||
76
crates/store_sqlite/src/tests/calendar_store.rs
Normal file
76
crates/store_sqlite/src/tests/calendar_store.rs
Normal file
@@ -0,0 +1,76 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{calendar_store::SqliteCalendarStore, tests::get_test_calendar_store};
|
||||
use rstest::rstest;
|
||||
use rustical_store::{Calendar, CalendarMetadata, CalendarStore};
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_calendar_store(
|
||||
#[from(get_test_calendar_store)]
|
||||
#[future]
|
||||
cal_store: SqliteCalendarStore,
|
||||
) {
|
||||
let cal_store = cal_store.await;
|
||||
|
||||
let cal = Calendar {
|
||||
principal: "fake-user".to_string(),
|
||||
timezone_id: None,
|
||||
deleted_at: None,
|
||||
meta: CalendarMetadata::default(),
|
||||
id: "cal".to_string(),
|
||||
synctoken: 0,
|
||||
subscription_url: None,
|
||||
push_topic: "alskdj".to_string(),
|
||||
components: vec![],
|
||||
};
|
||||
|
||||
assert!(
|
||||
cal_store.insert_calendar(cal).await.is_err(),
|
||||
"This should fail due to the user not existing "
|
||||
);
|
||||
|
||||
let cal = Calendar {
|
||||
principal: "user".to_string(),
|
||||
timezone_id: None,
|
||||
deleted_at: None,
|
||||
meta: CalendarMetadata::default(),
|
||||
id: "cal".to_string(),
|
||||
synctoken: 0,
|
||||
subscription_url: None,
|
||||
push_topic: "alskdj".to_string(),
|
||||
components: vec![],
|
||||
};
|
||||
|
||||
cal_store.insert_calendar(cal.clone()).await.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
cal_store.get_calendar("user", "cal", false).await.unwrap(),
|
||||
cal
|
||||
);
|
||||
|
||||
cal_store
|
||||
.delete_calendar("user", "cal", true)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let Err(err) = cal_store.get_calendar("user", "cal", false).await else {
|
||||
panic!()
|
||||
};
|
||||
assert!(err.is_not_found());
|
||||
|
||||
cal_store.get_calendar("user", "cal", true).await.unwrap();
|
||||
|
||||
cal_store.restore_calendar("user", "cal").await.unwrap();
|
||||
|
||||
cal_store
|
||||
.delete_calendar("user", "cal", false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let Err(err) = cal_store.get_calendar("user", "cal", true).await else {
|
||||
panic!()
|
||||
};
|
||||
assert!(err.is_not_found());
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ use tokio::sync::OnceCell;
|
||||
|
||||
static DB: OnceCell<SqlitePool> = OnceCell::const_new();
|
||||
|
||||
mod addressbook_store;
|
||||
mod calendar_store;
|
||||
|
||||
async fn get_test_db() -> SqlitePool {
|
||||
DB.get_or_init(async || {
|
||||
let db = SqlitePool::connect("sqlite::memory:").await.unwrap();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "rustical_xml"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "xml_derive"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[lib]
|
||||
|
||||
1
docs/googlec55e08580a46745c.html
Normal file
1
docs/googlec55e08580a46745c.html
Normal file
@@ -0,0 +1 @@
|
||||
google-site-verification: googlec55e08580a46745c.html
|
||||
15
src/app.rs
15
src/app.rs
@@ -16,7 +16,8 @@ use rustical_frontend::{FrontendConfig, frontend_router};
|
||||
use rustical_oidc::OidcConfig;
|
||||
use rustical_store::auth::AuthenticationProvider;
|
||||
use rustical_store::{
|
||||
AddressbookStore, CalendarStore, CombinedCalendarStore, ContactBirthdayStore, SubscriptionStore,
|
||||
AddressbookStore, CalendarStore, CombinedCalendarStore, PrefixedCalendarStore,
|
||||
SubscriptionStore,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
@@ -33,7 +34,11 @@ use tracing::field::display;
|
||||
clippy::too_many_lines,
|
||||
clippy::cognitive_complexity
|
||||
)]
|
||||
pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
|
||||
pub fn make_app<
|
||||
AS: AddressbookStore + PrefixedCalendarStore,
|
||||
CS: CalendarStore,
|
||||
S: SubscriptionStore,
|
||||
>(
|
||||
addr_store: Arc<AS>,
|
||||
cal_store: Arc<CS>,
|
||||
subscription_store: Arc<S>,
|
||||
@@ -45,7 +50,7 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
|
||||
session_cookie_samesite_strict: bool,
|
||||
payload_limit_mb: usize,
|
||||
) -> Router<()> {
|
||||
let birthday_store = Arc::new(ContactBirthdayStore::new(addr_store.clone()));
|
||||
let birthday_store = addr_store.clone();
|
||||
let combined_cal_store =
|
||||
Arc::new(CombinedCalendarStore::new(cal_store).with_store(birthday_store));
|
||||
|
||||
@@ -173,7 +178,9 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
|
||||
tracing::debug!("unauthorized");
|
||||
}
|
||||
StatusCode::NOT_FOUND => {
|
||||
tracing::warn!("client error");
|
||||
// Clients like GNOME Calendar will try to reach /remote.php/webdav
|
||||
// quite often clogging up the logs
|
||||
tracing::info!("client error");
|
||||
}
|
||||
_ => {
|
||||
tracing::error!("client error");
|
||||
|
||||
@@ -13,7 +13,9 @@ use figment::Figment;
|
||||
use figment::providers::{Env, Format, Toml};
|
||||
use rustical_dav_push::DavPushController;
|
||||
use rustical_store::auth::AuthenticationProvider;
|
||||
use rustical_store::{AddressbookStore, CalendarStore, CollectionOperation, SubscriptionStore};
|
||||
use rustical_store::{
|
||||
AddressbookStore, CalendarStore, CollectionOperation, PrefixedCalendarStore, SubscriptionStore,
|
||||
};
|
||||
use rustical_store_sqlite::addressbook_store::SqliteAddressbookStore;
|
||||
use rustical_store_sqlite::calendar_store::SqliteCalendarStore;
|
||||
use rustical_store_sqlite::principal_store::SqlitePrincipalStore;
|
||||
@@ -56,7 +58,7 @@ async fn get_data_stores(
|
||||
migrate: bool,
|
||||
config: &DataStoreConfig,
|
||||
) -> Result<(
|
||||
Arc<impl AddressbookStore>,
|
||||
Arc<impl AddressbookStore + PrefixedCalendarStore>,
|
||||
Arc<impl CalendarStore>,
|
||||
Arc<impl SubscriptionStore>,
|
||||
Arc<impl AuthenticationProvider>,
|
||||
@@ -69,7 +71,9 @@ async fn get_data_stores(
|
||||
let (send, recv) = tokio::sync::mpsc::channel(1000);
|
||||
|
||||
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));
|
||||
cal_store.repair_orphans().await?;
|
||||
let subscription_store = Arc::new(SqliteStore::new(db.clone()));
|
||||
let principal_store = Arc::new(SqlitePrincipalStore::new(db));
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user