From 8c2d902c4bb0fd2c32e9e33cc80cfb9baa3b69ea Mon Sep 17 00:00:00 2001 From: D3SOX Date: Wed, 18 Nov 2026 08:43:09 +0100 Subject: [PATCH] feat(sync): accept syncDeletions collection and report sync_deletions capability --- README.md | 23 ++++++++++++----------- src/dto.rs | 1 + src/handlers/encrypted_sync.rs | 5 +++++ src/handlers/health.rs | 1 + 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5114772..2d2c8d6 100644 --- a/README.md +++ b/README.md @@ -234,17 +234,17 @@ it report `"oidc_state": true` in `GET /meta`. `privacy_policy_url` if configured. Clients use the capabilities to decide which features they can use. -| Capability | Meaning | -| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -| `encrypted_sync` | [Encrypted sync](#encrypted-sync) is available | -| `collection_changes` | Collections accept [incremental changes](#incremental-changes) | -| `live_sync` | [Change notifications and device requests](#live-sync) | -| `account_sessions` | Tokens are bound to [account sessions](#account-sessions) | -| `key_pairing` | [Secure device pairing](#secure-device-pairing) | -| `bulk_sync` | Plaintext subscriptions and watch history accept bulk uploads | -| `history_page_size` | Maximum page size for plaintext watch history | -| `seen_videos`, `seen_posts`, `seen_rss_items`, `watch_stats`, `live_reminders`, `external_media_positions`, `notification_dismissals` | The matching [collection](#collections) exists | -| `separate_profiles` | [Separate profiles](#separate-profiles) have their own collections | +| Capability | Meaning | +| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| `encrypted_sync` | [Encrypted sync](#encrypted-sync) is available | +| `collection_changes` | Collections accept [incremental changes](#incremental-changes) | +| `live_sync` | [Change notifications and device requests](#live-sync) | +| `account_sessions` | Tokens are bound to [account sessions](#account-sessions) | +| `key_pairing` | [Secure device pairing](#secure-device-pairing) | +| `bulk_sync` | Plaintext subscriptions and watch history accept bulk uploads | +| `history_page_size` | Maximum page size for plaintext watch history | +| `seen_videos`, `seen_posts`, `seen_rss_items`, `watch_stats`, `live_reminders`, `external_media_positions`, `notification_dismissals`, `sync_deletions` | The matching [collection](#collections) exists | +| `separate_profiles` | [Separate profiles](#separate-profiles) have their own collections | ### Encrypted sync @@ -278,6 +278,7 @@ features they can use. | `seenPosts` | 16 MiB | `seen_posts` | | `seenRssItems` | 16 MiB | `seen_rss_items` | | `externalMediaPositions` (media opened by URL) | 16 MiB | `external_media_positions` | +| `syncDeletions` (deletions confirmed on a device) | 16 MiB | `sync_deletions` | | `playlists`, `history` | 64 MiB | | All collections of an account, including pending changes, are limited to diff --git a/src/dto.rs b/src/dto.rs index fa04892..cbc4edd 100644 --- a/src/dto.rs +++ b/src/dto.rs @@ -38,6 +38,7 @@ pub struct SyncCapabilities { pub external_media_positions: u8, pub seen_rss_items: u8, pub notification_dismissals: u8, + pub sync_deletions: u8, pub live_sync: u8, /// Collections accept appended changes and incremental reads. pub collection_changes: u8, diff --git a/src/handlers/encrypted_sync.rs b/src/handlers/encrypted_sync.rs index 3e26f36..e51ba16 100644 --- a/src/handlers/encrypted_sync.rs +++ b/src/handlers/encrypted_sync.rs @@ -88,6 +88,7 @@ pub(crate) fn sync_capabilities() -> SyncCapabilities { external_media_positions: 1, seen_rss_items: 1, notification_dismissals: 1, + sync_deletions: 1, live_sync: 1, collection_changes: 1, separate_profiles: 1, @@ -130,6 +131,8 @@ fn collection_limit(collection: &str) -> HandlerResult { "watchStats" | "liveReminders" => Ok(8 * MEBIBYTE), // Playback positions of media opened by URL instead of from YouTube. "externalMediaPositions" => Ok(16 * MEBIBYTE), + // Deletions devices confirmed, so other devices apply them without asking. + "syncDeletions" => Ok(16 * MEBIBYTE), "subscriptions" | "playlistBookmarks" | "seenVideos" | "seenPosts" | "seenRssItems" => { Ok(16 * MEBIBYTE) } @@ -640,6 +643,8 @@ mod tests { 2 * MEBIBYTE ); assert_eq!(super::sync_capabilities().notification_dismissals, 1); + assert_eq!(collection_limit("syncDeletions").unwrap(), 16 * MEBIBYTE); + assert_eq!(super::sync_capabilities().sync_deletions, 1); assert_eq!(super::sync_capabilities().live_reminders, 1); assert_eq!(super::sync_capabilities().watch_stats, 1); assert_eq!(super::sync_capabilities().seen_videos, 1); diff --git a/src/handlers/health.rs b/src/handlers/health.rs index ce79346..a8bd61c 100644 --- a/src/handlers/health.rs +++ b/src/handlers/health.rs @@ -80,6 +80,7 @@ mod tests { assert_eq!(json["capabilities"]["external_media_positions"], 1); assert_eq!(json["capabilities"]["seen_rss_items"], 1); assert_eq!(json["capabilities"]["notification_dismissals"], 1); + assert_eq!(json["capabilities"]["sync_deletions"], 1); assert_eq!(json["capabilities"]["separate_profiles"], 1); match &policy { Some(url) => assert_eq!(json["privacy_policy_url"], *url),