diff --git a/README.md b/README.md index ed64f89..dcebefc 100644 --- a/README.md +++ b/README.md @@ -260,11 +260,13 @@ Each legacy domain is removed transactionally only after its matching encrypted collection is stored, so an interrupted migration can safely resume. Ciphertext uploads have collection-specific limits: 2 MiB for settings, 8 MiB for profiles, watch statistics, and versioned or legacy -sessions, 16 MiB for subscriptions, playlist bookmarks, and seen-video or -seen-post marks, and 64 MiB for playlists and history. The `seen_posts: 1` +sessions, 16 MiB for subscriptions, playlist bookmarks, seen-video or +seen-post marks, and external media positions, and 64 MiB for playlists and history. The `seen_posts: 1` capability enables the separate `seenPosts` collection, so older clients syncing `seenVideos` cannot erase post marks. The `watch_stats: 1` capability -enables the `watchStats` collection for per-device totals. +enables the `watchStats` collection for per-device totals. The +`external_media_positions: 1` capability enables the `externalMediaPositions` +collection for playback positions of media that clients open by URL. The combined active encrypted collections for one account cannot exceed 128 MiB. Capability `collection_changes: 1` lets clients upload a small encrypted change diff --git a/src/dto.rs b/src/dto.rs index 1d6b9ca..27184c9 100644 --- a/src/dto.rs +++ b/src/dto.rs @@ -35,6 +35,7 @@ pub struct SyncCapabilities { pub seen_posts: u8, pub watch_stats: u8, pub live_reminders: u8, + pub external_media_positions: 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 dc826bd..561d089 100644 --- a/src/handlers/encrypted_sync.rs +++ b/src/handlers/encrypted_sync.rs @@ -84,6 +84,7 @@ pub(crate) fn sync_capabilities() -> SyncCapabilities { seen_posts: 1, watch_stats: 1, live_reminders: 1, + external_media_positions: 1, live_sync: 1, collection_changes: 1, } @@ -96,6 +97,8 @@ fn collection_limit(collection: &str) -> HandlerResult { "sessions" | "sessionsV2" | "profiles" | "playbackSpeeds" => Ok(8 * MEBIBYTE), // Per-device watch time totals are merged by clients. "watchStats" | "liveReminders" => Ok(8 * MEBIBYTE), + // Playback positions of media opened by URL instead of from YouTube. + "externalMediaPositions" => Ok(16 * MEBIBYTE), "subscriptions" | "playlistBookmarks" | "seenVideos" | "seenPosts" => Ok(16 * MEBIBYTE), "playlists" | "history" => Ok(MAX_ENCRYPTED_SYNC_BYTES), _ => Err(HandlerError::ValidationErrorWithContext( @@ -565,6 +568,11 @@ mod tests { assert_eq!(collection_limit("seenVideos").unwrap(), 16 * MEBIBYTE); assert_eq!(collection_limit("watchStats").unwrap(), 8 * MEBIBYTE); assert_eq!(collection_limit("liveReminders").unwrap(), 8 * MEBIBYTE); + assert_eq!( + collection_limit("externalMediaPositions").unwrap(), + 16 * MEBIBYTE + ); + assert_eq!(super::sync_capabilities().external_media_positions, 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 5f348d6..b8cf087 100644 --- a/src/handlers/health.rs +++ b/src/handlers/health.rs @@ -57,6 +57,7 @@ mod tests { actix_web::test::call_and_read_body_json(&app, request).await; assert_eq!(json["status"], "ok"); assert_eq!(json["capabilities"]["encrypted_sync"], 1); + assert_eq!(json["capabilities"]["external_media_positions"], 1); match &policy { Some(url) => assert_eq!(json["privacy_policy_url"], *url), None => assert!(json.get("privacy_policy_url").is_none()),