diff options
author | Daniel GarcĂa <[email protected]> | 2018-10-17 23:49:09 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-10-17 23:49:09 +0200 |
commit | d613fa1e689f4cd308ba89d37d14831508d46002 (patch) | |
tree | 7d244c54c8b1bfc4db7d9c36f625563f2b119d0a | |
parent | adf40291e886b46f6241de5eb464057eac610ad3 (diff) | |
parent | 55fbd8d4685aaed57332165b69162df11064fbae (diff) | |
download | vaultwarden-d613fa1e689f4cd308ba89d37d14831508d46002.tar.gz vaultwarden-d613fa1e689f4cd308ba89d37d14831508d46002.zip |
Merge pull request #225 from janost/sync-exclude-domains
Don't send Domains if excludeDomains=true on /sync
-rw-r--r-- | src/api/core/ciphers.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 8c9cd6a4..6a8a1c02 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -22,8 +22,14 @@ use auth::Headers; use CONFIG; -#[get("/sync")] -fn sync(headers: Headers, conn: DbConn) -> JsonResult { +#[derive(FromForm)] +#[allow(non_snake_case)] +struct SyncData { + excludeDomains: bool, +} + +#[get("/sync?<data>")] +fn sync(data: SyncData, headers: Headers, conn: DbConn) -> JsonResult { let user_json = headers.user.to_json(&conn); let folders = Folder::find_by_user(&headers.user.uuid, &conn); @@ -35,7 +41,7 @@ fn sync(headers: Headers, conn: DbConn) -> JsonResult { let ciphers = Cipher::find_by_user(&headers.user.uuid, &conn); let ciphers_json: Vec<Value> = ciphers.iter().map(|c| c.to_json(&headers.host, &headers.user.uuid, &conn)).collect(); - let domains_json = api::core::get_eq_domains(headers).unwrap().into_inner(); + let domains_json = if data.excludeDomains { Value::Null } else { api::core::get_eq_domains(headers).unwrap().into_inner() }; Ok(Json(json!({ "Profile": user_json, |