mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 20:32:48 +00:00
Compare commits
26 Commits
d5c1ddc590
...
v0.11.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef40f5ea8c | ||
|
|
1230e29243 | ||
|
|
1b2296c00a | ||
|
|
ac6ab0ca9a | ||
|
|
6312f52b10 | ||
|
|
ec28cb9d9a | ||
|
|
4b4210b4d7 | ||
|
|
8fadff1b57 | ||
|
|
61a8c32af4 | ||
|
|
a45e0b2efd | ||
|
|
eecc03b7b7 | ||
|
|
e8303b9c82 | ||
|
|
a686286d06 | ||
|
|
d81074de3b | ||
|
|
42386adcfa | ||
|
|
d2f5f7c89b | ||
|
|
15e431ce12 | ||
|
|
96a16951f4 | ||
|
|
a32b766c0c | ||
|
|
7a101b7364 | ||
|
|
57275a10b4 | ||
|
|
af239e34bf | ||
|
|
e99b1d9123 | ||
|
|
e39657eb29 | ||
|
|
607db62859 | ||
|
|
eba377b980 |
12
.sqlx/query-583069cbeba5285c63c2b95e989669d3faed66a75fbfc7cd93e5f64b778f45ab.json
generated
Normal file
12
.sqlx/query-583069cbeba5285c63c2b95e989669d3faed66a75fbfc7cd93e5f64b778f45ab.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "REPLACE INTO davpush_subscriptions (id, topic, expiration, push_resource, public_key, public_key_type, auth_secret) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 7
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "583069cbeba5285c63c2b95e989669d3faed66a75fbfc7cd93e5f64b778f45ab"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "INSERT OR REPLACE INTO davpush_subscriptions (id, topic, expiration, push_resource, public_key, public_key_type, auth_secret) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 7
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6d08d3a014743da9b445ab012437ec11f81fd86d3b02fc1df07a036c6b47ace2"
|
||||
}
|
||||
12
.sqlx/query-72c7c67f4952ad669ecd54d96bbcb717815081f74575f0a65987163faf9fe30a.json
generated
Normal file
12
.sqlx/query-72c7c67f4952ad669ecd54d96bbcb717815081f74575f0a65987163faf9fe30a.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "INSERT INTO birthday_calendars (principal, id, displayname, description, \"order\", color, push_topic)\n VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 7
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "72c7c67f4952ad669ecd54d96bbcb717815081f74575f0a65987163faf9fe30a"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "INSERT INTO birthday_calendars (principal, id, displayname, push_topic)\n VALUES (?, ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "bfdf662cd03e741b7a36f5e2ac01d32ac367c52ce41bd70394f754248b29749c"
|
||||
}
|
||||
325
Cargo.lock
generated
325
Cargo.lock
generated
@@ -139,7 +139,7 @@ dependencies = [
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -175,7 +175,7 @@ checksum = "34921de3d57974069bad483fdfe0ec65d88c4ff892edd1ab4d8b03be0dda1b9b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -310,7 +310,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -542,9 +542,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.46"
|
||||
version = "1.2.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
||||
checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"shlex",
|
||||
@@ -597,9 +597,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.52"
|
||||
version = "4.5.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa8120877db0e5c011242f96806ce3c94e0737ab8108532a76a3300a01db2ab8"
|
||||
checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -607,9 +607,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.52"
|
||||
version = "4.5.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02576b399397b659c26064fbc92a75fede9d18ffd5f80ca1cd74ddab167016e1"
|
||||
checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -626,7 +626,7 @@ dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -668,6 +668,15 @@ version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.18.1"
|
||||
@@ -696,9 +705,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "3.3.0"
|
||||
version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
|
||||
checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d"
|
||||
dependencies = [
|
||||
"crc-catalog",
|
||||
]
|
||||
@@ -770,7 +779,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -779,8 +788,18 @@ version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
"darling_core 0.21.3",
|
||||
"darling_macro 0.21.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"
|
||||
dependencies = [
|
||||
"darling_core 0.23.0",
|
||||
"darling_macro 0.23.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -794,7 +813,20 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"
|
||||
dependencies = [
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -803,9 +835,20 @@ version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_core 0.21.3",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"
|
||||
dependencies = [
|
||||
"darling_core 0.23.0",
|
||||
"quote",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -831,22 +874,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "2.0.1"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
|
||||
checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618"
|
||||
dependencies = [
|
||||
"derive_more-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more-impl"
|
||||
version = "2.0.1"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
|
||||
checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"rustc_version",
|
||||
"syn 2.0.111",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
@@ -870,7 +915,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1207,7 +1252,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1330,7 +1375,7 @@ dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"http",
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
@@ -1356,9 +1401,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.0"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
@@ -1443,12 +1488,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.3.1"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
|
||||
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
@@ -1548,9 +1592,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.18"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56"
|
||||
checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
@@ -1729,12 +1773,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.12.0"
|
||||
version = "2.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
|
||||
checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.0",
|
||||
"hashbrown 0.16.1",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
@@ -1745,6 +1789,17 @@ version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb"
|
||||
|
||||
[[package]]
|
||||
name = "insta"
|
||||
version = "1.44.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5c943d4415edd8153251b6f197de5eb1640e56d84e8d9159bea190421c73698"
|
||||
dependencies = [
|
||||
"console",
|
||||
"once_cell",
|
||||
"similar",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.11.0"
|
||||
@@ -1793,9 +1848,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.82"
|
||||
version = "0.3.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
|
||||
checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
@@ -1821,9 +1876,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.177"
|
||||
version = "0.2.178"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
|
||||
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
@@ -1877,9 +1932,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.28"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
dependencies = [
|
||||
"value-bag",
|
||||
]
|
||||
@@ -1966,9 +2021,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
|
||||
checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@@ -2131,7 +2186,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2356,7 +2411,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"proc-macro2-diagnostics",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2429,7 +2484,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2555,7 +2610,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"version_check",
|
||||
"yansi",
|
||||
]
|
||||
@@ -2580,7 +2635,7 @@ dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2747,7 +2802,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2921,7 +2976,7 @@ dependencies = [
|
||||
"regex",
|
||||
"relative-path",
|
||||
"rustc_version",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
@@ -2933,7 +2988,7 @@ checksum = "b3a8fb4672e840a587a66fc577a5491375df51ddb88f2a2c2a792598c326fe14"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"rand 0.8.5",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2966,7 +3021,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rust-embed-utils",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@@ -3003,7 +3058,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"argon2",
|
||||
@@ -3014,6 +3069,7 @@ dependencies = [
|
||||
"figment",
|
||||
"headers",
|
||||
"http",
|
||||
"insta",
|
||||
"opentelemetry",
|
||||
"opentelemetry-otlp",
|
||||
"opentelemetry-semantic-conventions",
|
||||
@@ -3023,6 +3079,7 @@ dependencies = [
|
||||
"quick-xml",
|
||||
"reqwest",
|
||||
"rpassword",
|
||||
"rstest",
|
||||
"rustical_caldav",
|
||||
"rustical_carddav",
|
||||
"rustical_dav",
|
||||
@@ -3046,7 +3103,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_caldav"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"async-trait",
|
||||
@@ -3060,6 +3117,7 @@ dependencies = [
|
||||
"headers",
|
||||
"http",
|
||||
"ical",
|
||||
"insta",
|
||||
"percent-encoding",
|
||||
"quick-xml",
|
||||
"rstest",
|
||||
@@ -3087,7 +3145,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_carddav"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@@ -3098,6 +3156,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"http",
|
||||
"ical",
|
||||
"insta",
|
||||
"percent-encoding",
|
||||
"quick-xml",
|
||||
"rustical_dav",
|
||||
@@ -3119,7 +3178,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_dav"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@@ -3144,7 +3203,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_dav_push"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@@ -3169,7 +3228,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_frontend"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"askama",
|
||||
"askama_web",
|
||||
@@ -3205,7 +3264,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_ical"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"chrono",
|
||||
@@ -3222,7 +3281,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_oidc"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@@ -3238,7 +3297,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_store"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -3271,7 +3330,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_store_sqlite"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
@@ -3293,7 +3352,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustical_xml"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"quick-xml",
|
||||
"thiserror 2.0.17",
|
||||
@@ -3329,9 +3388,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.13.0"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a"
|
||||
checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c"
|
||||
dependencies = [
|
||||
"web-time",
|
||||
"zeroize",
|
||||
@@ -3456,7 +3515,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3524,15 +3583,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.16.0"
|
||||
version = "3.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10574371d41b0d9b2cff89418eda27da52bcaff2cc8741db26382a77c29131f1"
|
||||
checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"schemars 0.9.0",
|
||||
"schemars 1.1.0",
|
||||
"serde_core",
|
||||
@@ -3543,14 +3602,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.16.0"
|
||||
version = "3.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08a72d8216842fdd57820dc78d840bef99248e35fb2554ff923319e60f2d686b"
|
||||
checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"darling 0.21.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3592,9 +3651,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.6"
|
||||
version = "1.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b"
|
||||
checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -3711,7 +3770,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"hashbrown 0.15.5",
|
||||
"hashlink",
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"log",
|
||||
"memchr",
|
||||
"once_cell",
|
||||
@@ -3738,7 +3797,7 @@ dependencies = [
|
||||
"quote",
|
||||
"sqlx-core",
|
||||
"sqlx-macros-core",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3761,7 +3820,7 @@ dependencies = [
|
||||
"sqlx-mysql",
|
||||
"sqlx-postgres",
|
||||
"sqlx-sqlite",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
@@ -3913,7 +3972,7 @@ dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3935,9 +3994,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.110"
|
||||
version = "2.0.111"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3961,7 +4020,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3990,7 +4049,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4001,7 +4060,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4095,7 +4154,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4150,7 +4209,7 @@ version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
|
||||
dependencies = [
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"serde_core",
|
||||
"serde_spanned 1.0.3",
|
||||
"toml_datetime 0.7.3",
|
||||
@@ -4183,7 +4242,7 @@ version = "0.22.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||
dependencies = [
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"serde",
|
||||
"serde_spanned 0.6.9",
|
||||
"toml_datetime 0.6.11",
|
||||
@@ -4197,7 +4256,7 @@ version = "0.23.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
|
||||
dependencies = [
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"toml_datetime 0.7.3",
|
||||
"toml_parser",
|
||||
"winnow",
|
||||
@@ -4269,7 +4328,7 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"indexmap 2.12.0",
|
||||
"indexmap 2.12.1",
|
||||
"pin-project-lite",
|
||||
"slab",
|
||||
"sync_wrapper",
|
||||
@@ -4298,9 +4357,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.6.6"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
||||
checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytes",
|
||||
@@ -4389,9 +4448,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.41"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
|
||||
checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
@@ -4401,20 +4460,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.30"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
|
||||
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.34"
|
||||
version = "0.1.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
||||
checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
@@ -4452,9 +4511,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.20"
|
||||
version = "0.3.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
|
||||
checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
|
||||
dependencies = [
|
||||
"matchers",
|
||||
"nu-ansi-term",
|
||||
@@ -4566,9 +4625,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.18.1"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
|
||||
checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
"js-sys",
|
||||
@@ -4584,9 +4643,9 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
||||
|
||||
[[package]]
|
||||
name = "value-bag"
|
||||
version = "1.11.1"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5"
|
||||
checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
@@ -4653,9 +4712,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
|
||||
checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -4666,9 +4725,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.55"
|
||||
version = "0.4.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0"
|
||||
checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -4679,9 +4738,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
|
||||
checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -4689,31 +4748,31 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
|
||||
checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
|
||||
checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.82"
|
||||
version = "0.3.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
|
||||
checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -4778,7 +4837,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4789,7 +4848,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5049,9 +5108,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.13"
|
||||
version = "0.7.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
|
||||
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -5070,14 +5129,14 @@ checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
||||
|
||||
[[package]]
|
||||
name = "xml_derive"
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"darling 0.23.0",
|
||||
"heck",
|
||||
"itertools 0.14.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5105,28 +5164,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.27"
|
||||
version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
|
||||
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.27"
|
||||
version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
|
||||
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5146,7 +5205,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@@ -5186,5 +5245,5 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.110",
|
||||
"syn 2.0.111",
|
||||
]
|
||||
|
||||
10
Cargo.toml
10
Cargo.toml
@@ -2,7 +2,7 @@
|
||||
members = ["crates/*"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.10.5"
|
||||
version = "0.11.2"
|
||||
rust-version = "1.91"
|
||||
edition = "2024"
|
||||
description = "A CalDAV server"
|
||||
@@ -133,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",
|
||||
@@ -149,6 +149,12 @@ 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"
|
||||
insta = "1.44"
|
||||
|
||||
[dev-dependencies]
|
||||
rstest.workspace = true
|
||||
rustical_store_sqlite = { workspace = true, features = ["test"] }
|
||||
insta.workspace = true
|
||||
|
||||
[dependencies]
|
||||
rustical_store.workspace = true
|
||||
|
||||
@@ -9,5 +9,7 @@ accepted = [
|
||||
"AGPL-3.0",
|
||||
"GPL-3.0",
|
||||
"MPL-2.0",
|
||||
"AGPL-3.0-or-later",
|
||||
"GPL-3.0-or-later",
|
||||
]
|
||||
workarounds = ["ring", "chrono", "rustls"]
|
||||
|
||||
@@ -13,6 +13,7 @@ rustical_store_sqlite = { workspace = true, features = ["test"] }
|
||||
rstest.workspace = true
|
||||
async-std.workspace = true
|
||||
serde_json.workspace = true
|
||||
insta.workspace = true
|
||||
|
||||
[dependencies]
|
||||
axum.workspace = true
|
||||
|
||||
@@ -16,6 +16,7 @@ pub struct CompFilterElement {
|
||||
pub(crate) time_range: Option<TimeRangeElement>,
|
||||
#[xml(ns = "rustical_dav::namespace::NS_CALDAV", flatten)]
|
||||
pub(crate) prop_filter: Vec<PropFilterElement>,
|
||||
#[allow(clippy::use_self)]
|
||||
#[xml(ns = "rustical_dav::namespace::NS_CALDAV", flatten)]
|
||||
pub(crate) comp_filter: Vec<CompFilterElement>,
|
||||
|
||||
|
||||
@@ -188,9 +188,6 @@ impl Resource for CalendarResource {
|
||||
}
|
||||
|
||||
fn set_prop(&mut self, prop: Self::Prop) -> Result<(), rustical_dav::Error> {
|
||||
if self.read_only {
|
||||
return Err(rustical_dav::Error::PropReadOnly);
|
||||
}
|
||||
match prop {
|
||||
CalendarPropWrapper::Calendar(prop) => match prop {
|
||||
CalendarProp::CalendarColor(color) => {
|
||||
@@ -263,9 +260,6 @@ impl Resource for CalendarResource {
|
||||
}
|
||||
|
||||
fn remove_prop(&mut self, prop: &CalendarPropWrapperName) -> Result<(), rustical_dav::Error> {
|
||||
if self.read_only {
|
||||
return Err(rustical_dav::Error::PropReadOnly);
|
||||
}
|
||||
match prop {
|
||||
CalendarPropWrapperName::Calendar(prop) => match prop {
|
||||
CalendarPropName::CalendarColor => {
|
||||
|
||||
@@ -6,7 +6,7 @@ use rustical_store::auth::PrincipalType;
|
||||
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
|
||||
use strum_macros::VariantArray;
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
|
||||
#[xml(unit_variants_ident = "PrincipalPropName")]
|
||||
pub enum PrincipalProp {
|
||||
// Scheduling Extensions to CalDAV (RFC 6638)
|
||||
@@ -34,17 +34,17 @@ pub enum PrincipalProp {
|
||||
CalendarHomeSet(CalendarHomeSet),
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct CalendarHomeSet(#[xml(ty = "untagged", flatten)] pub Vec<HrefElement>);
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
|
||||
#[xml(unit_variants_ident = "PrincipalPropWrapperName", untagged)]
|
||||
pub enum PrincipalPropWrapper {
|
||||
Principal(PrincipalProp),
|
||||
Common(CommonPropertiesProp),
|
||||
}
|
||||
|
||||
#[derive(XmlSerialize, PartialEq, Eq, Clone, VariantArray)]
|
||||
#[derive(XmlSerialize, PartialEq, Eq, Debug, Clone, VariantArray)]
|
||||
pub enum ReportMethod {
|
||||
// We don't actually support principal-match
|
||||
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
---
|
||||
source: crates/caldav/src/principal/tests.rs
|
||||
expression: response
|
||||
---
|
||||
ResponseElement {
|
||||
href: "/caldav/principal/user/",
|
||||
status: None,
|
||||
propstat: [
|
||||
Normal(
|
||||
PropstatElement {
|
||||
prop: PropTagWrapper(
|
||||
[
|
||||
Principal(
|
||||
CalendarUserType(
|
||||
Individual,
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
CalendarUserAddressSet(
|
||||
HrefElement {
|
||||
href: "/caldav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
PrincipalUrl(
|
||||
HrefElement {
|
||||
href: "/caldav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
GroupMembership(
|
||||
GroupMembership(
|
||||
[
|
||||
HrefElement {
|
||||
href: "/caldav/principal/group/",
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
GroupMemberSet(
|
||||
GroupMemberSet(
|
||||
[],
|
||||
),
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
AlternateUriSet,
|
||||
),
|
||||
Principal(
|
||||
SupportedReportSet(
|
||||
SupportedReportSet {
|
||||
supported_report: [
|
||||
ReportWrapper {
|
||||
report: PrincipalMatch,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
CalendarHomeSet(
|
||||
CalendarHomeSet(
|
||||
[
|
||||
HrefElement {
|
||||
href: "/caldav/principal/group/",
|
||||
},
|
||||
HrefElement {
|
||||
href: "/caldav/principal/user/",
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Resourcetype(
|
||||
Resourcetype(
|
||||
[
|
||||
ResourcetypeInner(
|
||||
Some(
|
||||
Namespace("DAV:"),
|
||||
),
|
||||
"collection",
|
||||
),
|
||||
ResourcetypeInner(
|
||||
Some(
|
||||
Namespace("DAV:"),
|
||||
),
|
||||
"principal",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Displayname(
|
||||
Some(
|
||||
"user",
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
CurrentUserPrincipal(
|
||||
HrefElement {
|
||||
href: "/caldav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Common(
|
||||
CurrentUserPrivilegeSet(
|
||||
UserPrivilegeSet {
|
||||
privileges: {
|
||||
All,
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Owner(
|
||||
Some(
|
||||
HrefElement {
|
||||
href: "/caldav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
status: 200,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
source: crates/caldav/src/principal/tests.rs
|
||||
expression: response.serialize_to_string().unwrap()
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<response xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
|
||||
<href>/caldav/principal/user/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<CAL:calendar-user-type>INDIVIDUAL</CAL:calendar-user-type>
|
||||
<CAL:calendar-user-address-set>
|
||||
<href>/caldav/principal/user/</href>
|
||||
</CAL:calendar-user-address-set>
|
||||
<principal-URL>
|
||||
<href>/caldav/principal/user/</href>
|
||||
</principal-URL>
|
||||
<group-membership>
|
||||
<href>/caldav/principal/group/</href>
|
||||
</group-membership>
|
||||
<group-member-set>
|
||||
</group-member-set>
|
||||
<alternate-URI-set/>
|
||||
<supported-report-set>
|
||||
<supported-report>
|
||||
<report>
|
||||
<principal-match/>
|
||||
</report>
|
||||
</supported-report>
|
||||
</supported-report-set>
|
||||
<CAL:calendar-home-set>
|
||||
<href>/caldav/principal/group/</href>
|
||||
<href>/caldav/principal/user/</href>
|
||||
</CAL:calendar-home-set>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
<principal/>
|
||||
</resourcetype>
|
||||
<displayname>user</displayname>
|
||||
<current-user-principal>
|
||||
<href>/caldav/principal/user/</href>
|
||||
</current-user-principal>
|
||||
<current-user-privilege-set>
|
||||
<privilege>
|
||||
<all/>
|
||||
</privilege>
|
||||
</current-user-privilege-set>
|
||||
<owner>
|
||||
<href>/caldav/principal/user/</href>
|
||||
</owner>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
source: crates/caldav/src/principal/tests.rs
|
||||
expression: propfind
|
||||
---
|
||||
PropfindElement {
|
||||
prop: Allprop,
|
||||
include: None,
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
CalDavPrincipalUri,
|
||||
principal::{PrincipalResource, PrincipalResourceService},
|
||||
@@ -14,6 +12,7 @@ use rustical_store_sqlite::{
|
||||
tests::{get_test_calendar_store, get_test_principal_store, get_test_subscription_store},
|
||||
};
|
||||
use rustical_xml::XmlSerializeRoot;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
@@ -64,6 +63,8 @@ async fn test_propfind() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
insta::assert_debug_snapshot!(propfind);
|
||||
|
||||
let principal = Principal {
|
||||
id: "user".to_string(),
|
||||
displayname: None,
|
||||
@@ -88,5 +89,6 @@ async fn test_propfind() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let _output = response.serialize_to_string().unwrap();
|
||||
insta::assert_debug_snapshot!(response);
|
||||
insta::assert_snapshot!(response.serialize_to_string().unwrap());
|
||||
}
|
||||
|
||||
@@ -35,3 +35,6 @@ percent-encoding.workspace = true
|
||||
ical.workspace = true
|
||||
strum.workspace = true
|
||||
strum_macros.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
insta.workspace = true
|
||||
|
||||
@@ -3,3 +3,5 @@ pub mod prop;
|
||||
pub mod resource;
|
||||
mod service;
|
||||
pub use service::*;
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
@@ -6,7 +6,7 @@ use rustical_dav_push::DavPushExtensionProp;
|
||||
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
|
||||
use strum_macros::VariantArray;
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
|
||||
#[xml(unit_variants_ident = "AddressbookPropName")]
|
||||
pub enum AddressbookProp {
|
||||
// CardDAV (RFC 6352)
|
||||
@@ -20,7 +20,7 @@ pub enum AddressbookProp {
|
||||
MaxResourceSize(i64),
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
|
||||
#[xml(unit_variants_ident = "AddressbookPropWrapperName", untagged)]
|
||||
pub enum AddressbookPropWrapper {
|
||||
Addressbook(AddressbookProp),
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
---
|
||||
source: crates/carddav/src/addressbook/tests.rs
|
||||
expression: response
|
||||
---
|
||||
ResponseElement {
|
||||
href: "/carddav/principal/user/yeet/",
|
||||
status: None,
|
||||
propstat: [
|
||||
Normal(
|
||||
PropstatElement {
|
||||
prop: PropTagWrapper(
|
||||
[
|
||||
Addressbook(
|
||||
AddressbookDescription(
|
||||
None,
|
||||
),
|
||||
),
|
||||
Addressbook(
|
||||
SupportedAddressData(
|
||||
SupportedAddressData {
|
||||
address_data_type: [
|
||||
AddressDataType {
|
||||
content_type: "text/vcard",
|
||||
version: "3.0",
|
||||
},
|
||||
AddressDataType {
|
||||
content_type: "text/vcard",
|
||||
version: "4.0",
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
),
|
||||
Addressbook(
|
||||
SupportedReportSet(
|
||||
SupportedReportSet {
|
||||
supported_report: [
|
||||
ReportWrapper {
|
||||
report: AddressbookMultiget,
|
||||
},
|
||||
ReportWrapper {
|
||||
report: SyncCollection,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
),
|
||||
Addressbook(
|
||||
MaxResourceSize(
|
||||
10000000,
|
||||
),
|
||||
),
|
||||
SyncToken(
|
||||
SyncToken(
|
||||
"github.com/lennart-k/rustical/ns/0",
|
||||
),
|
||||
),
|
||||
SyncToken(
|
||||
Getctag(
|
||||
"github.com/lennart-k/rustical/ns/0",
|
||||
),
|
||||
),
|
||||
DavPush(
|
||||
Transports(
|
||||
Transports {
|
||||
transports: [
|
||||
WebPush,
|
||||
],
|
||||
},
|
||||
),
|
||||
),
|
||||
DavPush(
|
||||
Topic(
|
||||
"asdasd",
|
||||
),
|
||||
),
|
||||
DavPush(
|
||||
SupportedTriggers(
|
||||
SupportedTriggers(
|
||||
[
|
||||
ContentUpdate(
|
||||
ContentUpdate(
|
||||
One,
|
||||
),
|
||||
),
|
||||
PropertyUpdate(
|
||||
PropertyUpdate(
|
||||
One,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Resourcetype(
|
||||
Resourcetype(
|
||||
[
|
||||
ResourcetypeInner(
|
||||
Some(
|
||||
Namespace("DAV:"),
|
||||
),
|
||||
"collection",
|
||||
),
|
||||
ResourcetypeInner(
|
||||
Some(
|
||||
Namespace("urn:ietf:params:xml:ns:carddav"),
|
||||
),
|
||||
"addressbook",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Displayname(
|
||||
None,
|
||||
),
|
||||
),
|
||||
Common(
|
||||
CurrentUserPrincipal(
|
||||
HrefElement {
|
||||
href: "/carddav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Common(
|
||||
CurrentUserPrivilegeSet(
|
||||
UserPrivilegeSet {
|
||||
privileges: {
|
||||
All,
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Owner(
|
||||
Some(
|
||||
HrefElement {
|
||||
href: "/carddav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
status: 200,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source: crates/carddav/src/addressbook/tests.rs
|
||||
expression: response.serialize_to_string().unwrap()
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<response xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
|
||||
<href>/carddav/principal/user/yeet/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<CARD:supported-address-data>
|
||||
<CARD:address-data-type content-type="text/vcard" version="3.0"/>
|
||||
<CARD:address-data-type content-type="text/vcard" version="4.0"/>
|
||||
</CARD:supported-address-data>
|
||||
<supported-report-set>
|
||||
<supported-report>
|
||||
<report>
|
||||
<CARD:addressbook-multiget/>
|
||||
</report>
|
||||
</supported-report>
|
||||
<supported-report>
|
||||
<report>
|
||||
<sync-collection/>
|
||||
</report>
|
||||
</supported-report>
|
||||
</supported-report-set>
|
||||
<max-resource-size>10000000</max-resource-size>
|
||||
<sync-token>github.com/lennart-k/rustical/ns/0</sync-token>
|
||||
<CS:getctag>github.com/lennart-k/rustical/ns/0</CS:getctag>
|
||||
<PUSH:transports>
|
||||
<PUSH:web-push/>
|
||||
</PUSH:transports>
|
||||
<PUSH:topic>asdasd</PUSH:topic>
|
||||
<PUSH:supported-triggers>
|
||||
<PUSH:content-update>
|
||||
<depth>1</depth>
|
||||
</PUSH:content-update>
|
||||
<PUSH:property-update>
|
||||
<depth>1</depth>
|
||||
</PUSH:property-update>
|
||||
</PUSH:supported-triggers>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
<CARD:addressbook/>
|
||||
</resourcetype>
|
||||
<current-user-principal>
|
||||
<href>/carddav/principal/user/</href>
|
||||
</current-user-principal>
|
||||
<current-user-privilege-set>
|
||||
<privilege>
|
||||
<all/>
|
||||
</privilege>
|
||||
</current-user-privilege-set>
|
||||
<owner>
|
||||
<href>/carddav/principal/user/</href>
|
||||
</owner>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
source: crates/carddav/src/addressbook/tests.rs
|
||||
expression: propfind
|
||||
---
|
||||
PropfindElement {
|
||||
prop: Allprop,
|
||||
include: None,
|
||||
}
|
||||
49
crates/carddav/src/addressbook/tests.rs
Normal file
49
crates/carddav/src/addressbook/tests.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use crate::{CardDavPrincipalUri, addressbook::resource::AddressbookResource};
|
||||
use rustical_dav::resource::Resource;
|
||||
use rustical_store::{Addressbook, auth::Principal};
|
||||
use rustical_xml::XmlSerializeRoot;
|
||||
|
||||
#[test]
|
||||
fn test_propfind() {
|
||||
let propfind = AddressbookResource::parse_propfind(
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?><propfind xmlns="DAV:"><allprop/></propfind>"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
insta::assert_debug_snapshot!(propfind);
|
||||
|
||||
let principal = Principal {
|
||||
id: "user".to_string(),
|
||||
displayname: None,
|
||||
principal_type: rustical_store::auth::PrincipalType::Individual,
|
||||
password: None,
|
||||
memberships: vec!["group".to_string()],
|
||||
};
|
||||
|
||||
let addressbook = Addressbook {
|
||||
id: "yeet".to_string(),
|
||||
principal: "user".to_string(),
|
||||
displayname: None,
|
||||
description: None,
|
||||
deleted_at: None,
|
||||
synctoken: 0,
|
||||
push_topic: "asdasd".to_string(),
|
||||
};
|
||||
|
||||
let resource = AddressbookResource(addressbook.clone());
|
||||
let response = resource
|
||||
.propfind(
|
||||
&format!(
|
||||
"/carddav/principal/{}/{}",
|
||||
addressbook.principal, addressbook.id
|
||||
),
|
||||
&propfind.prop,
|
||||
propfind.include.as_ref(),
|
||||
&CardDavPrincipalUri("/carddav"),
|
||||
&principal,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
insta::assert_debug_snapshot!(response);
|
||||
insta::assert_snapshot!(response.serialize_to_string().unwrap());
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
use axum::response::IntoResponse;
|
||||
use http::StatusCode;
|
||||
use tracing::error;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
|
||||
@@ -11,11 +11,13 @@ mod service;
|
||||
pub use service::*;
|
||||
mod prop;
|
||||
pub use prop::*;
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PrincipalResource {
|
||||
principal: Principal,
|
||||
members: Vec<String>,
|
||||
pub principal: Principal,
|
||||
pub members: Vec<String>,
|
||||
}
|
||||
|
||||
impl ResourceName for PrincipalResource {
|
||||
|
||||
@@ -4,7 +4,7 @@ use rustical_dav::{
|
||||
};
|
||||
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
|
||||
#[xml(unit_variants_ident = "PrincipalPropName")]
|
||||
pub enum PrincipalProp {
|
||||
// WebDAV Access Control (RFC 3744)
|
||||
@@ -27,10 +27,10 @@ pub enum PrincipalProp {
|
||||
PrincipalAddress(Option<HrefElement>),
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct AddressbookHomeSet(#[xml(ty = "untagged", flatten)] pub Vec<HrefElement>);
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
|
||||
#[xml(unit_variants_ident = "PrincipalPropWrapperName", untagged)]
|
||||
pub enum PrincipalPropWrapper {
|
||||
Principal(PrincipalProp),
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
---
|
||||
source: crates/carddav/src/principal/tests.rs
|
||||
expression: response
|
||||
---
|
||||
ResponseElement {
|
||||
href: "/carddav/principal/user/",
|
||||
status: None,
|
||||
propstat: [
|
||||
Normal(
|
||||
PropstatElement {
|
||||
prop: PropTagWrapper(
|
||||
[
|
||||
Principal(
|
||||
PrincipalUrl(
|
||||
HrefElement {
|
||||
href: "/carddav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
GroupMembership(
|
||||
GroupMembership(
|
||||
[
|
||||
HrefElement {
|
||||
href: "/carddav/principal/group/",
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
GroupMemberSet(
|
||||
GroupMemberSet(
|
||||
[],
|
||||
),
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
AlternateUriSet,
|
||||
),
|
||||
Principal(
|
||||
PrincipalCollectionSet(
|
||||
HrefElement {
|
||||
href: "/carddav/principal/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
AddressbookHomeSet(
|
||||
AddressbookHomeSet(
|
||||
[
|
||||
HrefElement {
|
||||
href: "/carddav/principal/group/",
|
||||
},
|
||||
HrefElement {
|
||||
href: "/carddav/principal/user/",
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Principal(
|
||||
PrincipalAddress(
|
||||
None,
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Resourcetype(
|
||||
Resourcetype(
|
||||
[
|
||||
ResourcetypeInner(
|
||||
Some(
|
||||
Namespace("DAV:"),
|
||||
),
|
||||
"collection",
|
||||
),
|
||||
ResourcetypeInner(
|
||||
Some(
|
||||
Namespace("DAV:"),
|
||||
),
|
||||
"principal",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Displayname(
|
||||
Some(
|
||||
"user",
|
||||
),
|
||||
),
|
||||
),
|
||||
Common(
|
||||
CurrentUserPrincipal(
|
||||
HrefElement {
|
||||
href: "/carddav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
Common(
|
||||
CurrentUserPrivilegeSet(
|
||||
UserPrivilegeSet {
|
||||
privileges: {
|
||||
All,
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
Common(
|
||||
Owner(
|
||||
Some(
|
||||
HrefElement {
|
||||
href: "/carddav/principal/user/",
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
status: 200,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
source: crates/carddav/src/principal/tests.rs
|
||||
expression: response.serialize_to_string().unwrap()
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<response xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
|
||||
<href>/carddav/principal/user/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<principal-URL>
|
||||
<href>/carddav/principal/user/</href>
|
||||
</principal-URL>
|
||||
<group-membership>
|
||||
<href>/carddav/principal/group/</href>
|
||||
</group-membership>
|
||||
<group-member-set>
|
||||
</group-member-set>
|
||||
<alternate-URI-set/>
|
||||
<principal-collection-set>
|
||||
<href>/carddav/principal/</href>
|
||||
</principal-collection-set>
|
||||
<CARD:addressbook-home-set>
|
||||
<href>/carddav/principal/group/</href>
|
||||
<href>/carddav/principal/user/</href>
|
||||
</CARD:addressbook-home-set>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
<principal/>
|
||||
</resourcetype>
|
||||
<displayname>user</displayname>
|
||||
<current-user-principal>
|
||||
<href>/carddav/principal/user/</href>
|
||||
</current-user-principal>
|
||||
<current-user-privilege-set>
|
||||
<privilege>
|
||||
<all/>
|
||||
</privilege>
|
||||
</current-user-privilege-set>
|
||||
<owner>
|
||||
<href>/carddav/principal/user/</href>
|
||||
</owner>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
source: crates/carddav/src/principal/tests.rs
|
||||
expression: propfind
|
||||
---
|
||||
PropfindElement {
|
||||
prop: Allprop,
|
||||
include: None,
|
||||
}
|
||||
41
crates/carddav/src/principal/tests.rs
Normal file
41
crates/carddav/src/principal/tests.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use rustical_dav::resource::Resource;
|
||||
use rustical_store::auth::Principal;
|
||||
use rustical_xml::XmlSerializeRoot;
|
||||
|
||||
use crate::{CardDavPrincipalUri, principal::PrincipalResource};
|
||||
|
||||
#[test]
|
||||
fn test_propfind() {
|
||||
let propfind = PrincipalResource::parse_propfind(
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?><propfind xmlns="DAV:"><allprop/></propfind>"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
insta::assert_debug_snapshot!(propfind);
|
||||
|
||||
let principal = Principal {
|
||||
id: "user".to_string(),
|
||||
displayname: None,
|
||||
principal_type: rustical_store::auth::PrincipalType::Individual,
|
||||
password: None,
|
||||
memberships: vec!["group".to_string()],
|
||||
};
|
||||
|
||||
let resource = PrincipalResource {
|
||||
principal: principal.clone(),
|
||||
members: vec![],
|
||||
};
|
||||
|
||||
let response = resource
|
||||
.propfind(
|
||||
&format!("/carddav/principal/{}", principal.id),
|
||||
&propfind.prop,
|
||||
propfind.include.as_ref(),
|
||||
&CardDavPrincipalUri("/carddav"),
|
||||
&principal,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
insta::assert_debug_snapshot!(response);
|
||||
insta::assert_snapshot!(response.serialize_to_string().unwrap());
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, PropName, EnumVariants)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Debug, Clone, PropName, EnumVariants)]
|
||||
#[xml(unit_variants_ident = "CommonPropertiesPropName")]
|
||||
pub enum CommonPropertiesProp {
|
||||
// WebDAV (RFC 2518)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, PropName, EnumVariants)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, PropName, EnumVariants, Debug)]
|
||||
#[xml(unit_variants_ident = "SyncTokenExtensionPropName")]
|
||||
pub enum SyncTokenExtensionProp {
|
||||
// Collection Synchronization (RFC 6578)
|
||||
|
||||
@@ -88,7 +88,7 @@ pub async fn route_proppatch<R: ResourceService>(
|
||||
.get_resource(path_components, false)
|
||||
.await?;
|
||||
let privileges = resource.get_user_privileges(principal)?;
|
||||
if !privileges.has(&UserPrivilege::Write) {
|
||||
if !privileges.has(&UserPrivilege::WriteProperties) {
|
||||
return Err(Error::Unauthorized.into());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::xml::HrefElement;
|
||||
use rustical_xml::{XmlDeserialize, XmlSerialize};
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct GroupMembership(#[xml(ty = "untagged", flatten)] pub Vec<HrefElement>);
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct GroupMemberSet(#[xml(ty = "untagged", flatten)] pub Vec<HrefElement>);
|
||||
|
||||
@@ -3,9 +3,9 @@ use headers::{CacheControl, ContentType, HeaderMapExt};
|
||||
use http::StatusCode;
|
||||
use quick_xml::name::Namespace;
|
||||
use rustical_xml::{XmlRootTag, XmlSerialize, XmlSerializeRoot};
|
||||
use std::collections::HashMap;
|
||||
use std::{collections::HashMap, fmt::Debug};
|
||||
|
||||
#[derive(XmlSerialize)]
|
||||
#[derive(XmlSerialize, Debug)]
|
||||
pub struct PropTagWrapper<T: XmlSerialize>(#[xml(flatten, ty = "untagged")] pub Vec<T>);
|
||||
|
||||
// RFC 2518
|
||||
@@ -30,7 +30,7 @@ fn xml_serialize_status(
|
||||
XmlSerialize::serialize(&format!("HTTP/1.1 {status}"), ns, tag, namespaces, writer)
|
||||
}
|
||||
|
||||
#[derive(XmlSerialize)]
|
||||
#[derive(XmlSerialize, Debug)]
|
||||
#[xml(untagged)]
|
||||
pub enum PropstatWrapper<T: XmlSerialize> {
|
||||
Normal(PropstatElement<PropTagWrapper<T>>),
|
||||
@@ -40,7 +40,7 @@ pub enum PropstatWrapper<T: XmlSerialize> {
|
||||
// RFC 2518
|
||||
// <!ELEMENT response (href, ((href*, status)|(propstat+)),
|
||||
// responsedescription?) >
|
||||
#[derive(XmlSerialize, XmlRootTag)]
|
||||
#[derive(XmlSerialize, XmlRootTag, Debug)]
|
||||
#[xml(ns = "crate::namespace::NS_DAV", root = "response")]
|
||||
#[xml(ns_prefix(
|
||||
crate::namespace::NS_DAV = "",
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::{ContentUpdate, PropertyUpdate, SupportedTriggers, Transports, Trigge
|
||||
use rustical_dav::header::Depth;
|
||||
use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, PropName, EnumVariants)]
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, PropName, EnumVariants, Debug)]
|
||||
#[xml(unit_variants_ident = "DavPushExtensionPropName")]
|
||||
pub enum DavPushExtensionProp {
|
||||
// WebDav Push
|
||||
|
||||
@@ -22,7 +22,7 @@ impl Default for Transports {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(XmlSerialize, XmlDeserialize, PartialEq, Eq, Clone)]
|
||||
#[derive(XmlSerialize, XmlDeserialize, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct SupportedTriggers(#[xml(flatten, ty = "untagged")] pub Vec<Trigger>);
|
||||
|
||||
#[derive(XmlSerialize, XmlDeserialize, PartialEq, Eq, Debug, Clone)]
|
||||
|
||||
@@ -36,27 +36,27 @@ export class CreateAddressbookForm extends LitElement {
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
principal (for group addressbooks)
|
||||
<select name="principal" value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
<select .value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option .value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map(membership => html`
|
||||
<option value=${membership}>${membership}</option>
|
||||
<option .value=${membership}>${membership}</option>
|
||||
`)}
|
||||
</select>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.addr_id} @change=${e => this.addr_id = e.target.value} />
|
||||
<input type="text" .value=${this.addr_id} @change=${e => this.addr_id = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
<input type="text" .value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" @change=${e => this.description = e.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<button type="submit">Create</button>
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
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-birthday-calendar-form")
|
||||
export class CreateCalendarForm extends LitElement {
|
||||
protected override createRenderRoot() {
|
||||
return this
|
||||
}
|
||||
|
||||
@property()
|
||||
principal: string = ''
|
||||
@property()
|
||||
addr_id: string = ''
|
||||
@property()
|
||||
displayname: string = ''
|
||||
@property()
|
||||
description: string = ''
|
||||
@property()
|
||||
color: string = ''
|
||||
|
||||
dialog: Ref<HTMLDialogElement> = createRef()
|
||||
form: Ref<HTMLFormElement> = createRef()
|
||||
@property()
|
||||
timezones: Array<String> = []
|
||||
|
||||
override render() {
|
||||
return html`
|
||||
<button @click=${() => this.dialog.value.showModal()}>Create birthday calendar</button>
|
||||
<dialog ${ref(this.dialog)}>
|
||||
<h3>Create calendar</h3>
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" .value=${this.displayname} required @change=${e => this.displayname = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Color
|
||||
<input type="color" .value=${this.color} @change=${e => this.color = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<button type="submit">Create</button>
|
||||
<button type="submit" @click=${event => { event.preventDefault(); this.dialog.value.close(); this.form.value.reset() }} class="cancel">Cancel</button>
|
||||
</form>
|
||||
</dialog>
|
||||
`
|
||||
}
|
||||
|
||||
async submit(e: SubmitEvent) {
|
||||
e.preventDefault()
|
||||
if (!this.addr_id) {
|
||||
alert("Empty id")
|
||||
return
|
||||
}
|
||||
if (!this.displayname) {
|
||||
alert("Empty displayname")
|
||||
return
|
||||
}
|
||||
|
||||
let response = await fetch(`/caldav/principal/${this.principal}/_birthdays_${this.addr_id}`, {
|
||||
method: 'MKCOL',
|
||||
headers: {
|
||||
'Content-Type': 'application/xml'
|
||||
},
|
||||
body: `
|
||||
<mkcol xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CS="http://calendarserver.org/ns/" xmlns:ICAL="http://apple.com/ns/ical/">
|
||||
<set>
|
||||
<prop>
|
||||
<displayname>${escapeXml(this.displayname)}</displayname>
|
||||
${this.description ? `<CAL:calendar-description>${escapeXml(this.description)}</CAL:calendar-description>` : ''}
|
||||
${this.color ? `<ICAL:calendar-color>${escapeXml(this.color)}</ICAL:calendar-color>` : ''}
|
||||
<CAL:supported-calendar-component-set>
|
||||
<CAL:comp name="VEVENT" />
|
||||
</CAL:supported-calendar-component-set>
|
||||
</prop>
|
||||
</set>
|
||||
</mkcol>
|
||||
`
|
||||
})
|
||||
|
||||
if (response.status >= 400) {
|
||||
alert(`Error ${response.status}: ${await response.text()}`)
|
||||
return null
|
||||
}
|
||||
window.location.reload()
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'create-calendar-form': CreateCalendarForm
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,30 @@
|
||||
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 { escapeXml, SVG_ICON_CALENDAR, SVG_ICON_INTERNET } from ".";
|
||||
import { getTimezones } from "./timezones.ts";
|
||||
|
||||
@customElement("create-calendar-form")
|
||||
export class CreateCalendarForm extends LitElement {
|
||||
constructor() {
|
||||
super()
|
||||
this.resetForm()
|
||||
this.fetchTimezones()
|
||||
}
|
||||
|
||||
resetForm() {
|
||||
this.form.value?.reset()
|
||||
this.principal = this.user
|
||||
this.cal_id = self.crypto.randomUUID()
|
||||
this.displayname = ''
|
||||
this.description = ''
|
||||
this.timezone_id = ''
|
||||
this.color = ''
|
||||
this.isSubscription = false
|
||||
this.subscriptionUrl = null
|
||||
this.components = new Set(["VEVENT", "VTODO"])
|
||||
}
|
||||
|
||||
async fetchTimezones() {
|
||||
this.timezones = await getTimezones()
|
||||
}
|
||||
@@ -22,23 +36,23 @@ export class CreateCalendarForm extends LitElement {
|
||||
@property()
|
||||
user: string = ''
|
||||
@property()
|
||||
principal: string = ''
|
||||
principal: string
|
||||
@property()
|
||||
cal_id: string = self.crypto.randomUUID()
|
||||
cal_id: string
|
||||
@property()
|
||||
displayname: string = ''
|
||||
displayname: string
|
||||
@property()
|
||||
description: string = ''
|
||||
description: string
|
||||
@property()
|
||||
timezone_id: string = ''
|
||||
timezone_id: string
|
||||
@property()
|
||||
color: string = ''
|
||||
color: string
|
||||
@property()
|
||||
isSubscription: boolean = false
|
||||
isSubscription: boolean
|
||||
@property()
|
||||
subscriptionUrl: string = ''
|
||||
subscriptionUrl: string
|
||||
@property()
|
||||
components: Set<"VEVENT" | "VTODO" | "VJOURNAL"> = new Set()
|
||||
components: Set<"VEVENT" | "VTODO" | "VJOURNAL">
|
||||
|
||||
dialog: Ref<HTMLDialogElement> = createRef()
|
||||
form: Ref<HTMLFormElement> = createRef()
|
||||
@@ -47,13 +61,13 @@ export class CreateCalendarForm extends LitElement {
|
||||
|
||||
override render() {
|
||||
return html`
|
||||
<button @click=${() => this.dialog.value.showModal()}>Create calendar</button>
|
||||
<dialog ${ref(this.dialog)}>
|
||||
<button @click=${e => this.dialog.value.showModal()}>Create calendar</button>
|
||||
<dialog ${ref(this.dialog)} @close=${e => this.resetForm()}>
|
||||
<h3>Create calendar</h3>
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
principal (for group calendars)
|
||||
<select name="principal" value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<select required value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map(membership => html`
|
||||
<option value=${membership}>${membership}</option>
|
||||
@@ -63,17 +77,17 @@ export class CreateCalendarForm extends LitElement {
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.cal_id} @change=${e => this.cal_id = e.target.value} />
|
||||
<input type="text" required .value=${this.cal_id} @change=${e => this.cal_id = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
<input type="text" required .value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Timezone (optional)
|
||||
<select name="timezone" .value=${this.timezone_id} @change=${e => this.timezone_id = e.target.value}>
|
||||
<select .value=${this.timezone_id} @change=${e => this.timezone_id = e.target.value}>
|
||||
<option value="">No timezone</option>
|
||||
${this.timezones.map(timezone => html`
|
||||
<option value=${timezone} ?selected=${timezone === this.timezone_id}>${timezone}</option>
|
||||
@@ -83,45 +97,57 @@ export class CreateCalendarForm extends LitElement {
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" @change=${e => this.description = e.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Color
|
||||
<input type="color" name="color" @change=${e => this.color = e.target.value} />
|
||||
<input type="color" .value=${this.color} @change=${e => this.color = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<label>
|
||||
Calendar is subscription to external calendar
|
||||
<input type="checkbox" name="is_subscription" @change=${e => this.isSubscription = e.target.checked} />
|
||||
</label>
|
||||
<label>Type</label>
|
||||
<div class="tab-radio">
|
||||
<label>
|
||||
<input type="radio" name="type" .checked=${!this.isSubscription} @change=${e => this.isSubscription = false}></input>
|
||||
${SVG_ICON_CALENDAR}
|
||||
Calendar
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="type" .checked=${this.isSubscription} @change=${e => this.isSubscription = true}></input>
|
||||
${SVG_ICON_INTERNET}
|
||||
webCal Subscription
|
||||
</label>
|
||||
</div>
|
||||
<br>
|
||||
${this.isSubscription ? html`
|
||||
<label>
|
||||
Subscription URL
|
||||
<input type="text" name="subscription_url" @change=${e => this.subscriptionUrl = e.target.value} />
|
||||
<input type="text" pattern="https://.*" .required=${this.isSubscription} .value=${this.subscriptionUrl} @change=${e => this.subscriptionUrl = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
`: html``}
|
||||
<br>
|
||||
${["VEVENT", "VTODO", "VJOURNAL"].map(comp => html`
|
||||
<label>
|
||||
Support ${comp}
|
||||
<input type="checkbox" value=${comp} @change=${e => e.target.checked ? this.components.add(e.target.value) : this.components.delete(e.target.value)} />
|
||||
</label>
|
||||
<br>
|
||||
`)}
|
||||
|
||||
<label>Components</label>
|
||||
<div>
|
||||
${["VEVENT", "VTODO", "VJOURNAL"].map(comp => html`
|
||||
<label>
|
||||
Support ${comp}
|
||||
<input type="checkbox" .value=${comp} @change=${e => e.target.checked ? this.components.add(e.target.value) : this.components.delete(e.target.value)} .checked=${this.components.has(comp)} />
|
||||
</label>
|
||||
<br>
|
||||
`)}
|
||||
</div>
|
||||
<br>
|
||||
<button type="submit">Create</button>
|
||||
<button type="submit" @click=${event => { event.preventDefault(); this.dialog.value.close(); this.form.value.reset() }} class="cancel">Cancel</button>
|
||||
<button type="submit" @click=${event => { event.preventDefault(); this.dialog.value.close();}} class="cancel">Cancel</button>
|
||||
</form>
|
||||
</dialog>
|
||||
`
|
||||
}
|
||||
|
||||
async submit(e: SubmitEvent) {
|
||||
console.log(this.displayname)
|
||||
e.preventDefault()
|
||||
if (!this.cal_id) {
|
||||
alert("Empty id")
|
||||
@@ -135,6 +161,10 @@ export class CreateCalendarForm extends LitElement {
|
||||
alert("No calendar components selected")
|
||||
return
|
||||
}
|
||||
if (this.isSubscription && !this.subscriptionUrl) {
|
||||
alert("Invalid subscription url")
|
||||
return
|
||||
}
|
||||
|
||||
let response = await fetch(`/caldav/principal/${this.principal || this.user}/${this.cal_id}`, {
|
||||
method: 'MKCOL',
|
||||
|
||||
@@ -34,12 +34,12 @@ export class EditAddressbookForm extends LitElement {
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" .value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
<input type="text" .value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<button type="submit">Submit</button>
|
||||
|
||||
@@ -53,12 +53,12 @@ export class EditCalendarForm extends LitElement {
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" .value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
<input type="text" required .value=${this.displayname} @change=${e => this.displayname = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Timezone (optional)
|
||||
<select name="timezone" .value=${this.timezone_id} @change=${e => this.timezone_id = e.target.value}>
|
||||
<select .value=${this.timezone_id} @change=${e => this.timezone_id = e.target.value}>
|
||||
<option value="">No timezone</option>
|
||||
${this.timezones.map(timezone => html`
|
||||
<option value=${timezone} ?selected=${timezone === this.timezone_id}>${timezone}</option>
|
||||
@@ -68,18 +68,18 @@ export class EditCalendarForm extends LitElement {
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${e => this.description = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Color
|
||||
<input type="color" name="color" .value=${this.color} @change=${e => this.color = e.target.value} />
|
||||
<input type="color" .value=${this.color} @change=${e => this.color = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
${["VEVENT", "VTODO", "VJOURNAL"].map(comp => html`
|
||||
<label>
|
||||
Support ${comp}
|
||||
<input type="checkbox" value=${comp} ?checked=${this.components.has(comp)} @change=${e => e.target.checked ? this.components.add(e.target.value) : this.components.delete(e.target.value)} />
|
||||
<input type="checkbox" .value=${comp} ?checked=${this.components.has(comp)} @change=${e => e.target.checked ? this.components.add(e.target.value) : this.components.delete(e.target.value)} />
|
||||
</label>
|
||||
<br>
|
||||
`)}
|
||||
|
||||
@@ -32,23 +32,25 @@ export class ImportAddressbookForm extends LitElement {
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
principal (for group addressbook)
|
||||
<select name="principal" value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
<select name="principal" required .value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option .value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map(membership => html`
|
||||
<option value=${membership}>${membership}</option>
|
||||
<option .value=${membership}>${membership}</option>
|
||||
`)}
|
||||
</select>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.addressbook_id} @change=${e => this.addressbook_id = e.target.value} />
|
||||
<input type="text" required .value=${this.addressbook_id} @change=${e => this.addressbook_id = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
file
|
||||
<input type="file" accept="text/vcard" name="file" @change=${e => this.file = e.target.files[0]} />
|
||||
<input type="file" accept="text/vcard" required @change=${e => this.file = e.target.files[0]} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Import</button>
|
||||
<button type="submit" @click=${event => { event.preventDefault(); this.dialog.value.close(); this.form.value.reset() }} class="cancel">Cancel</button>
|
||||
</form>
|
||||
|
||||
@@ -32,23 +32,25 @@ export class ImportCalendarForm extends LitElement {
|
||||
<form @submit=${this.submit} ${ref(this.form)}>
|
||||
<label>
|
||||
principal (for group calendars)
|
||||
<select name="principal" value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
<select name="principal" required .value=${this.user} @change=${e => this.principal = e.target.value}>
|
||||
<option .value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map(membership => html`
|
||||
<option value=${membership}>${membership}</option>
|
||||
<option .value=${membership}>${membership}</option>
|
||||
`)}
|
||||
</select>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.cal_id} @change=${e => this.cal_id = e.target.value} />
|
||||
<input type="text" required .value=${this.cal_id} @change=${e => this.cal_id = e.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
file
|
||||
<input type="file" accept="text/calendar" name="file" @change=${e => this.file = e.target.files[0]} />
|
||||
<input type="file" required accept="text/calendar" @change=${e => this.file = e.target.files[0]} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Import</button>
|
||||
<button type="submit" @click=${event => { event.preventDefault(); this.dialog.value.close(); this.form.value.reset() }} class="cancel">Cancel</button>
|
||||
</form>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import {svg} from 'lit'
|
||||
|
||||
export function escapeXml(unsafe: string): string {
|
||||
return unsafe.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
@@ -5,3 +7,23 @@ export function escapeXml(unsafe: string): string {
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
}
|
||||
|
||||
export const SVG_ICON_CALENDAR = svg`<!-- Adapted from https://iconoir.com/ -->
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="icon">
|
||||
<path d="M15 4V2M15 4V6M15 4H10.5M3 10V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V10H3Z" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M3 10V6C3 4.89543 3.89543 4 5 4H7" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M7 2V6" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M21 10V6C21 4.89543 20.1046 4 19 4H18.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
`
|
||||
|
||||
export const SVG_ICON_INTERNET = svg`<!-- Adapted from https://iconoir.com/ -->
|
||||
<svg class="icon" width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M13 2.04932C13 2.04932 16 5.99994 16 11.9999" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M11 21.9506C11 21.9506 8 17.9999 8 11.9999C8 5.99994 11 2.04932 11 2.04932" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M2.62964 15.5H12" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M2.62964 8.5H21.3704" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.8789 17.9174C22.3727 18.2211 22.3423 18.9604 21.8337 19.0181L19.2671 19.309L18.1159 21.6213C17.8878 22.0795 17.1827 21.8552 17.0661 21.2873L15.8108 15.1713C15.7123 14.6913 16.1437 14.3892 16.561 14.646L21.8789 17.9174Z"></path>
|
||||
</svg>
|
||||
`
|
||||
|
||||
@@ -14,6 +14,7 @@ export default defineConfig({
|
||||
|
||||
rollupOptions: {
|
||||
input: [
|
||||
"lib/create-birthday-calendar-form.ts",
|
||||
"lib/create-calendar-form.ts",
|
||||
"lib/edit-calendar-form.ts",
|
||||
"lib/import-calendar-form.ts",
|
||||
|
||||
@@ -1,7 +1,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 { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
import { e as escapeXml } from "./index-fgowJCc1.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
@@ -34,27 +34,27 @@ let CreateAddressbookForm = class extends i {
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
principal (for group addressbooks)
|
||||
<select name="principal" value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
<select .value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option .value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map((membership) => x`
|
||||
<option value=${membership}>${membership}</option>
|
||||
<option .value=${membership}>${membership}</option>
|
||||
`)}
|
||||
</select>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.addr_id} @change=${(e2) => this.addr_id = e2.target.value} />
|
||||
<input type="text" .value=${this.addr_id} @change=${(e2) => this.addr_id = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
<input type="text" .value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" @change=${(e2) => this.description = e2.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<button type="submit">Create</button>
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
import { e as escapeXml } from "./index-fgowJCc1.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
||||
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
||||
if (decorator = decorators[i2])
|
||||
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
||||
if (kind && result) __defProp(target, key, result);
|
||||
return result;
|
||||
};
|
||||
let CreateCalendarForm = class extends i {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.principal = "";
|
||||
this.addr_id = "";
|
||||
this.displayname = "";
|
||||
this.description = "";
|
||||
this.color = "";
|
||||
this.dialog = e();
|
||||
this.form = e();
|
||||
this.timezones = [];
|
||||
}
|
||||
createRenderRoot() {
|
||||
return this;
|
||||
}
|
||||
render() {
|
||||
return x`
|
||||
<button @click=${() => this.dialog.value.showModal()}>Create birthday calendar</button>
|
||||
<dialog ${n(this.dialog)}>
|
||||
<h3>Create calendar</h3>
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" .value=${this.displayname} required @change=${(e2) => this.displayname = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Color
|
||||
<input type="color" .value=${this.color} @change=${(e2) => this.color = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<button type="submit">Create</button>
|
||||
<button type="submit" @click=${(event) => {
|
||||
event.preventDefault();
|
||||
this.dialog.value.close();
|
||||
this.form.value.reset();
|
||||
}} class="cancel">Cancel</button>
|
||||
</form>
|
||||
</dialog>
|
||||
`;
|
||||
}
|
||||
async submit(e2) {
|
||||
e2.preventDefault();
|
||||
if (!this.addr_id) {
|
||||
alert("Empty id");
|
||||
return;
|
||||
}
|
||||
if (!this.displayname) {
|
||||
alert("Empty displayname");
|
||||
return;
|
||||
}
|
||||
let response = await fetch(`/caldav/principal/${this.principal}/_birthdays_${this.addr_id}`, {
|
||||
method: "MKCOL",
|
||||
headers: {
|
||||
"Content-Type": "application/xml"
|
||||
},
|
||||
body: `
|
||||
<mkcol xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CS="http://calendarserver.org/ns/" xmlns:ICAL="http://apple.com/ns/ical/">
|
||||
<set>
|
||||
<prop>
|
||||
<displayname>${escapeXml(this.displayname)}</displayname>
|
||||
${this.description ? `<CAL:calendar-description>${escapeXml(this.description)}</CAL:calendar-description>` : ""}
|
||||
${this.color ? `<ICAL:calendar-color>${escapeXml(this.color)}</ICAL:calendar-color>` : ""}
|
||||
<CAL:supported-calendar-component-set>
|
||||
<CAL:comp name="VEVENT" />
|
||||
</CAL:supported-calendar-component-set>
|
||||
</prop>
|
||||
</set>
|
||||
</mkcol>
|
||||
`
|
||||
});
|
||||
if (response.status >= 400) {
|
||||
alert(`Error ${response.status}: ${await response.text()}`);
|
||||
return null;
|
||||
}
|
||||
window.location.reload();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
__decorateClass([
|
||||
n$1()
|
||||
], CreateCalendarForm.prototype, "principal", 2);
|
||||
__decorateClass([
|
||||
n$1()
|
||||
], CreateCalendarForm.prototype, "addr_id", 2);
|
||||
__decorateClass([
|
||||
n$1()
|
||||
], CreateCalendarForm.prototype, "displayname", 2);
|
||||
__decorateClass([
|
||||
n$1()
|
||||
], CreateCalendarForm.prototype, "description", 2);
|
||||
__decorateClass([
|
||||
n$1()
|
||||
], CreateCalendarForm.prototype, "color", 2);
|
||||
__decorateClass([
|
||||
n$1()
|
||||
], CreateCalendarForm.prototype, "timezones", 2);
|
||||
CreateCalendarForm = __decorateClass([
|
||||
t("create-birthday-calendar-form")
|
||||
], CreateCalendarForm);
|
||||
export {
|
||||
CreateCalendarForm
|
||||
};
|
||||
@@ -1,7 +1,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 { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
import { S as SVG_ICON_CALENDAR, a as SVG_ICON_INTERNET, e as escapeXml } from "./index-fgowJCc1.mjs";
|
||||
import { g as getTimezones } from "./timezones-B0vBBzCP.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
@@ -17,19 +17,23 @@ let CreateCalendarForm = class extends i {
|
||||
constructor() {
|
||||
super();
|
||||
this.user = "";
|
||||
this.principal = "";
|
||||
this.dialog = e();
|
||||
this.form = e();
|
||||
this.timezones = [];
|
||||
this.resetForm();
|
||||
this.fetchTimezones();
|
||||
}
|
||||
resetForm() {
|
||||
this.form.value?.reset();
|
||||
this.principal = this.user;
|
||||
this.cal_id = self.crypto.randomUUID();
|
||||
this.displayname = "";
|
||||
this.description = "";
|
||||
this.timezone_id = "";
|
||||
this.color = "";
|
||||
this.isSubscription = false;
|
||||
this.subscriptionUrl = "";
|
||||
this.components = /* @__PURE__ */ new Set();
|
||||
this.dialog = e();
|
||||
this.form = e();
|
||||
this.timezones = [];
|
||||
this.fetchTimezones();
|
||||
this.subscriptionUrl = null;
|
||||
this.components = /* @__PURE__ */ new Set(["VEVENT", "VTODO"]);
|
||||
}
|
||||
async fetchTimezones() {
|
||||
this.timezones = await getTimezones();
|
||||
@@ -39,13 +43,13 @@ let CreateCalendarForm = class extends i {
|
||||
}
|
||||
render() {
|
||||
return x`
|
||||
<button @click=${() => this.dialog.value.showModal()}>Create calendar</button>
|
||||
<dialog ${n(this.dialog)}>
|
||||
<button @click=${(e2) => this.dialog.value.showModal()}>Create calendar</button>
|
||||
<dialog ${n(this.dialog)} @close=${(e2) => this.resetForm()}>
|
||||
<h3>Create calendar</h3>
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
principal (for group calendars)
|
||||
<select name="principal" value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<select required value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map((membership) => x`
|
||||
<option value=${membership}>${membership}</option>
|
||||
@@ -55,17 +59,17 @@ let CreateCalendarForm = class extends i {
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.cal_id} @change=${(e2) => this.cal_id = e2.target.value} />
|
||||
<input type="text" required .value=${this.cal_id} @change=${(e2) => this.cal_id = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
<input type="text" required .value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Timezone (optional)
|
||||
<select name="timezone" .value=${this.timezone_id} @change=${(e2) => this.timezone_id = e2.target.value}>
|
||||
<select .value=${this.timezone_id} @change=${(e2) => this.timezone_id = e2.target.value}>
|
||||
<option value="">No timezone</option>
|
||||
${this.timezones.map((timezone) => x`
|
||||
<option value=${timezone} ?selected=${timezone === this.timezone_id}>${timezone}</option>
|
||||
@@ -75,48 +79,59 @@ let CreateCalendarForm = class extends i {
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" @change=${(e2) => this.description = e2.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Color
|
||||
<input type="color" name="color" @change=${(e2) => this.color = e2.target.value} />
|
||||
<input type="color" .value=${this.color} @change=${(e2) => this.color = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<label>
|
||||
Calendar is subscription to external calendar
|
||||
<input type="checkbox" name="is_subscription" @change=${(e2) => this.isSubscription = e2.target.checked} />
|
||||
</label>
|
||||
<label>Type</label>
|
||||
<div class="tab-radio">
|
||||
<label>
|
||||
<input type="radio" name="type" .checked=${!this.isSubscription} @change=${(e2) => this.isSubscription = false}></input>
|
||||
${SVG_ICON_CALENDAR}
|
||||
Calendar
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="type" .checked=${this.isSubscription} @change=${(e2) => this.isSubscription = true}></input>
|
||||
${SVG_ICON_INTERNET}
|
||||
webCal Subscription
|
||||
</label>
|
||||
</div>
|
||||
<br>
|
||||
${this.isSubscription ? x`
|
||||
<label>
|
||||
Subscription URL
|
||||
<input type="text" name="subscription_url" @change=${(e2) => this.subscriptionUrl = e2.target.value} />
|
||||
<input type="text" pattern="https://.*" .required=${this.isSubscription} .value=${this.subscriptionUrl} @change=${(e2) => this.subscriptionUrl = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
` : x``}
|
||||
<br>
|
||||
${["VEVENT", "VTODO", "VJOURNAL"].map((comp) => x`
|
||||
<label>
|
||||
Support ${comp}
|
||||
<input type="checkbox" value=${comp} @change=${(e2) => e2.target.checked ? this.components.add(e2.target.value) : this.components.delete(e2.target.value)} />
|
||||
</label>
|
||||
<br>
|
||||
`)}
|
||||
|
||||
<label>Components</label>
|
||||
<div>
|
||||
${["VEVENT", "VTODO", "VJOURNAL"].map((comp) => x`
|
||||
<label>
|
||||
Support ${comp}
|
||||
<input type="checkbox" .value=${comp} @change=${(e2) => e2.target.checked ? this.components.add(e2.target.value) : this.components.delete(e2.target.value)} .checked=${this.components.has(comp)} />
|
||||
</label>
|
||||
<br>
|
||||
`)}
|
||||
</div>
|
||||
<br>
|
||||
<button type="submit">Create</button>
|
||||
<button type="submit" @click=${(event) => {
|
||||
event.preventDefault();
|
||||
this.dialog.value.close();
|
||||
this.form.value.reset();
|
||||
}} class="cancel">Cancel</button>
|
||||
</form>
|
||||
</dialog>
|
||||
`;
|
||||
}
|
||||
async submit(e2) {
|
||||
console.log(this.displayname);
|
||||
e2.preventDefault();
|
||||
if (!this.cal_id) {
|
||||
alert("Empty id");
|
||||
@@ -130,6 +145,10 @@ let CreateCalendarForm = class extends i {
|
||||
alert("No calendar components selected");
|
||||
return;
|
||||
}
|
||||
if (this.isSubscription && !this.subscriptionUrl) {
|
||||
alert("Invalid subscription url");
|
||||
return;
|
||||
}
|
||||
let response = await fetch(`/caldav/principal/${this.principal || this.user}/${this.cal_id}`, {
|
||||
method: "MKCOL",
|
||||
headers: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { i, x } from "./lit-DkXrt_Iv.mjs";
|
||||
import { n, t } from "./property-B8WoKf1Y.mjs";
|
||||
import { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n, t } from "./property-C8WJQOrH.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
|
||||
@@ -1,7 +1,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 { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
import { e as escapeXml } from "./index-fgowJCc1.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
@@ -33,12 +33,12 @@ let EditAddressbookForm = class extends i {
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" .value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
<input type="text" .value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<button type="submit">Submit</button>
|
||||
|
||||
@@ -1,7 +1,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 { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
import { e as escapeXml } from "./index-fgowJCc1.mjs";
|
||||
import { g as getTimezones } from "./timezones-B0vBBzCP.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
@@ -40,12 +40,12 @@ let EditCalendarForm = class extends i {
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
Displayname
|
||||
<input type="text" name="displayname" .value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
<input type="text" required .value=${this.displayname} @change=${(e2) => this.displayname = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Timezone (optional)
|
||||
<select name="timezone" .value=${this.timezone_id} @change=${(e2) => this.timezone_id = e2.target.value}>
|
||||
<select .value=${this.timezone_id} @change=${(e2) => this.timezone_id = e2.target.value}>
|
||||
<option value="">No timezone</option>
|
||||
${this.timezones.map((timezone) => x`
|
||||
<option value=${timezone} ?selected=${timezone === this.timezone_id}>${timezone}</option>
|
||||
@@ -55,18 +55,18 @@ let EditCalendarForm = class extends i {
|
||||
<br>
|
||||
<label>
|
||||
Description
|
||||
<input type="text" name="description" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
<input type="text" .value=${this.description} @change=${(e2) => this.description = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
Color
|
||||
<input type="color" name="color" .value=${this.color} @change=${(e2) => this.color = e2.target.value} />
|
||||
<input type="color" .value=${this.color} @change=${(e2) => this.color = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
${["VEVENT", "VTODO", "VJOURNAL"].map((comp) => x`
|
||||
<label>
|
||||
Support ${comp}
|
||||
<input type="checkbox" value=${comp} ?checked=${this.components.has(comp)} @change=${(e2) => e2.target.checked ? this.components.add(e2.target.value) : this.components.delete(e2.target.value)} />
|
||||
<input type="checkbox" .value=${comp} ?checked=${this.components.has(comp)} @change=${(e2) => e2.target.checked ? this.components.add(e2.target.value) : this.components.delete(e2.target.value)} />
|
||||
</label>
|
||||
<br>
|
||||
`)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
@@ -30,23 +30,25 @@ let ImportAddressbookForm = class extends i {
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
principal (for group addressbook)
|
||||
<select name="principal" value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
<select name="principal" required .value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option .value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map((membership) => x`
|
||||
<option value=${membership}>${membership}</option>
|
||||
<option .value=${membership}>${membership}</option>
|
||||
`)}
|
||||
</select>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.addressbook_id} @change=${(e2) => this.addressbook_id = e2.target.value} />
|
||||
<input type="text" required .value=${this.addressbook_id} @change=${(e2) => this.addressbook_id = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
file
|
||||
<input type="file" accept="text/vcard" name="file" @change=${(e2) => this.file = e2.target.files[0]} />
|
||||
<input type="file" accept="text/vcard" required @change=${(e2) => this.file = e2.target.files[0]} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Import</button>
|
||||
<button type="submit" @click=${(event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 { i, x } from "./lit-DKg0et_P.mjs";
|
||||
import { n as n$1, t } from "./property-C8WJQOrH.mjs";
|
||||
import { e, n } from "./ref-BivNNNRN.mjs";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __decorateClass = (decorators, target, key, kind) => {
|
||||
@@ -30,23 +30,25 @@ let ImportCalendarForm = class extends i {
|
||||
<form @submit=${this.submit} ${n(this.form)}>
|
||||
<label>
|
||||
principal (for group calendars)
|
||||
<select name="principal" value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option value=${this.user}>${this.user}</option>
|
||||
<select name="principal" required .value=${this.user} @change=${(e2) => this.principal = e2.target.value}>
|
||||
<option .value=${this.user}>${this.user}</option>
|
||||
${window.rusticalUser.memberships.map((membership) => x`
|
||||
<option value=${membership}>${membership}</option>
|
||||
<option .value=${membership}>${membership}</option>
|
||||
`)}
|
||||
</select>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
id
|
||||
<input type="text" name="id" value=${this.cal_id} @change=${(e2) => this.cal_id = e2.target.value} />
|
||||
<input type="text" required .value=${this.cal_id} @change=${(e2) => this.cal_id = e2.target.value} />
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
file
|
||||
<input type="file" accept="text/calendar" name="file" @change=${(e2) => this.file = e2.target.files[0]} />
|
||||
<input type="file" required accept="text/calendar" @change=${(e2) => this.file = e2.target.files[0]} />
|
||||
</label>
|
||||
<br>
|
||||
<br>
|
||||
<button type="submit">Import</button>
|
||||
<button type="submit" @click=${(event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
function escapeXml(unsafe) {
|
||||
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
||||
}
|
||||
export {
|
||||
escapeXml as e
|
||||
};
|
||||
27
crates/frontend/public/assets/js/index-fgowJCc1.mjs
Normal file
27
crates/frontend/public/assets/js/index-fgowJCc1.mjs
Normal file
@@ -0,0 +1,27 @@
|
||||
import { b } from "./lit-DKg0et_P.mjs";
|
||||
function escapeXml(unsafe) {
|
||||
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
||||
}
|
||||
const SVG_ICON_CALENDAR = b`<!-- Adapted from https://iconoir.com/ -->
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="icon">
|
||||
<path d="M15 4V2M15 4V6M15 4H10.5M3 10V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V10H3Z" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M3 10V6C3 4.89543 3.89543 4 5 4H7" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M7 2V6" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M21 10V6C21 4.89543 20.1046 4 19 4H18.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
`;
|
||||
const SVG_ICON_INTERNET = b`<!-- Adapted from https://iconoir.com/ -->
|
||||
<svg class="icon" width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M13 2.04932C13 2.04932 16 5.99994 16 11.9999" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M11 21.9506C11 21.9506 8 17.9999 8 11.9999C8 5.99994 11 2.04932 11 2.04932" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M2.62964 15.5H12" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M2.62964 8.5H21.3704" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.8789 17.9174C22.3727 18.2211 22.3423 18.9604 21.8337 19.0181L19.2671 19.309L18.1159 21.6213C17.8878 22.0795 17.1827 21.8552 17.0661 21.2873L15.8108 15.1713C15.7123 14.6913 16.1437 14.3892 16.561 14.646L21.8789 17.9174Z"></path>
|
||||
</svg>
|
||||
`;
|
||||
export {
|
||||
SVG_ICON_CALENDAR as S,
|
||||
SVG_ICON_INTERNET as a,
|
||||
escapeXml as e
|
||||
};
|
||||
@@ -66,7 +66,7 @@ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPrope
|
||||
}
|
||||
}
|
||||
return i2;
|
||||
} }, f$1 = (t2, s2) => !i$2(t2, s2), b = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 };
|
||||
} }, f$1 = (t2, s2) => !i$2(t2, s2), b$1 = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 };
|
||||
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
||||
let y$1 = class y extends HTMLElement {
|
||||
static addInitializer(t2) {
|
||||
@@ -75,7 +75,7 @@ let y$1 = class y extends HTMLElement {
|
||||
static get observedAttributes() {
|
||||
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
||||
}
|
||||
static createProperty(t2, s2 = b) {
|
||||
static createProperty(t2, s2 = b$1) {
|
||||
if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
||||
const i2 = Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2);
|
||||
void 0 !== h2 && e$1(this.prototype, t2, h2);
|
||||
@@ -93,7 +93,7 @@ let y$1 = class y extends HTMLElement {
|
||||
}, configurable: true, enumerable: true };
|
||||
}
|
||||
static getPropertyOptions(t2) {
|
||||
return this.elementProperties.get(t2) ?? b;
|
||||
return this.elementProperties.get(t2) ?? b$1;
|
||||
}
|
||||
static _$Ei() {
|
||||
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
||||
@@ -256,7 +256,7 @@ y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("eleme
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const t = globalThis, i$1 = t.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n2 = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y2(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
|
||||
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y2(1), b = y2(2), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
|
||||
function P(t2, i2) {
|
||||
if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
||||
return void 0 !== s$1 ? s$1.createHTML(i2) : i2;
|
||||
@@ -513,6 +513,7 @@ o?.({ LitElement: i });
|
||||
(s.litElementVersions ??= []).push("4.2.1");
|
||||
export {
|
||||
E,
|
||||
b,
|
||||
f$1 as f,
|
||||
i,
|
||||
u$1 as u,
|
||||
@@ -1,4 +1,4 @@
|
||||
import { f, u } from "./lit-DkXrt_Iv.mjs";
|
||||
import { f, u } from "./lit-DKg0et_P.mjs";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
@@ -1,4 +1,4 @@
|
||||
import { E } from "./lit-DkXrt_Iv.mjs";
|
||||
import { E } from "./lit-DKg0et_P.mjs";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,11 @@ a {
|
||||
color: var(--text-on-background-color);
|
||||
}
|
||||
|
||||
a,
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
header {
|
||||
background: var(--background-darker);
|
||||
min-height: 60px;
|
||||
@@ -239,10 +244,8 @@ ul.collection-list {
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
|
||||
a,
|
||||
button {
|
||||
pointer-events: all;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.title {
|
||||
@@ -335,8 +338,10 @@ select {
|
||||
form {
|
||||
|
||||
input[type="text"],
|
||||
input[type="url"],
|
||||
input[type="password"],
|
||||
input[type="color"],
|
||||
input[type="file"],
|
||||
textarea,
|
||||
select {
|
||||
width: 100%;
|
||||
@@ -361,3 +366,57 @@ svg.icon {
|
||||
border-radius: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-radio {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
grid-auto-columns: 1fr;
|
||||
|
||||
background: color-mix(in srgb, var(--background-color), var(--dilute-color) 10%);
|
||||
border: 2px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
color: var(--text-on-background-color);
|
||||
margin: 2px;
|
||||
|
||||
label {
|
||||
padding: 10px;
|
||||
background: color-mix(in srgb, var(--background-color), var(--dilute-color) 10%);
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
svg {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
input {
|
||||
appearance: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
label:hover {
|
||||
background: color-mix(in srgb, var(--background-color), var(--dilute-color) 15%);
|
||||
}
|
||||
|
||||
label:has(input:focus-visible) {
|
||||
outline: medium auto currentColor;
|
||||
outline: medium auto invert;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
|
||||
input {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
label:has(input:checked) {
|
||||
background: color-mix(in srgb, var(--background-color), var(--dilute-color) 20%);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2>{{user.id }}'s Addressbooks</h2>
|
||||
<ul class="collection-list">
|
||||
{% for (meta, addressbook) in addressbooks %}
|
||||
{% for (meta, birthday_cal, addressbook) in addressbooks %}
|
||||
<li class="collection-list-item">
|
||||
<a href="/frontend/user/{{ addressbook.principal }}/addressbook/{{ addressbook.id}}"></a>
|
||||
<div class="inner">
|
||||
@@ -24,6 +24,13 @@
|
||||
></edit-addressbook-form>
|
||||
<delete-button trash
|
||||
href="/carddav/principal/{{ addressbook.principal }}/{{ addressbook.id }}"></delete-button>
|
||||
{% if !birthday_cal.is_some() %}
|
||||
<create-birthday-calendar-form
|
||||
principal="{{ addressbook.principal }}"
|
||||
addr_id="{{ addressbook.id }}"
|
||||
displayname="{{ addressbook.displayname.as_deref().unwrap_or_default() }} birthdays"
|
||||
></create-birthday-calendar-form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="metadata">
|
||||
{{ meta.len }} ({{ meta.size | filesizeformat }}) objects, {{ meta.deleted_len }} ({{ meta.deleted_size | filesizeformat }}) deleted objects
|
||||
@@ -37,7 +44,7 @@
|
||||
{%if !deleted_addressbooks.is_empty() %}
|
||||
<h3>Deleted Addressbooks</h3>
|
||||
<ul class="collection-list">
|
||||
{% for (meta, addressbook) in deleted_addressbooks %}
|
||||
{% for (meta, birthday_cal, addressbook) in deleted_addressbooks %}
|
||||
<li class="collection-list-item">
|
||||
<a href="/frontend/user/{{ addressbook.principal }}/addressbook/{{ addressbook.id}}"></a>
|
||||
<div class="inner">
|
||||
|
||||
9
crates/frontend/public/templates/icons/internet.svg
Normal file
9
crates/frontend/public/templates/icons/internet.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<!-- Adapted from https://iconoir.com/ -->
|
||||
<svg class="icon" width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M13 2.04932C13 2.04932 16 5.99994 16 11.9999" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M11 21.9506C11 21.9506 8 17.9999 8 11.9999C8 5.99994 11 2.04932 11 2.04932" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M2.62964 15.5H12" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M2.62964 8.5H21.3704" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.8789 17.9174C22.3727 18.2211 22.3423 18.9604 21.8337 19.0181L19.2671 19.309L18.1159 21.6213C17.8878 22.0795 17.1827 21.8552 17.0661 21.2873L15.8108 15.1713C15.7123 14.6913 16.1437 14.3892 16.561 14.646L21.8789 17.9174Z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -5,6 +5,7 @@
|
||||
<script>
|
||||
window.rusticalUser = JSON.parse(document.querySelector('#data-rustical-user').innerHTML)
|
||||
</script>
|
||||
<script type="module" src="/frontend/assets/js/create-birthday-calendar-form.mjs" async></script>
|
||||
<script type="module" src="/frontend/assets/js/create-calendar-form.mjs" async></script>
|
||||
<script type="module" src="/frontend/assets/js/edit-calendar-form.mjs" async></script>
|
||||
<script type="module" src="/frontend/assets/js/import-calendar-form.mjs" async></script>
|
||||
|
||||
@@ -12,7 +12,7 @@ use http::{Method, StatusCode};
|
||||
use routes::{addressbooks::route_addressbooks, calendars::route_calendars};
|
||||
use rustical_oidc::{OidcConfig, OidcServiceConfig, route_get_oidc_callback, route_post_oidc};
|
||||
use rustical_store::{
|
||||
AddressbookStore, CalendarStore,
|
||||
AddressbookStore, CalendarStore, PrefixedCalendarStore,
|
||||
auth::{AuthenticationProvider, middleware::AuthenticationLayer},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
@@ -39,7 +39,11 @@ use crate::routes::{
|
||||
#[cfg(not(feature = "dev"))]
|
||||
use assets::{Assets, EmbedService};
|
||||
|
||||
pub fn frontend_router<AP: AuthenticationProvider, CS: CalendarStore, AS: AddressbookStore>(
|
||||
pub fn frontend_router<
|
||||
AP: AuthenticationProvider,
|
||||
CS: CalendarStore,
|
||||
AS: AddressbookStore + PrefixedCalendarStore,
|
||||
>(
|
||||
prefix: &'static str,
|
||||
auth_provider: Arc<AP>,
|
||||
cal_store: Arc<CS>,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use askama::Template;
|
||||
use askama_web::WebTemplate;
|
||||
use axum::{Extension, extract::Path, response::IntoResponse};
|
||||
use http::StatusCode;
|
||||
use rustical_store::{Addressbook, AddressbookStore, CollectionMetadata, auth::Principal};
|
||||
use rustical_store::{
|
||||
Addressbook, AddressbookStore, Calendar, CollectionMetadata, PrefixedCalendarStore,
|
||||
auth::Principal,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::pages::user::{Section, UserPage};
|
||||
|
||||
@@ -18,11 +20,11 @@ impl Section for AddressbooksSection {
|
||||
#[template(path = "components/sections/addressbooks_section.html")]
|
||||
pub struct AddressbooksSection {
|
||||
pub user: Principal,
|
||||
pub addressbooks: Vec<(CollectionMetadata, Addressbook)>,
|
||||
pub deleted_addressbooks: Vec<(CollectionMetadata, Addressbook)>,
|
||||
pub addressbooks: Vec<(CollectionMetadata, Option<Calendar>, Addressbook)>,
|
||||
pub deleted_addressbooks: Vec<(CollectionMetadata, Option<Calendar>, Addressbook)>,
|
||||
}
|
||||
|
||||
pub async fn route_addressbooks<AS: AddressbookStore>(
|
||||
pub async fn route_addressbooks<AS: AddressbookStore + PrefixedCalendarStore>(
|
||||
Path(user_id): Path<String>,
|
||||
Extension(addr_store): Extension<Arc<AS>>,
|
||||
user: Principal,
|
||||
@@ -43,22 +45,42 @@ pub async fn route_addressbooks<AS: AddressbookStore>(
|
||||
|
||||
let mut addressbook_infos = vec![];
|
||||
for addressbook in addressbooks {
|
||||
let birthday_id = format!("{}{}", AS::PREFIX, &addressbook.id);
|
||||
let birthday_cal = match addr_store
|
||||
.get_calendar(&addressbook.principal, &birthday_id, true)
|
||||
.await
|
||||
{
|
||||
Ok(cal) => Some(cal),
|
||||
Err(rustical_store::Error::NotFound) => None,
|
||||
err => Some(err.unwrap()),
|
||||
};
|
||||
addressbook_infos.push((
|
||||
addr_store
|
||||
.addressbook_metadata(&addressbook.principal, &addressbook.id)
|
||||
.await
|
||||
.unwrap(),
|
||||
birthday_cal,
|
||||
addressbook,
|
||||
));
|
||||
}
|
||||
|
||||
let mut deleted_addressbook_infos = vec![];
|
||||
for addressbook in deleted_addressbooks {
|
||||
let birthday_id = format!("{}{}", AS::PREFIX, &addressbook.id);
|
||||
let birthday_cal = match addr_store
|
||||
.get_calendar(&addressbook.principal, &birthday_id, true)
|
||||
.await
|
||||
{
|
||||
Ok(cal) => Some(cal),
|
||||
Err(rustical_store::Error::NotFound) => None,
|
||||
err => Some(err.unwrap()),
|
||||
};
|
||||
deleted_addressbook_infos.push((
|
||||
addr_store
|
||||
.addressbook_metadata(&addressbook.principal, &addressbook.id)
|
||||
.await
|
||||
.unwrap(),
|
||||
birthday_cal,
|
||||
addressbook,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -115,11 +115,8 @@ impl SqliteAddressbookStore {
|
||||
.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> {
|
||||
#[must_use]
|
||||
pub fn default_birthday_calendar(addressbook: Addressbook) -> Calendar {
|
||||
let birthday_name = addressbook
|
||||
.displayname
|
||||
.as_ref()
|
||||
@@ -130,14 +127,44 @@ impl SqliteAddressbookStore {
|
||||
hasher.update(&addressbook.push_topic);
|
||||
format!("{:x}", hasher.finalize())
|
||||
};
|
||||
Calendar {
|
||||
principal: addressbook.principal,
|
||||
meta: CalendarMetadata {
|
||||
displayname: birthday_name,
|
||||
order: 0,
|
||||
description: None,
|
||||
color: None,
|
||||
},
|
||||
id: format!("{}{}", Self::PREFIX, addressbook.id),
|
||||
components: vec![CalendarObjectType::Event],
|
||||
timezone_id: None,
|
||||
deleted_at: None,
|
||||
synctoken: Default::default(),
|
||||
subscription_url: None,
|
||||
push_topic: birthday_push_topic,
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
pub async fn _insert_birthday_calendar<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
calendar: &Calendar,
|
||||
) -> Result<(), rustical_store::Error> {
|
||||
let id = calendar
|
||||
.id
|
||||
.strip_prefix(BIRTHDAYS_PREFIX)
|
||||
.ok_or(Error::NotFound)?;
|
||||
|
||||
sqlx::query!(
|
||||
r#"INSERT INTO birthday_calendars (principal, id, displayname, push_topic)
|
||||
VALUES (?, ?, ?, ?)"#,
|
||||
addressbook.principal,
|
||||
addressbook.id,
|
||||
birthday_name,
|
||||
birthday_push_topic,
|
||||
r#"INSERT INTO birthday_calendars (principal, id, displayname, description, "order", color, push_topic)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)"#,
|
||||
calendar.principal,
|
||||
id,
|
||||
calendar.meta.displayname,
|
||||
calendar.meta.description,
|
||||
calendar.meta.order,
|
||||
calendar.meta.color,
|
||||
calendar.push_topic,
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
@@ -256,8 +283,8 @@ impl CalendarStore for SqliteAddressbookStore {
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
async fn insert_calendar(&self, _calendar: Calendar) -> Result<(), Error> {
|
||||
Err(Error::ReadOnly)
|
||||
async fn insert_calendar(&self, calendar: Calendar) -> Result<(), Error> {
|
||||
Self::_insert_birthday_calendar(&self.db, &calendar).await
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
|
||||
@@ -9,7 +9,7 @@ use rustical_store::{
|
||||
};
|
||||
use sqlx::{Acquire, Executor, Sqlite, SqlitePool, Transaction};
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use tracing::{error, instrument, warn};
|
||||
use tracing::{error_span, instrument, warn};
|
||||
|
||||
pub mod birthday_calendar;
|
||||
|
||||
@@ -74,7 +74,7 @@ impl SqliteAddressbookStore {
|
||||
"Commiting orphaned addressbook object ({},{},{}), deleted={}",
|
||||
&row.principal, &row.addressbook_id, &row.id, &row.deleted
|
||||
);
|
||||
log_object_operation(
|
||||
Self::log_object_operation(
|
||||
&mut tx,
|
||||
&row.principal,
|
||||
&row.addressbook_id,
|
||||
@@ -88,6 +88,57 @@ impl SqliteAddressbookStore {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Logs an operation to an address object
|
||||
async fn log_object_operation(
|
||||
tx: &mut Transaction<'_, Sqlite>,
|
||||
principal: &str,
|
||||
addressbook_id: &str,
|
||||
object_id: &str,
|
||||
operation: ChangeOperation,
|
||||
) -> Result<String, Error> {
|
||||
struct Synctoken {
|
||||
synctoken: i64,
|
||||
}
|
||||
let Synctoken { synctoken } = sqlx::query_as!(
|
||||
Synctoken,
|
||||
r#"
|
||||
UPDATE addressbooks
|
||||
SET synctoken = synctoken + 1
|
||||
WHERE (principal, id) = (?1, ?2)
|
||||
RETURNING synctoken"#,
|
||||
principal,
|
||||
addressbook_id
|
||||
)
|
||||
.fetch_one(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO addressobjectchangelog (principal, addressbook_id, object_id, "operation", synctoken)
|
||||
VALUES (?1, ?2, ?3, ?4, (
|
||||
SELECT synctoken FROM addressbooks WHERE (principal, id) = (?1, ?2)
|
||||
))"#,
|
||||
principal,
|
||||
addressbook_id,
|
||||
object_id,
|
||||
operation
|
||||
)
|
||||
.execute(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(format_synctoken(synctoken))
|
||||
}
|
||||
|
||||
fn send_push_notification(&self, data: CollectionOperationInfo, topic: String) {
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation { topic, data }) {
|
||||
error_span!(
|
||||
"Error trying to send addressbook update notification:",
|
||||
err = format!("{err:?}"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async fn _get_addressbook<'e, E: Executor<'e, Database = Sqlite>>(
|
||||
executor: E,
|
||||
principal: &str,
|
||||
@@ -467,7 +518,8 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Self::_insert_addressbook(&mut *tx, &addressbook).await?;
|
||||
Self::_insert_birthday_calendar(&mut *tx, &addressbook).await?;
|
||||
let birthday_cal = Self::default_birthday_calendar(addressbook);
|
||||
Self::_insert_birthday_calendar(&mut *tx, &birthday_cal).await?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -495,13 +547,8 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
Self::_delete_addressbook(&mut *tx, principal, addressbook_id, use_trashbin).await?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Some(addressbook) = addressbook
|
||||
&& let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Delete,
|
||||
topic: addressbook.push_topic,
|
||||
})
|
||||
{
|
||||
error!("Push notification about deleted addressbook failed: {err}");
|
||||
if let Some(addressbook) = addressbook {
|
||||
self.send_push_notification(CollectionOperationInfo::Delete, addressbook.push_topic);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -587,7 +634,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
|
||||
Self::_put_object(&mut *tx, &principal, &addressbook_id, &object, overwrite).await?;
|
||||
|
||||
let sync_token = log_object_operation(
|
||||
let sync_token = Self::log_object_operation(
|
||||
&mut tx,
|
||||
&principal,
|
||||
&addressbook_id,
|
||||
@@ -599,15 +646,12 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self
|
||||
.get_addressbook(&principal, &addressbook_id, false)
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_addressbook(&principal, &addressbook_id, false)
|
||||
.await?
|
||||
.push_topic,
|
||||
}) {
|
||||
error!("Push notification about deleted addressbook failed: {err}");
|
||||
}
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -628,7 +672,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
|
||||
Self::_delete_object(&mut *tx, principal, addressbook_id, object_id, use_trashbin).await?;
|
||||
|
||||
let sync_token = log_object_operation(
|
||||
let sync_token = Self::log_object_operation(
|
||||
&mut tx,
|
||||
principal,
|
||||
addressbook_id,
|
||||
@@ -640,15 +684,12 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self
|
||||
.get_addressbook(principal, addressbook_id, false)
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_addressbook(principal, addressbook_id, false)
|
||||
.await?
|
||||
.push_topic,
|
||||
}) {
|
||||
error!("Push notification about deleted addressbook failed: {err}");
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -667,7 +708,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
|
||||
Self::_restore_object(&mut *tx, principal, addressbook_id, object_id).await?;
|
||||
|
||||
let sync_token = log_object_operation(
|
||||
let sync_token = Self::log_object_operation(
|
||||
&mut tx,
|
||||
principal,
|
||||
addressbook_id,
|
||||
@@ -678,15 +719,12 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
.map_err(crate::Error::from)?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self
|
||||
.get_addressbook(principal, addressbook_id, false)
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_addressbook(principal, addressbook_id, false)
|
||||
.await?
|
||||
.push_topic,
|
||||
}) {
|
||||
error!("Push notification about restored addressbook object failed: {err}");
|
||||
}
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -731,7 +769,7 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
.await?;
|
||||
|
||||
sync_token = Some(
|
||||
log_object_operation(
|
||||
Self::log_object_operation(
|
||||
&mut tx,
|
||||
&addressbook.principal,
|
||||
&addressbook.id,
|
||||
@@ -743,59 +781,14 @@ impl AddressbookStore for SqliteAddressbookStore {
|
||||
}
|
||||
|
||||
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)
|
||||
if let Some(sync_token) = sync_token {
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_addressbook(&addressbook.principal, &addressbook.id, true)
|
||||
.await?
|
||||
.push_topic,
|
||||
})
|
||||
{
|
||||
error!("Push notification about imported addressbook failed: {err}");
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// Logs an operation to an address object
|
||||
async fn log_object_operation(
|
||||
tx: &mut Transaction<'_, Sqlite>,
|
||||
principal: &str,
|
||||
addressbook_id: &str,
|
||||
object_id: &str,
|
||||
operation: ChangeOperation,
|
||||
) -> Result<String, Error> {
|
||||
struct Synctoken {
|
||||
synctoken: i64,
|
||||
}
|
||||
let Synctoken { synctoken } = sqlx::query_as!(
|
||||
Synctoken,
|
||||
r#"
|
||||
UPDATE addressbooks
|
||||
SET synctoken = synctoken + 1
|
||||
WHERE (principal, id) = (?1, ?2)
|
||||
RETURNING synctoken"#,
|
||||
principal,
|
||||
addressbook_id
|
||||
)
|
||||
.fetch_one(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO addressobjectchangelog (principal, addressbook_id, object_id, "operation", synctoken)
|
||||
VALUES (?1, ?2, ?3, ?4, (
|
||||
SELECT synctoken FROM addressbooks WHERE (principal, id) = (?1, ?2)
|
||||
))"#,
|
||||
principal,
|
||||
addressbook_id,
|
||||
object_id,
|
||||
operation
|
||||
)
|
||||
.execute(&mut **tx)
|
||||
.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, warn};
|
||||
use tracing::{error_span, instrument, warn};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct CalendarObjectRow {
|
||||
@@ -94,6 +94,57 @@ pub struct SqliteCalendarStore {
|
||||
}
|
||||
|
||||
impl SqliteCalendarStore {
|
||||
// Logs an operation to the events
|
||||
async fn log_object_operation(
|
||||
tx: &mut Transaction<'_, Sqlite>,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
object_id: &str,
|
||||
operation: ChangeOperation,
|
||||
) -> Result<String, Error> {
|
||||
struct Synctoken {
|
||||
synctoken: i64,
|
||||
}
|
||||
let Synctoken { synctoken } = sqlx::query_as!(
|
||||
Synctoken,
|
||||
r#"
|
||||
UPDATE calendars
|
||||
SET synctoken = synctoken + 1
|
||||
WHERE (principal, id) = (?1, ?2)
|
||||
RETURNING synctoken"#,
|
||||
principal,
|
||||
cal_id
|
||||
)
|
||||
.fetch_one(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO calendarobjectchangelog (principal, cal_id, object_id, "operation", synctoken)
|
||||
VALUES (?1, ?2, ?3, ?4, (
|
||||
SELECT synctoken FROM calendars WHERE (principal, id) = (?1, ?2)
|
||||
))"#,
|
||||
principal,
|
||||
cal_id,
|
||||
object_id,
|
||||
operation
|
||||
)
|
||||
.execute(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(format_synctoken(synctoken))
|
||||
}
|
||||
|
||||
fn send_push_notification(&self, data: CollectionOperationInfo, topic: String) {
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation { topic, data }) {
|
||||
error_span!(
|
||||
"Error trying to send calendar update notification:",
|
||||
err = format!("{err:?}"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Commit "orphaned" objects to the changelog table
|
||||
pub async fn repair_orphans(&self) -> Result<(), Error> {
|
||||
struct Row {
|
||||
@@ -134,7 +185,8 @@ impl SqliteCalendarStore {
|
||||
"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?;
|
||||
Self::log_object_operation(&mut tx, &row.principal, &row.cal_id, &row.id, operation)
|
||||
.await?;
|
||||
}
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
@@ -605,13 +657,8 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
Self::_delete_calendar(&mut *tx, principal, id, use_trashbin).await?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Some(cal) = cal
|
||||
&& let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Delete,
|
||||
topic: cal.push_topic,
|
||||
})
|
||||
{
|
||||
error!("Push notification about deleted calendar failed: {err}");
|
||||
if let Some(cal) = cal {
|
||||
self.send_push_notification(CollectionOperationInfo::Delete, cal.push_topic);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -652,7 +699,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
Self::_put_object(&mut *tx, &calendar.principal, &calendar.id, &object, false).await?;
|
||||
|
||||
sync_token = Some(
|
||||
log_object_operation(
|
||||
Self::log_object_operation(
|
||||
&mut tx,
|
||||
&calendar.principal,
|
||||
&calendar.id,
|
||||
@@ -665,16 +712,13 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
|
||||
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)
|
||||
if let Some(sync_token) = sync_token {
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_calendar(&calendar.principal, &calendar.id, true)
|
||||
.await?
|
||||
.push_topic,
|
||||
})
|
||||
{
|
||||
error!("Push notification about imported calendar failed: {err}");
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -755,7 +799,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
|
||||
Self::_put_object(&mut *tx, &principal, &cal_id, &object, overwrite).await?;
|
||||
|
||||
let sync_token = log_object_operation(
|
||||
let sync_token = Self::log_object_operation(
|
||||
&mut tx,
|
||||
&principal,
|
||||
&cal_id,
|
||||
@@ -766,15 +810,12 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self
|
||||
.get_calendar(&principal, &cal_id, true)
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_calendar(&principal, &cal_id, true)
|
||||
.await?
|
||||
.push_topic,
|
||||
}) {
|
||||
error!("Push notification about deleted calendar failed: {err}");
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -795,15 +836,15 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
Self::_delete_object(&mut *tx, principal, cal_id, id, use_trashbin).await?;
|
||||
|
||||
let sync_token =
|
||||
log_object_operation(&mut tx, principal, cal_id, id, ChangeOperation::Delete).await?;
|
||||
Self::log_object_operation(&mut tx, principal, cal_id, id, ChangeOperation::Delete)
|
||||
.await?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self.get_calendar(principal, cal_id, true).await?.push_topic,
|
||||
}) {
|
||||
error!("Push notification about deleted calendar failed: {err}");
|
||||
}
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_calendar(principal, cal_id, true).await?.push_topic,
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -823,16 +864,14 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
Self::_restore_object(&mut *tx, principal, cal_id, object_id).await?;
|
||||
|
||||
let sync_token =
|
||||
log_object_operation(&mut tx, principal, cal_id, object_id, ChangeOperation::Add)
|
||||
Self::log_object_operation(&mut tx, principal, cal_id, object_id, ChangeOperation::Add)
|
||||
.await?;
|
||||
tx.commit().await.map_err(crate::Error::from)?;
|
||||
|
||||
if let Err(err) = self.sender.try_send(CollectionOperation {
|
||||
data: CollectionOperationInfo::Content { sync_token },
|
||||
topic: self.get_calendar(principal, cal_id, true).await?.push_topic,
|
||||
}) {
|
||||
error!("Push notification about restored calendar object failed: {err}");
|
||||
}
|
||||
self.send_push_notification(
|
||||
CollectionOperationInfo::Content { sync_token },
|
||||
self.get_calendar(principal, cal_id, true).await?.push_topic,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -850,46 +889,3 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
// Logs an operation to the events
|
||||
// TODO: Log multiple updates
|
||||
async fn log_object_operation(
|
||||
tx: &mut Transaction<'_, Sqlite>,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
object_id: &str,
|
||||
operation: ChangeOperation,
|
||||
) -> Result<String, Error> {
|
||||
struct Synctoken {
|
||||
synctoken: i64,
|
||||
}
|
||||
let Synctoken { synctoken } = sqlx::query_as!(
|
||||
Synctoken,
|
||||
r#"
|
||||
UPDATE calendars
|
||||
SET synctoken = synctoken + 1
|
||||
WHERE (principal, id) = (?1, ?2)
|
||||
RETURNING synctoken"#,
|
||||
principal,
|
||||
cal_id
|
||||
)
|
||||
.fetch_one(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO calendarobjectchangelog (principal, cal_id, object_id, "operation", synctoken)
|
||||
VALUES (?1, ?2, ?3, ?4, (
|
||||
SELECT synctoken FROM calendars WHERE (principal, id) = (?1, ?2)
|
||||
))"#,
|
||||
principal,
|
||||
cal_id,
|
||||
object_id,
|
||||
operation
|
||||
)
|
||||
.execute(&mut **tx)
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
Ok(format_synctoken(synctoken))
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ impl SubscriptionStore for SqliteStore {
|
||||
Err(err) => return Err(err),
|
||||
};
|
||||
sqlx::query!(
|
||||
r#"INSERT OR REPLACE INTO davpush_subscriptions (id, topic, expiration, push_resource, public_key, public_key_type, auth_secret) VALUES (?, ?, ?, ?, ?, ?, ?)"#,
|
||||
r#"REPLACE INTO davpush_subscriptions (id, topic, expiration, push_resource, public_key, public_key_type, auth_secret) VALUES (?, ?, ?, ?, ?, ?, ?)"#,
|
||||
sub.id,
|
||||
sub.topic,
|
||||
sub.expiration,
|
||||
|
||||
19
src/main.rs
19
src/main.rs
@@ -31,6 +31,8 @@ mod app;
|
||||
mod commands;
|
||||
mod config;
|
||||
mod setup_tracing;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
@@ -91,21 +93,22 @@ async fn get_data_stores(
|
||||
async fn main() -> Result<()> {
|
||||
let args = Args::parse();
|
||||
|
||||
let parse_config = || {
|
||||
Figment::new()
|
||||
.merge(Toml::file(&args.config_file))
|
||||
.merge(Env::prefixed("RUSTICAL_").split("__"))
|
||||
.extract()
|
||||
};
|
||||
|
||||
match args.command {
|
||||
Some(Command::GenConfig(gen_config_args)) => cmd_gen_config(gen_config_args)?,
|
||||
Some(Command::Principals(principals_args)) => cmd_principals(principals_args).await?,
|
||||
Some(Command::Health(health_args)) => {
|
||||
let config: Config = Figment::new()
|
||||
.merge(Toml::file(&args.config_file))
|
||||
.merge(Env::prefixed("RUSTICAL_").split("__"))
|
||||
.extract()?;
|
||||
let config: Config = parse_config()?;
|
||||
cmd_health(config.http, health_args).await?;
|
||||
}
|
||||
None => {
|
||||
let config: Config = Figment::new()
|
||||
.merge(Toml::file(&args.config_file))
|
||||
.merge(Env::prefixed("RUSTICAL_").split("__"))
|
||||
.extract()?;
|
||||
let config: Config = parse_config()?;
|
||||
|
||||
setup_tracing(&config.tracing);
|
||||
|
||||
|
||||
52
src/tests.rs
Normal file
52
src/tests.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
use crate::{app::make_app, config::NextcloudLoginConfig};
|
||||
use rstest::rstest;
|
||||
use rustical_frontend::FrontendConfig;
|
||||
use rustical_store_sqlite::{
|
||||
SqliteStore,
|
||||
addressbook_store::SqliteAddressbookStore,
|
||||
calendar_store::SqliteCalendarStore,
|
||||
principal_store::SqlitePrincipalStore,
|
||||
tests::{
|
||||
get_test_addressbook_store, get_test_calendar_store, get_test_principal_store,
|
||||
get_test_subscription_store,
|
||||
},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_app(
|
||||
#[from(get_test_calendar_store)]
|
||||
#[future]
|
||||
cal_store: SqliteCalendarStore,
|
||||
#[from(get_test_addressbook_store)]
|
||||
#[future]
|
||||
addr_store: SqliteAddressbookStore,
|
||||
#[from(get_test_principal_store)]
|
||||
#[future]
|
||||
principal_store: SqlitePrincipalStore,
|
||||
#[from(get_test_subscription_store)]
|
||||
#[future]
|
||||
sub_store: SqliteStore,
|
||||
) {
|
||||
let addr_store = Arc::new(addr_store.await);
|
||||
let cal_store = Arc::new(cal_store.await);
|
||||
let sub_store = Arc::new(sub_store.await);
|
||||
let principal_store = Arc::new(principal_store.await);
|
||||
|
||||
let _app = make_app(
|
||||
addr_store,
|
||||
cal_store,
|
||||
sub_store,
|
||||
principal_store,
|
||||
FrontendConfig {
|
||||
enabled: true,
|
||||
allow_password_login: true,
|
||||
},
|
||||
None,
|
||||
&NextcloudLoginConfig { enabled: false },
|
||||
false,
|
||||
true,
|
||||
20,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user