diff --git a/README.md b/README.md index 12e8dfb..99dfc7e 100644 --- a/README.md +++ b/README.md @@ -220,16 +220,16 @@ once its owner signs in there. `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` | The matching [collection](#collections) exists | +| 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 | ### Encrypted sync @@ -249,18 +249,19 @@ features they can use. #### Collections -| Collection | Size limit | Capability | -| ---------------------------------------------- | ---------- | -------------------------- | -| `settings` | 2 MiB | | -| `profiles`, `sessions`, `sessionsV2` | 8 MiB | | -| `watchStats` (per-device totals) | 8 MiB | `watch_stats` | -| `liveReminders` | 8 MiB | `live_reminders` | -| `subscriptions`, `playlistBookmarks` | 16 MiB | | -| `seenVideos` | 16 MiB | `seen_videos` | -| `seenPosts` | 16 MiB | `seen_posts` | -| `seenRssItems` | 16 MiB | `seen_rss_items` | -| `externalMediaPositions` (media opened by URL) | 16 MiB | `external_media_positions` | -| `playlists`, `history` | 64 MiB | | +| Collection | Size limit | Capability | +| --------------------------------------------------------- | ---------- | -------------------------- | +| `settings` | 2 MiB | | +| `notificationDismissals` (read and removed notifications) | 2 MiB | `notification_dismissals` | +| `profiles`, `sessions`, `sessionsV2` | 8 MiB | | +| `watchStats` (per-device totals) | 8 MiB | `watch_stats` | +| `liveReminders` | 8 MiB | `live_reminders` | +| `subscriptions`, `playlistBookmarks` | 16 MiB | | +| `seenVideos` | 16 MiB | `seen_videos` | +| `seenPosts` | 16 MiB | `seen_posts` | +| `seenRssItems` | 16 MiB | `seen_rss_items` | +| `externalMediaPositions` (media opened by URL) | 16 MiB | `external_media_positions` | +| `playlists`, `history` | 64 MiB | | All collections of an account, including pending changes, are limited to 128 MiB in total. `seenPosts` is separate from `seenVideos` so older clients diff --git a/src/dto.rs b/src/dto.rs index 991376b..673bab4 100644 --- a/src/dto.rs +++ b/src/dto.rs @@ -37,6 +37,7 @@ pub struct SyncCapabilities { pub live_reminders: u8, pub external_media_positions: u8, pub seen_rss_items: u8, + pub notification_dismissals: 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 549c45d..c3c8c84 100644 --- a/src/handlers/encrypted_sync.rs +++ b/src/handlers/encrypted_sync.rs @@ -86,6 +86,7 @@ pub(crate) fn sync_capabilities() -> SyncCapabilities { live_reminders: 1, external_media_positions: 1, seen_rss_items: 1, + notification_dismissals: 1, live_sync: 1, collection_changes: 1, } @@ -94,6 +95,8 @@ pub(crate) fn sync_capabilities() -> SyncCapabilities { fn collection_limit(collection: &str) -> HandlerResult { match collection { "settings" => Ok(2 * MEBIBYTE), + // Keys of the notifications read or removed on any device, capped by clients. + "notificationDismissals" => Ok(2 * MEBIBYTE), // `playbackSpeeds` remains readable for migration into `settings`. "sessions" | "sessionsV2" | "profiles" | "playbackSpeeds" => Ok(8 * MEBIBYTE), // Per-device watch time totals are merged by clients. @@ -578,6 +581,11 @@ mod tests { assert_eq!(super::sync_capabilities().external_media_positions, 1); assert_eq!(collection_limit("seenRssItems").unwrap(), 16 * MEBIBYTE); assert_eq!(super::sync_capabilities().seen_rss_items, 1); + assert_eq!( + collection_limit("notificationDismissals").unwrap(), + 2 * MEBIBYTE + ); + assert_eq!(super::sync_capabilities().notification_dismissals, 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 cc0ecee..3a678b5 100644 --- a/src/handlers/health.rs +++ b/src/handlers/health.rs @@ -59,6 +59,7 @@ mod tests { assert_eq!(json["capabilities"]["encrypted_sync"], 1); assert_eq!(json["capabilities"]["external_media_positions"], 1); assert_eq!(json["capabilities"]["seen_rss_items"], 1); + assert_eq!(json["capabilities"]["notification_dismissals"], 1); match &policy { Some(url) => assert_eq!(json["privacy_policy_url"], *url), None => assert!(json.get("privacy_policy_url").is_none()),