Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/handlers/encrypted_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -94,6 +95,8 @@ pub(crate) fn sync_capabilities() -> SyncCapabilities {
fn collection_limit(collection: &str) -> HandlerResult<usize> {
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.
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/handlers/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
Loading