Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Probe: zones shared with the account, in Reminders, Notes and Photos

Yashwanth Kamireddieeb3baf4eb15
diff --git a/probe/examples/shared_zones.rs b/probe/examples/shared_zones.rs
new file mode 100644
index 0000000..f61dd3a
--- /dev/null
+++ b/probe/examples/shared_zones.rs
@@ -0,0 +1,27 @@
+//! Read-only: the zones others have shared with this account, in Reminders', Notes' and Photos'
+//! CloudKit containers (each container's shared database), as names and owners.
+use anyhow::{anyhow, Result};
+use quince_icloud::cloudkit::{Database, ZoneClient};
+
+#[tokio::main]
+async fn main() -> Result<()> {
+ let dir = std::path::PathBuf::from(std::env::var("HOME")?).join(".local/share/quince-probe");
+ let mut client = quince_auth::Client::new(&dir)?;
+ if !client.resume().await? {
+ return Err(anyhow!("no session"));
+ }
+ let root = client.session().service_url("ckdatabasews").ok_or_else(|| anyhow!("no ckdatabasews"))?;
+ let p = client.service_params();
+ let http = client.http().clone();
+ for container in ["com.apple.reminders", "com.apple.notes", "com.apple.photos.cloud"] {
+ let zones = ZoneClient::new(&http, &root, container, p.clone())
+ .in_database(Database::Shared)
+ .zone_ids()
+ .await;
+ match zones {
+ Ok(z) => println!("{container}: {} shared zone(s) {:?}", z.len(), z.iter().map(|(n, o)| (n.as_str(), o.as_deref().map(|o| &o[..o.len().min(8)]))).collect::<Vec<_>>()),
+ Err(e) => println!("{container}: {e}"),
+ }
+ }
+ Ok(())
+}