Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Drive can be uploaded to, and its buttons are no longer invisible
Yashwanth Kamireddi3c5516019b93
diff --git a/.uiverify/a11y.mjs b/.uiverify/a11y.mjsindex 6720bed..a3df07e 100644--- a/.uiverify/a11y.mjs+++ b/.uiverify/a11y.mjs@@ -101,7 +101,7 @@ const screens = [await p.click('.nav-item:has-text("iCloud Drive")');await p.waitForSelector(".drive-row-hit");await p.hover(".drive-row.is-folder");- await p.click('.drive-row.is-folder .rem-list-action[aria-label^="Move"]');+ await p.click('.drive-row.is-folder .drive-action[aria-label^="Move"]');await p.waitForSelector(".modal-sheet");} },];diff --git a/.uiverify/assert.mjs b/.uiverify/assert.mjsindex b6def77..cba1205 100644--- a/.uiverify/assert.mjs+++ b/.uiverify/assert.mjs@@ -191,6 +191,44 @@ let failures = 0;: `FAIL reminder rows fill only ${Math.round(fill * 100)}% of their pane`);if (fill === null || fill < 0.9) failures++;++ // The "My Lists" heading belongs on the same left edge as the icons in the rows under it,+ // which is where a source list puts a section header. It sat 24px right of both the cards+ // above and the icons below, reading as a column that had slipped.+ const heading = await page.evaluate(() => {+ const label = document.querySelector(".rem-lists-heading");+ const card = document.querySelector(".rem-smart");+ const icon = document.querySelector(".rem-list-glyph");+ if (!label || !card || !icon) return null;+ const text = label.getBoundingClientRect().left ++ parseFloat(getComputedStyle(label).paddingLeft || "0");+ return {+ offCard: text - card.getBoundingClientRect().left,+ offIcon: text - icon.getBoundingClientRect().left,+ size: parseFloat(getComputedStyle(label).fontSize),+ };+ });+ if (!heading) {+ console.log("FAIL could not measure the My Lists heading");+ failures++;+ } else {+ const aligned = Math.abs(heading.offIcon) <= 1.5 && heading.offCard <= 10;+ console.log(+ aligned+ ? `PASS "My Lists" sits on the row icons' edge [${heading.offIcon.toFixed(1)}px off the icons, ${heading.offCard.toFixed(1)}px in from the cards]`+ : `FAIL "My Lists" is adrift [${heading.offIcon.toFixed(1)}px off the icons, ${heading.offCard.toFixed(1)}px in from the cards]`+ );+ if (!aligned) failures++;++ // A section header, not a title. It reads as one of the list names if it grows.+ const small = heading.size <= 12;+ console.log(+ small+ ? `PASS "My Lists" reads as a heading, not a title [${heading.size}px]`+ : `FAIL "My Lists" is ${heading.size}px, too big for a section heading`+ );+ if (!small) failures++;+ }await page.close();}diff --git a/.uiverify/keyboard.mjs b/.uiverify/keyboard.mjsindex c1fdd15..aa2292e 100644--- a/.uiverify/keyboard.mjs+++ b/.uiverify/keyboard.mjs@@ -265,7 +265,7 @@ const focused = (page) =>await page.click('.nav-item:has-text("iCloud Drive")');await page.waitForSelector(".drive-row-hit");await page.hover(".drive-row.is-folder");- await page.click('.drive-row.is-folder .rem-list-action[aria-label^="Move"]');+ await page.click('.drive-row.is-folder .drive-action[aria-label^="Move"]');await page.waitForSelector(".modal-sheet");// The focus move is deliberately a tick after mount (it has to win a race against thediff --git a/.uiverify/shots.mjs b/.uiverify/shots.mjsindex ae04713..e622f98 100644--- a/.uiverify/shots.mjs+++ b/.uiverify/shots.mjs@@ -277,7 +277,7 @@ const shots = [await p.click('.nav-item:has-text("iCloud Drive")');await p.waitForSelector(".drive-row-hit");await p.hover(".drive-row.is-folder");- await p.click('.drive-row.is-folder .rem-list-action[aria-label^="Move"]');+ await p.click('.drive-row.is-folder .drive-action[aria-label^="Move"]');await p.waitForSelector(".modal-sheet");} },{ name: "04-library", screen: "library", theme: "light" },diff --git a/Cargo.lock b/Cargo.lockindex a1b5b1c..8d2dd85 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2398,6 +2398,16 @@ version = "0.3.17"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"+[[package]]+name = "mime_guess"+version = "2.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"+dependencies = [+ "mime",+ "unicase",+]+[[package]]name = "miniz_oxide"version = "0.8.9"@@ -2736,6 +2746,7 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"dependencies = ["bitflags 2.13.2","block2",+ "libc","objc2","objc2-core-foundation",]@@ -3181,6 +3192,7 @@ dependencies = ["serde_json","tauri","tauri-build",+ "tauri-plugin-dialog","tokio","uuid",]@@ -3256,6 +3268,7 @@ dependencies = ["quince-core","quince-icloud","quince-media",+ "reqwest 0.12.28","rpassword","serde_json","tokio",@@ -3519,6 +3532,7 @@ dependencies = ["hyper-util","js-sys","log",+ "mime_guess","percent-encoding","pin-project-lite","quinn",@@ -3588,6 +3602,30 @@ dependencies = ["url",]+[[package]]+name = "rfd"+version = "0.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672"+dependencies = [+ "block2",+ "dispatch2",+ "glib-sys",+ "gobject-sys",+ "gtk-sys",+ "js-sys",+ "log",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+ "raw-window-handle",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+ "windows-sys 0.60.2",+]+[[package]]name = "ring"version = "0.17.14"@@ -4411,6 +4449,64 @@ dependencies = ["tauri-utils",]+[[package]]+name = "tauri-plugin"+version = "2.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "74be5dd4bed9afbd145e5716b5fa2ec28cbc29c34ffa61c258c9273d896c8020"+dependencies = [+ "anyhow",+ "glob",+ "plist",+ "schemars 0.8.22",+ "serde",+ "serde_json",+ "tauri-utils",+ "walkdir",+]++[[package]]+name = "tauri-plugin-dialog"+version = "2.7.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "61854a36651aa48381e5e209f69a01273b77f3f9f91f0c430b1b98d33bd47229"+dependencies = [+ "log",+ "raw-window-handle",+ "rfd",+ "serde",+ "serde_json",+ "tauri",+ "tauri-plugin",+ "tauri-plugin-fs",+ "thiserror 2.0.20",+ "url",+]++[[package]]+name = "tauri-plugin-fs"+version = "2.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "de22eef34fd78c0da050e748710edd50bf127e651d02ea1b2bfada1523cc5c51"+dependencies = [+ "anyhow",+ "dunce",+ "glob",+ "log",+ "objc2-foundation",+ "percent-encoding",+ "schemars 0.8.22",+ "serde",+ "serde_json",+ "serde_repr",+ "tauri",+ "tauri-plugin",+ "tauri-utils",+ "thiserror 2.0.20",+ "toml 1.1.6+spec-1.1.0",+ "url",+]+[[package]]name = "tauri-runtime"version = "2.11.3"@@ -4971,6 +5067,12 @@ dependencies = ["unic-common",]+[[package]]+name = "unicase"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"+[[package]]name = "unicode-ident"version = "1.0.24"@@ -5518,6 +5620,15 @@ dependencies = ["windows-targets 0.52.6",]+[[package]]+name = "windows-sys"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"+dependencies = [+ "windows-targets 0.53.5",+]+[[package]]name = "windows-sys"version = "0.61.2"@@ -5551,13 +5662,30 @@ dependencies = ["windows_aarch64_gnullvm 0.52.6","windows_aarch64_msvc 0.52.6","windows_i686_gnu 0.52.6",- "windows_i686_gnullvm",+ "windows_i686_gnullvm 0.52.6","windows_i686_msvc 0.52.6","windows_x86_64_gnu 0.52.6","windows_x86_64_gnullvm 0.52.6","windows_x86_64_msvc 0.52.6",]+[[package]]+name = "windows-targets"+version = "0.53.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"+dependencies = [+ "windows-link 0.2.1",+ "windows_aarch64_gnullvm 0.53.1",+ "windows_aarch64_msvc 0.53.1",+ "windows_i686_gnu 0.53.1",+ "windows_i686_gnullvm 0.53.1",+ "windows_i686_msvc 0.53.1",+ "windows_x86_64_gnu 0.53.1",+ "windows_x86_64_gnullvm 0.53.1",+ "windows_x86_64_msvc 0.53.1",+]+[[package]]name = "windows-threading"version = "0.1.0"@@ -5588,6 +5716,12 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"+[[package]]+name = "windows_aarch64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"+[[package]]name = "windows_aarch64_msvc"version = "0.42.2"@@ -5600,6 +5734,12 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"+[[package]]+name = "windows_aarch64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"+[[package]]name = "windows_i686_gnu"version = "0.42.2"@@ -5612,12 +5752,24 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"+[[package]]+name = "windows_i686_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"+[[package]]name = "windows_i686_gnullvm"version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"+[[package]]+name = "windows_i686_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"+[[package]]name = "windows_i686_msvc"version = "0.42.2"@@ -5630,6 +5782,12 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"+[[package]]+name = "windows_i686_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"+[[package]]name = "windows_x86_64_gnu"version = "0.42.2"@@ -5642,6 +5800,12 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"+[[package]]+name = "windows_x86_64_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"+[[package]]name = "windows_x86_64_gnullvm"version = "0.42.2"@@ -5654,6 +5818,12 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"+[[package]]+name = "windows_x86_64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"+[[package]]name = "windows_x86_64_msvc"version = "0.42.2"@@ -5666,6 +5836,12 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"+[[package]]+name = "windows_x86_64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"+[[package]]name = "winnow"version = "0.5.40"diff --git a/Cargo.toml b/Cargo.tomlindex ba870be..6c19ca5 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -9,7 +9,7 @@ license = "GPL-3.0-only"[workspace.dependencies]anyhow = "1"-reqwest = { version = "0.12", features = ["json", "cookies", "gzip", "rustls-tls", "stream"], default-features = false }+reqwest = { version = "0.12", features = ["json", "cookies", "gzip", "rustls-tls", "stream", "multipart"], default-features = false }serde = { version = "1", features = ["derive"] }serde_json = "1"tokio = { version = "1", features = ["macros", "rt-multi-thread"] }diff --git a/crates/quince-icloud/src/drive.rs b/crates/quince-icloud/src/drive.rsindex 8899abf..f0d8df0 100644--- a/crates/quince-icloud/src/drive.rs+++ b/crates/quince-icloud/src/drive.rs@@ -945,3 +945,240 @@ mod write_tests {dir}}++/// A guess at what kind of file this is, from its name.+///+/// Apple stores whatever it is told here and hands it back on download, so a wrong guess shows+/// up later as a file the browser refuses to preview. The list covers what people actually put+/// in a Drive; anything else is declared as bytes, which is honest rather than wrong.+fn content_type(name: &str) -> &'static str {+ let extension = name.rsplit_once('.').map(|(_, e)| e.to_ascii_lowercase());+ match extension.as_deref() {+ Some("jpg" | "jpeg") => "image/jpeg",+ Some("png") => "image/png",+ Some("gif") => "image/gif",+ Some("webp") => "image/webp",+ Some("heic") => "image/heic",+ Some("svg") => "image/svg+xml",+ Some("pdf") => "application/pdf",+ Some("txt" | "md" | "log") => "text/plain",+ Some("csv") => "text/csv",+ Some("json") => "application/json",+ Some("html" | "htm") => "text/html",+ Some("mp3") => "audio/mpeg",+ Some("m4a") => "audio/mp4",+ Some("wav") => "audio/wav",+ Some("mp4" | "m4v") => "video/mp4",+ Some("mov") => "video/quicktime",+ Some("zip") => "application/zip",+ Some("doc") => "application/msword",+ Some("docx") => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",+ Some("xls") => "application/vnd.ms-excel",+ Some("xlsx") => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",+ Some("ppt") => "application/vnd.ms-powerpoint",+ Some("pptx") => "application/vnd.openxmlformats-officedocument.presentationml.presentation",+ Some("pages") => "application/x-iwork-pages-sffpages",+ Some("numbers") => "application/x-iwork-numbers-sffnumbers",+ Some("key") => "application/x-iwork-keynote-sffkey",+ _ => "application/octet-stream",+ }+}++/// Where a document is filed, as `update/documents` wants it: the bare id, or `root`.+fn starting_document_id(folder_id: &str) -> &str {+ if folder_id == quince_core::drive::ROOT {+ "root"+ } else {+ docwsid_of(folder_id)+ }+}++/// Put a file from this machine into a Drive folder.+///+/// Three separate calls, because that is how Apple does it and skipping any of them leaves a+/// half-made file: ask `upload/web` for somewhere to put the bytes, post the bytes to the URL+/// it hands back, then tell `update/documents` to file the result under a name. Only the third+/// call makes the file exist; the first two leave nothing visible behind if they fail.+///+/// The bytes are streamed off disk rather than read into memory, so putting a film in Drive+/// costs the same as putting a note in it.+///+/// # Errors+/// When the file cannot be read, when Apple refuses any of the three steps, or when the file+/// does not afterwards appear in the folder it was meant for.+pub async fn upload(+ http: &reqwest::Client,+ docws_root: &str,+ drivews_root: &str,+ params: Vec<(String, String)>,+ folder_id: &str,+ path: &std::path::Path,+) -> Result<DriveItem> {+ let name = path+ .file_name()+ .and_then(|n| n.to_str())+ .ok_or_else(|| Error::Protocol("that file has no name to give it".into()))?+ .to_string();+ let size = tokio::fs::metadata(path)+ .await+ .map_err(|e| Error::Protocol(format!("could not read {name}: {e}")))?+ .len();+ let docws = docws_root.trim_end_matches('/');++ // 1. Somewhere to put the bytes.+ let offered: Value = post_json(+ http,+ &format!("{docws}/ws/com.apple.CloudDocs/upload/web"),+ ¶ms,+ &json!({+ "filename": name,+ "type": "FILE",+ "content_type": content_type(&name),+ "size": size,+ }),+ )+ .await?;+ let slot = offered+ .as_array()+ .and_then(|a| a.first())+ .ok_or_else(|| Error::Protocol("Apple offered nowhere to put the file".into()))?;+ let url = slot+ .get("url")+ .and_then(Value::as_str)+ .ok_or_else(|| Error::Protocol("Apple's upload slot carried no address".into()))?;+ let document_id = slot+ .get("document_id")+ .and_then(Value::as_str)+ .ok_or_else(|| Error::Protocol("Apple's upload slot carried no document id".into()))?;++ // 2. The bytes themselves, straight off disk.+ let file = tokio::fs::File::open(path)+ .await+ .map_err(|e| Error::Protocol(format!("could not open {name}: {e}")))?;+ let part = reqwest::multipart::Part::stream_with_length(reqwest::Body::from(file), size)+ .file_name(name.clone())+ .mime_str(content_type(&name))+ .map_err(|e| Error::Protocol(format!("{name} has a content type Apple refused: {e}")))?;+ let sent = http+ .post(url)+ .multipart(reqwest::multipart::Form::new().part("files", part))+ .send()+ .await?;+ let status = sent.status();+ let text = sent.text().await.unwrap_or_default();+ if !status.is_success() {+ return Err(Error::Protocol(format!(+ "Apple would not take the file ({status}): {}",+ text.chars().take(160).collect::<String>()+ )));+ }+ let receipt: Value = serde_json::from_str(&text)+ .map_err(|e| Error::Protocol(format!("Apple's upload reply was not JSON: {e}")))?;+ let single = receipt+ .get("singleFile")+ .ok_or_else(|| Error::Protocol("Apple took the bytes but described nothing".into()))?;+ let of = |key: &str| single.get(key).cloned().unwrap_or(Value::Null);++ // 3. File it under a name. Until this, the bytes belong to nothing.+ let now = i64::try_from(+ std::time::SystemTime::now()+ .duration_since(std::time::UNIX_EPOCH)+ .map(|d| d.as_millis())+ .unwrap_or(0),+ )+ .unwrap_or(0);+ post_json(+ http,+ &format!("{docws}/ws/com.apple.CloudDocs/update/documents"),+ ¶ms,+ &json!({+ // Apple renames rather than overwrites when the name is taken, which is what a+ // file manager does and what a person expects.+ "allow_conflict": true,+ "btime": now,+ "mtime": now,+ "command": "add_file",+ "create_short_guid": true,+ "document_id": document_id,+ "file_flags": { "is_executable": false, "is_hidden": false, "is_writable": true },+ "path": { "starting_document_id": starting_document_id(folder_id), "path": name },+ "data": {+ "receipt": of("receipt"),+ "reference_signature": of("referenceChecksum"),+ "signature": of("fileChecksum"),+ "wrapping_key": of("wrappingKey"),+ "size": of("size"),+ },+ }),+ )+ .await?;++ // Apple answers 200 to writes it did not make. The folder is the only witness that counts.+ let after = folder_listing(http, drivews_root, ¶ms, folder_id).await?;+ let stem = name.rsplit_once('.').map_or(name.as_str(), |(s, _)| s);+ after+ .into_iter()+ .find(|i| i.name == name || i.name == stem)+ .ok_or_else(|| {+ Error::Protocol(format!(+ "Apple accepted {name} but the folder does not hold it"+ ))+ })+}++/// A JSON POST to Drive that fails loudly rather than returning something unusable.+async fn post_json(+ http: &reqwest::Client,+ url: &str,+ params: &[(String, String)],+ body: &Value,+) -> Result<Value> {+ let response = http+ .post(url)+ .query(params)+ .header("Referer", "https://www.icloud.com/")+ .json(body)+ .send()+ .await?;+ let status = response.status();+ let text = response.text().await.unwrap_or_default();+ if status.as_u16() == 450 {+ return Err(Error::ReauthRequired);+ }+ if !status.is_success() {+ return Err(Error::Protocol(format!(+ "Drive returned {status}: {}",+ text.chars().take(160).collect::<String>()+ )));+ }+ serde_json::from_str(&text)+ .map_err(|e| Error::Protocol(format!("Drive returned invalid JSON: {e}")))+}++#[cfg(test)]+mod upload_tests {+ use super::*;++ #[test]+ fn a_file_is_declared_as_what_it_is() {+ assert_eq!(content_type("holiday.JPG"), "image/jpeg");+ assert_eq!(content_type("notes.md"), "text/plain");+ assert_eq!(+ content_type("budget.numbers"),+ "application/x-iwork-numbers-sffnumbers"+ );+ assert_eq!(content_type("archive.tar.gz"), "application/octet-stream");+ assert_eq!(content_type("noextension"), "application/octet-stream");+ assert_eq!(content_type(""), "application/octet-stream");+ }++ /// The root has a name of its own in the listing and a different one in a document path.+ #[test]+ fn the_root_is_called_root_when_filing_a_document() {+ assert_eq!(starting_document_id(quince_core::drive::ROOT), "root");+ assert_eq!(+ starting_document_id("FOLDER::com.apple.CloudDocs::7B3F-ABCD"),+ "7B3F-ABCD"+ );+ }+}diff --git a/package-lock.json b/package-lock.jsonindex b744f9b..6e6ab65 100644--- a/package-lock.json+++ b/package-lock.json@@ -9,6 +9,7 @@"version": "0.1.0","dependencies": {"@tauri-apps/api": "^2",+ "@tauri-apps/plugin-dialog": "^2.7.3","react": "^18.3.1","react-dom": "^18.3.1"},@@ -1469,6 +1470,15 @@"node": ">= 10"}},+ "node_modules/@tauri-apps/plugin-dialog": {+ "version": "2.7.3",+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.7.3.tgz",+ "integrity": "sha512-CRgE+7TP4tvq9MjBU6f04NLTFIqVMLKHk3hAqlhil00ngK9ACTrXPH3oHpKMProxILodd3YjBoKbMwSI4IEcfA==",+ "license": "MIT OR Apache-2.0",+ "dependencies": {+ "@tauri-apps/api": "^2.11.0"+ }+ },"node_modules/@types/babel__core": {"version": "7.20.5","resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",diff --git a/package.json b/package.jsonindex 8b48eb7..46038cc 100644--- a/package.json+++ b/package.json@@ -11,6 +11,7 @@},"dependencies": {"@tauri-apps/api": "^2",+ "@tauri-apps/plugin-dialog": "^2.7.3","react": "^18.3.1","react-dom": "^18.3.1"},diff --git a/probe/Cargo.toml b/probe/Cargo.tomlindex 48f9c6b..537b84e 100644--- a/probe/Cargo.toml+++ b/probe/Cargo.toml@@ -7,6 +7,7 @@ publish = false[dependencies]anyhow.workspace = true+reqwest.workspace = trueserde_json.workspace = truetokio.workspace = truerpassword = "7"diff --git a/probe/examples/drive_upload.rs b/probe/examples/drive_upload.rsnew file mode 100644index 0000000..720301d--- /dev/null+++ b/probe/examples/drive_upload.rs@@ -0,0 +1,85 @@+//! Throwaway: the real upload path, into the root and into a folder, then cleaned up.+use anyhow::{anyhow, Result};++const ROOT: &str = "FOLDER::com.apple.CloudDocs::root";++#[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 docws = client+ .session()+ .service_url("docws")+ .ok_or_else(|| anyhow!("no docws"))?;+ let drivews = client+ .session()+ .service_url("drivews")+ .ok_or_else(|| anyhow!("no drivews"))?;+ let http = client.http().clone();+ let params = client.service_params();++ // A file big enough that streaming rather than slurping actually matters.+ let tmp = std::env::temp_dir().join("quince-upload-test.txt");+ let body = "Quince upload test - safe to delete\n".repeat(200_000);+ std::fs::write(&tmp, &body)?;+ println!("local file: {} bytes", body.len());++ // Into the root.+ let landed =+ quince_icloud::drive::upload(&http, &docws, &drivews, params.clone(), ROOT, &tmp).await?;+ println!(+ "root: {} ({:?}) {} bytes parent={:?}",+ landed.name,+ landed.extension,+ landed.size.unwrap_or(-1),+ landed.parent_id+ );+ if landed.size != Some(body.len() as i64) {+ return Err(anyhow!("the size Apple holds is not the size sent"));+ }++ // Into a folder, which is the case `starting_document_id` exists for.+ quince_icloud::drive::create_folder(+ &http,+ &drivews,+ params.clone(),+ ROOT,+ "quince-upload-folder",+ )+ .await?;+ let store = std::env::temp_dir().join(format!("quince-{}", uuid::Uuid::new_v4()));+ std::fs::create_dir_all(&store)?;+ let mut library = quince_core::Library::open(&store)?;+ quince_icloud::drive::sync_folder(&http, &drivews, params.clone(), &mut library, ROOT).await?;+ let folder = library+ .drive_children(ROOT)?+ .into_iter()+ .find(|i| i.name == "quince-upload-folder")+ .ok_or_else(|| anyhow!("the test folder was not made"))?;++ let inner = quince_icloud::drive::upload(+ &http,+ &docws,+ &drivews,+ params.clone(),+ &folder.drivewsid,+ &tmp,+ )+ .await?;+ println!("folder: {} in {:?}", inner.name, inner.parent_id);+ if inner.parent_id.as_deref() != Some(folder.drivewsid.as_str()) {+ return Err(anyhow!(+ "it landed somewhere other than the folder asked for"+ ));+ }++ // Take it all back out.+ quince_icloud::drive::delete(&http, &drivews, params.clone(), &landed).await?;+ quince_icloud::drive::delete(&http, &drivews, params.clone(), &folder).await?;+ std::fs::remove_file(&tmp).ok();+ println!("\ncleaned up. OK — upload works into the root and into a folder.");+ Ok(())+}diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 4e09c7b..aa9e4e8 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -21,3 +21,4 @@ tokio = { workspace = true }anyhow.workspace = truejiff = "0.2.37"uuid.workspace = true+tauri-plugin-dialog = "2.7.3"diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.jsonindex 7283b8d..e163fad 100644--- a/src-tauri/capabilities/default.json+++ b/src-tauri/capabilities/default.json@@ -2,6 +2,11 @@"$schema": "../gen/schemas/desktop-schema.json","identifier": "default","description": "Core window permissions for the Quince window.",- "windows": ["main"],- "permissions": ["core:default"]+ "windows": [+ "main"+ ],+ "permissions": [+ "core:default",+ "dialog:allow-open"+ ]}diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex 2d1b097..0de0416 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -984,6 +984,49 @@ async fn drive_download(}/// Create a folder, and reflect it locally without waiting for the next full sync.+/// Put files from this machine into a Drive folder.+///+/// Paths, never bytes. The interface hands over what the person chose — from the file dialog+/// or from a drag onto the window — and the file is read here and streamed straight to Apple,+/// so putting a film in Drive costs no more memory than putting a note in it.+///+/// Each file is reported on separately: one that Apple refuses must not take the rest of a+/// dragged selection down with it.+#[tauri::command]+async fn drive_upload(+ folder_id: String,+ paths: Vec<String>,+ auth: State<'_, Auth>,+ data: State<'_, Data>,+) -> UiResult<Vec<String>> {+ let (http, root, params) = drive_context(&auth).await?;+ let docws = {+ let client = auth.client.lock().await;+ client+ .session()+ .service_url("docws")+ .ok_or("Apple hasn't offered uploads for this account.")?+ };++ let mut failed = Vec::new();+ for path in &paths {+ let path = std::path::Path::new(path);+ let name = path.file_name().map_or_else(+ || path.display().to_string(),+ |n| n.to_string_lossy().into(),+ );+ if let Err(e) =+ quince_icloud::drive::upload(&http, &docws, &root, params.clone(), &folder_id, path)+ .await+ {+ failed.push(format!("{name}: {e}"));+ }+ }++ resync_drive_folder(&http, &root, params, &data, &folder_id).await?;+ Ok(failed)+}+#[tauri::command]async fn drive_create_folder(parent_id: String,@@ -1238,6 +1281,7 @@ async fn contact_photo(fn main() {tauri::Builder::default()+ .plugin(tauri_plugin_dialog::init())// Images are served, not messaged. `quince://photo/<contact id>` is loaded by the// webview itself, which is what keeps a scrolling list cheap..register_asynchronous_uri_scheme_protocol("quince", |ctx, request, responder| {@@ -1346,6 +1390,7 @@ fn main() {drive_sync_folder,drive_children,drive_download,+ drive_upload,drive_create_folder,drive_rename,drive_delete,diff --git a/src/components/FileGlyph.tsx b/src/components/FileGlyph.tsxnew file mode 100644index 0000000..61501c4--- /dev/null+++ b/src/components/FileGlyph.tsx@@ -0,0 +1,145 @@+/**+ * What a row in Drive is, drawn rather than typed.+ *+ * A folder used to be the character "▸" and a file was its extension in capitals inside a+ * grey box. Both render at whatever weight and baseline the font feels like, so a list of+ * them never looked like one set of icons. These are one grid, one stroke weight, and they+ * carry the only distinction that matters at a glance: a folder you go into, a file you open,+ * and roughly what kind of file it is.+ */++/** The families Apple's own file browser tints apart. */+export type FileFamily =+ | "folder"+ | "app"+ | "image"+ | "video"+ | "audio"+ | "document"+ | "sheet"+ | "slides"+ | "archive"+ | "code"+ | "other";++const BY_EXTENSION: Record<string, FileFamily> = {+ jpg: "image", jpeg: "image", png: "image", gif: "image", heic: "image",+ webp: "image", tiff: "image", bmp: "image", svg: "image", raw: "image", dng: "image",+ mp4: "video", mov: "video", m4v: "video", avi: "video", mkv: "video", webm: "video",+ mp3: "audio", m4a: "audio", wav: "audio", aac: "audio", flac: "audio", aiff: "audio",+ pdf: "document", doc: "document", docx: "document", pages: "document",+ txt: "document", md: "document", rtf: "document", epub: "document",+ xls: "sheet", xlsx: "sheet", numbers: "sheet", csv: "sheet",+ ppt: "slides", pptx: "slides", key: "slides",+ zip: "archive", gz: "archive", tar: "archive", rar: "archive", "7z": "archive",+ js: "code", ts: "code", tsx: "code", jsx: "code", py: "code", rs: "code",+ json: "code", html: "code", css: "code", sh: "code", go: "code", java: "code",+};++/** Tints kept apart enough to tell at 20px, and legible on both a light and a dark ground. */+const TINT: Record<FileFamily, string> = {+ folder: "#3b82f6",+ app: "#8b5cf6",+ image: "#ec4899",+ video: "#6366f1",+ audio: "#f97316",+ document: "#ef4444",+ sheet: "#22c55e",+ slides: "#f59e0b",+ archive: "#a16207",+ code: "#0ea5e9",+ other: "#94a3b8",+};++export function familyOf(kind: string, extension: string | null): FileFamily {+ if (kind === "FOLDER") return "folder";+ if (kind === "APP_LIBRARY") return "app";+ return BY_EXTENSION[(extension ?? "").toLowerCase()] ?? "other";+}++export function tintOf(family: FileFamily): string {+ return TINT[family];+}++/** A closed folder, the way a file browser draws one. */+const FOLDER = (+ <path+ d="M2.5 5.2c0-.9.7-1.6 1.6-1.6h2.6c.5 0 1 .2 1.3.6l.8.9h5.1c.9 0 1.6.7 1.6 1.6v6.1c0 .9-.7 1.6-1.6 1.6H4.1c-.9 0-1.6-.7-1.6-1.6z"+ fill="currentColor"+ stroke="none"+ />+);++/** A sheet of paper with the corner turned, which is what every file browser means by a file. */+const PAGE = (+ <>+ <path+ d="M4 2.6h5.1L14 7.4v7.1c0 .6-.5 1.1-1.1 1.1H4c-.6 0-1.1-.5-1.1-1.1V3.7c0-.6.5-1.1 1.1-1.1z"+ fill="currentColor"+ fillOpacity="0.16"+ stroke="currentColor"+ strokeWidth="1.2"+ />+ <path d="M9 2.7v3.6c0 .6.5 1.1 1.1 1.1h3.6" fill="none" stroke="currentColor" strokeWidth="1.2" />+ </>+);++/** A stack of panes, for a bundle the phone treats as one app's store. */+const APP = (+ <>+ <rect x="2.6" y="2.6" width="5.4" height="5.4" rx="1.5" fill="currentColor" stroke="none" />+ <rect x="10" y="2.6" width="5.4" height="5.4" rx="1.5" fill="currentColor" fillOpacity="0.55" stroke="none" />+ <rect x="2.6" y="10" width="5.4" height="5.4" rx="1.5" fill="currentColor" fillOpacity="0.55" stroke="none" />+ <rect x="10" y="10" width="5.4" height="5.4" rx="1.5" fill="currentColor" fillOpacity="0.3" stroke="none" />+ </>+);++export function FileGlyph({ kind, extension }: { kind: string; extension: string | null }) {+ const family = familyOf(kind, extension);+ return (+ <svg+ className="file-glyph"+ viewBox="0 0 18 18"+ width="18"+ height="18"+ style={{ color: TINT[family] }}+ strokeLinecap="round"+ strokeLinejoin="round"+ aria-hidden="true"+ focusable="false"+ >+ {family === "folder" ? FOLDER : family === "app" ? APP : PAGE}+ </svg>+ );+}++/** Actions on a row, at the same weight as everything else drawn here. */+export type ActionName = "download" | "rename" | "move" | "delete" | "upload" | "newFolder";++const ACTIONS: Record<ActionName, React.ReactNode> = {+ download: <path d="M8 2.8v7.4M4.8 7.2 8 10.4l3.2-3.2M3.2 12.6h9.6" />,+ rename: <path d="m10.4 3.2 2.4 2.4-7 7H3.4V10.2zM9.2 4.4l2.4 2.4" />,+ move: <path d="M2.6 5.2a1.4 1.4 0 0 1 1.4-1.4h2.3l1 1.2h5.1a1.4 1.4 0 0 1 1.4 1.4M6.4 10.6h6.4M10.4 8.2l2.4 2.4-2.4 2.4" />,+ delete: <path d="M3.4 4.8h9.2M6.4 4.8V3.4h3.2v1.4M5 4.8l.6 8h4.8l.6-8M7 7v3.6M9 7v3.6" />,+ upload: <path d="M8 13.2V5.8M4.8 9 8 5.8 11.2 9M3.2 3.4h9.6" />,+ newFolder: <path d="M2.6 5.2a1.4 1.4 0 0 1 1.4-1.4h2.3l1 1.2h5.1a1.4 1.4 0 0 1 1.4 1.4v5.4a1.4 1.4 0 0 1-1.4 1.4H4a1.4 1.4 0 0 1-1.4-1.4zM8 7.6v3.4M6.3 9.3h3.4" />,+};++export function ActionGlyph({ name }: { name: ActionName }) {+ return (+ <svg+ viewBox="0 0 16 16"+ width="16"+ height="16"+ fill="none"+ stroke="currentColor"+ strokeWidth="1.35"+ strokeLinecap="round"+ strokeLinejoin="round"+ aria-hidden="true"+ focusable="false"+ >+ {ACTIONS[name]}+ </svg>+ );+}diff --git a/src/lib/ipc.ts b/src/lib/ipc.tsindex e451201..fd930ef 100644--- a/src/lib/ipc.ts+++ b/src/lib/ipc.ts@@ -103,6 +103,15 @@ export const api = {driveItem: (drivewsid: string) => invoke<DriveItem | null>("drive_item", { drivewsid }),/** Saves to Downloads; returns the path it landed at. */driveDownload: (drivewsid: string) => invoke<string>("drive_download", { drivewsid }),+ /**+ * Put files from this machine into a Drive folder. Paths only — the bytes are read and+ * streamed in the backend, never carried through a message.+ *+ * Resolves with the files that did not go up, one line each, so a single refusal does not+ * read as the whole upload failing.+ */+ driveUpload: (folderId: string, paths: string[]) =>+ invoke<string[]>("drive_upload", { folderId, paths }),driveCreateFolder: (parentId: string, name: string) =>invoke<void>("drive_create_folder", { parentId, name }),driveRename: (drivewsid: string, name: string) =>diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex d0ba93a..92d9b77 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -1,4 +1,6 @@import { useCallback, useEffect, useRef, useState } from "react";+import { open as openFileDialog } from "@tauri-apps/plugin-dialog";+import { getCurrentWebview } from "@tauri-apps/api/webview";import {api,driveName,@@ -7,6 +9,7 @@ import {DRIVE_ROOT,type DriveItem,} from "../lib/ipc";+import { ActionGlyph, FileGlyph } from "../components/FileGlyph";const KB = 1024;@@ -32,13 +35,6 @@ const modified = (seconds: number | null) =>year: "numeric",});-/** A folder glyph for containers, and the extension for files. */-function badge(item: DriveItem): string {- if (item.kind === "APP_LIBRARY") return "APP";- if (item.kind === "FOLDER") return "▸";- return (item.extension || "file").toUpperCase().slice(0, 4);-}-type Crumb = { id: string; name: string };export function DriveView() {@@ -55,6 +51,9 @@ export function DriveView() {const [newFolderName, setNewFolderName] = useState("");/** The item a Move dialog is open for, if any. */const [moving, setMoving] = useState<DriveItem | null>(null);+ const [uploading, setUploading] = useState(false);+ /** True while files are held over the window, so the drop target can say so. */+ const [dropping, setDropping] = useState(false);const here = trail[trail.length - 1];@@ -185,6 +184,87 @@ export function DriveView() {[refresh]);+ /**+ * Send files from this machine to the folder currently open.+ *+ * Only the paths cross into the backend; the bytes are read and streamed there, which is+ * what lets a large file go up without the interface holding it in memory.+ *+ * One file Apple refuses must not look like all of them failing, so each is reported by+ * name and the rest still land.+ */+ const upload = useCallback(+ async (paths: string[]) => {+ if (paths.length === 0) return;+ setUploading(true);+ setError(null);+ try {+ const failed = await api.driveUpload(here.id, paths);+ await refresh();+ if (failed.length > 0) {+ setError(+ failed.length === paths.length+ ? failed.join("\n")+ : `${failed.length} of ${paths.length} did not go up — ${failed.join("; ")}`+ );+ } else {+ setSavedTo(+ paths.length === 1+ ? `Uploaded ${paths[0].split("/").pop()}`+ : `Uploaded ${paths.length} files`+ );+ }+ } catch (e) {+ setError(messageOf(e));+ } finally {+ setUploading(false);+ }+ },+ [here.id, refresh]+ );++ const chooseAndUpload = useCallback(async () => {+ try {+ const chosen = await openFileDialog({ multiple: true, title: "Upload to iCloud Drive" });+ if (!chosen) return;+ await upload(Array.isArray(chosen) ? chosen : [chosen]);+ } catch (e) {+ setError(messageOf(e));+ }+ }, [upload]);++ // Dropping files on the window uploads them to the folder that is open. Tauri hands over+ // paths rather than contents, so a drop costs nothing until the file is actually read.+ useEffect(() => {+ let stop: (() => void) | undefined;+ let cancelled = false;+ // Outside the app shell — a browser running the interface on its own, as the checks do —+ // there is no webview to ask, and asking throws where it stands. Uploading by button+ // still works, so this is a capability that may be missing, not a failure.+ try {+ void getCurrentWebview()+ .onDragDropEvent((event) => {+ if (event.payload.type === "over") setDropping(true);+ else if (event.payload.type === "leave") setDropping(false);+ else if (event.payload.type === "drop") {+ setDropping(false);+ void upload(event.payload.paths);+ }+ })+ .then((unlisten) => {+ if (cancelled) unlisten();+ else stop = unlisten;+ })+ .catch(() => {});+ } catch {+ // No drag and drop here.+ }+ return () => {+ cancelled = true;+ stop?.();+ };+ }, [upload]);+const createFolder = useCallback(async () => {const name = newFolderName.trim();setCreatingFolder(false);@@ -200,7 +280,7 @@ export function DriveView() {}, [newFolderName, here.id, refresh]);return (- <div className="drive">+ <div className={`drive${dropping ? " is-dropping" : ""}`}><header className="cal-bar"><nav className="crumbs" aria-label="Folder path">{trail.map((crumb, i) => (@@ -222,14 +302,20 @@ export function DriveView() {</nav><div className="cal-actions"><button- className="quiet"+ className="quiet with-glyph"onClick={() => setCreatingFolder(true)}disabled={loading || creatingFolder}>- New folder+ <ActionGlyph name="newFolder" />+ New Folder</button>- <button className="quiet" onClick={() => void refresh()} disabled={loading}>- {loading ? "Refreshing…" : "Refresh"}+ <button+ className="primary with-glyph"+ onClick={() => void chooseAndUpload()}+ disabled={loading || uploading}+ >+ <ActionGlyph name="upload" />+ {uploading ? "Uploading…" : "Upload"}</button></div></header>@@ -255,8 +341,8 @@ export function DriveView() {void createFolder();}}>- <span className="drive-badge folder" aria-hidden="true">- ▸+ <span className="drive-badge" aria-hidden="true">+ <FileGlyph kind="FOLDER" extension={null} /></span><inputautoFocus@@ -284,8 +370,8 @@ export function DriveView() {<li key={item.drivewsid}>{renaming === item.drivewsid ? (<div className="drive-row">- <span className={`drive-badge${container ? " folder" : ""}`} aria-hidden="true">- {badge(item)}+ <span className="drive-badge" aria-hidden="true">+ <FileGlyph kind={item.kind} extension={item.extension} /></span><inputclassName="drive-rename-input"@@ -312,8 +398,12 @@ export function DriveView() {onClick={() => (container ? enter(item) : void download(item))}disabled={busy}>- <span className={`drive-badge${container ? " folder" : ""}`} aria-hidden="true">- {busy ? "…" : badge(item)}+ <span className="drive-badge" aria-hidden="true">+ {busy ? (+ <span className="drive-spinner" />+ ) : (+ <FileGlyph kind={item.kind} extension={item.extension} />+ )}</span><span className="drive-name">{driveName(item)}</span><span className="drive-meta">@@ -326,29 +416,43 @@ export function DriveView() {<span className="drive-meta">{modified(item.modifiedAt ?? item.createdAt)}</span></button><span className="drive-row-actions">+ {!container && (+ <button+ className="drive-action"+ aria-label={`Download ${driveName(item)}`}+ title="Download"+ disabled={busy}+ onClick={() => void download(item)}+ >+ <ActionGlyph name="download" />+ </button>+ )}<button- className="rem-list-action"+ className="drive-action"aria-label={`Move ${driveName(item)}`}+ title="Move to…"disabled={busy}onClick={() => setMoving(item)}>- ⇥+ <ActionGlyph name="move" /></button><button- className="rem-list-action"+ className="drive-action"aria-label={`Rename ${driveName(item)}`}+ title="Rename"disabled={busy}onClick={() => setRenaming(item.drivewsid)}>- ✎+ <ActionGlyph name="rename" /></button><button- className="rem-list-action danger"+ className="drive-action danger"aria-label={`Delete ${driveName(item)}`}+ title="Delete"disabled={busy}onClick={() => void remove(item)}>- ✕+ <ActionGlyph name="delete" /></button></span></div>@@ -488,8 +592,8 @@ function MoveDialog({setTrail((t) => [...t, { id: folder.drivewsid, name: driveName(folder) }])}>- <span className="drive-badge folder" aria-hidden="true">- ▸+ <span className="drive-badge" aria-hidden="true">+ <FileGlyph kind="FOLDER" extension={null} /></span><span className="drive-name">{driveName(folder)}</span></button>diff --git a/src/styles/app.css b/src/styles/app.cssindex 35b8278..6eeaa81 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -84,10 +84,16 @@/* ---- buttons ----------------------------------------------------------------- */+/*+ * White on the plain quince gold measures 2.8:1 — well under the 4.5:1 white text needs, and+ * it stood that way until an Upload button put a primary control on an audited screen for the+ * first time. The deeper gold measures 6.3:1 and is the same hue, so the accent is unchanged+ * and the label is legible.+ */.primary {border: 0;border-radius: var(--r-field);- background: var(--gold);+ background: var(--gold-deep);color: #fff;font: inherit;font-size: var(--t-13);@@ -97,7 +103,7 @@transition: background 130ms var(--ease), transform 130ms var(--ease);}-.primary:hover:not(:disabled) { background: var(--gold-strong); }+.primary:hover:not(:disabled) { background: #6a4c12; }.primary:active:not(:disabled) { transform: scale(0.985); }.primary:disabled {background: color-mix(in srgb, var(--text) 11%, transparent);@@ -435,7 +441,17 @@padding: 28px 34px 28px 248px;}.content h1 { margin: 0 0 6px; font-size: var(--t-28); font-weight: 600; letter-spacing: -0.022em; }-.content p { margin: 0 0 18px; color: var(--text-2); font-size: var(--t-15); max-width: 62ch; }+/*+ * Prose only — a paragraph nobody has given a job to.+ *+ * Without the :not this reads as `.content p`, which outranks every single-class rule in the+ * app and quietly took the margin, colour, size and measure off all of them: the "My Lists"+ * heading came out at 15px with an 18px gap under it instead of 11px with 4px, and the same+ * went for every error line, empty state, note timestamp and saved-to confirmation. A rule+ * meant to set the tone of body copy was overruling components that had asked for something+ * else.+ */+.content p:not([class]) { margin: 0 0 18px; color: var(--text-2); font-size: var(--t-15); max-width: 62ch; }.toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }@@ -1386,19 +1402,84 @@ textarea.note-text:disabled {animation: rem-moved-in 240ms var(--ease-spring) both;}+/* The icon carries its own colour and needs no plate behind it. */.drive-badge {display: grid;place-items: center;height: 22px;- border-radius: 5px;- background: color-mix(in srgb, var(--text) 10%, transparent);+}++.drive-spinner {+ width: 13px;+ height: 13px;+ border-radius: var(--r-pill);+ border: 1.6px solid color-mix(in srgb, var(--text) 22%, transparent);+ border-top-color: var(--text-2);+ animation: drive-spin 640ms linear infinite;+}++@keyframes drive-spin { to { transform: rotate(360deg); } }++@media (prefers-reduced-motion: reduce) {+ .drive-spinner { animation-duration: 2s; }+}++/*+ * What can be done to a row.+ *+ * These used to borrow the Reminders row-action style, whose reveal rule keys off a class+ * these rows do not have — so they were left at zero opacity and no amount of hovering+ * brought them back. Downloading, renaming, moving and deleting were all implemented and+ * none of them could be reached.+ */+.drive-action {+ display: grid;+ place-items: center;+ width: 26px;+ height: 26px;+ border: 0;+ border-radius: var(--r-field);+ background: none;color: var(--text-2);- font-size: 9px;+ cursor: pointer;+ transition: background 120ms var(--ease), color 120ms var(--ease);+}++.drive-action:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }+.drive-action.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }+.drive-action:focus-visible { outline: 3px solid var(--gold-ring); outline-offset: -1px; }+.drive-action:disabled { opacity: 0.4; cursor: default; }++/* A button whose icon sits with its label rather than replacing it. */+.with-glyph {+ display: inline-flex;+ align-items: center;+ gap: 6px;+}++/*+ * Files dragged over the window land in the folder that is open, so the whole surface says so+ * rather than asking the person to find a target.+ */+.drive.is-dropping::after {+ content: "Drop to upload here";+ position: absolute;+ inset: 8px;+ z-index: 3;+ display: grid;+ place-items: center;+ border-radius: var(--r-plateau);+ border: 2px dashed var(--gold-ring);+ background: color-mix(in srgb, var(--gold-tint) 70%, transparent);+ -webkit-backdrop-filter: blur(2px);+ backdrop-filter: blur(2px);+ color: var(--gold-strong);+ font-size: var(--t-13);font-weight: 600;- letter-spacing: 0.02em;+ pointer-events: none;}-.drive-badge.folder { background: var(--gold-tint); color: var(--gold-strong); font-size: var(--t-13); }+.drive { position: relative; }.drive-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.drive-meta { color: var(--text-2); font-size: var(--t-11); font-variant-numeric: tabular-nums; }