From 975f470ddfd1e265511acd6c5408d5ba56fc5b96 Mon Sep 17 00:00:00 2001 From: qaz741wsd856 Date: Sun, 25 Jan 2026 11:49:53 +0000 Subject: [PATCH] fix: update sync behavior to set domains to null when excludeDomains is true and add culture to profile --- src/handlers/sync.rs | 11 +++++++---- src/models/sync.rs | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/handlers/sync.rs b/src/handlers/sync.rs index 9d32e52..9a4697b 100644 --- a/src/handlers/sync.rs +++ b/src/handlers/sync.rs @@ -23,7 +23,7 @@ use serde_json::{json, Value}; #[derive(Debug, Deserialize)] pub struct SyncQuery { - /// If true, omit domains data from sync (vaultwarden sets domains to null). + /// If true, set `domains` to null (vaultwarden behavior). #[serde(rename = "excludeDomains", default)] pub exclude_domains: bool, } @@ -111,7 +111,7 @@ pub async fn get_sync_data( // "collections": [], // "policies": [], // "ciphers": [...], - // "domains": {...}, // omitted when excludeDomains=true + // "domains": {...} | null, // null when excludeDomains=true // "sends": [], // "userDecryption": {...}, // "object": "sync" @@ -135,13 +135,16 @@ pub async fn get_sync_data( ) .await?; - if !query.exclude_domains { + response.push_str(",\"domains\":"); + if query.exclude_domains { + response.push_str("null"); + } else { // Match vaultwarden sync semantics: // - mark excluded in /api/settings/domains // - filter excluded out of sync payload let global_equivalent_domains = domains::global_equivalent_domains_json(&db, &excluded_globals, false).await; - response.push_str(",\"domains\":{\"equivalentDomains\":"); + response.push_str("{\"equivalentDomains\":"); response.push_str(&equivalent_domains); response.push_str(",\"globalEquivalentDomains\":"); response.push_str(&global_equivalent_domains); diff --git a/src/models/sync.rs b/src/models/sync.rs index fbe8f99..5ba6829 100644 --- a/src/models/sync.rs +++ b/src/models/sync.rs @@ -9,13 +9,13 @@ use serde_json::Value; pub struct Profile { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub avatar_color: Option, pub email: String, pub id: String, pub security_stamp: String, pub object: String, pub premium_from_organization: bool, + pub culture: String, pub force_password_reset: bool, pub email_verified: bool, pub two_factor_enabled: bool, @@ -48,6 +48,7 @@ impl Profile { security_stamp: user.security_stamp, object: "profile".to_string(), premium_from_organization: false, + culture: "en-US".to_string(), force_password_reset: false, email_verified: true, two_factor_enabled,