vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit 85dbf4e16c60e9657552f6cedab3e5111115fe7c
parent e449912f05d63a3499609ae00184796dd7390bf0
Author: Patrick Li <patrick.li@ac3.co.nz>
Date:   Tue,  5 Nov 2019 15:30:57 +1300

Don't include excluded global equivalent domains during sync

Fixes #681

Diffstat:
Msrc/api/core/ciphers.rs | 2+-
Msrc/api/core/mod.rs | 8++++++++
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs @@ -88,7 +88,7 @@ fn sync(data: Form<SyncData>, headers: Headers, conn: DbConn) -> JsonResult { let domains_json = if data.exclude_domains { Value::Null } else { - api::core::get_eq_domains(headers).unwrap().into_inner() + api::core::_get_eq_domains(headers, true).unwrap().into_inner() }; Ok(Json(json!({ diff --git a/src/api/core/mod.rs b/src/api/core/mod.rs @@ -81,6 +81,10 @@ const GLOBAL_DOMAINS: &str = include_str!("../../static/global_domains.json"); #[get("/settings/domains")] fn get_eq_domains(headers: Headers) -> JsonResult { + _get_eq_domains(headers, false) +} + +fn _get_eq_domains(headers: Headers, no_excluded: bool) -> JsonResult { let user = headers.user; use serde_json::from_str; @@ -93,6 +97,10 @@ fn get_eq_domains(headers: Headers) -> JsonResult { global.Excluded = excluded_globals.contains(&global.Type); } + if no_excluded { + globals.retain(|g| !g.Excluded); + } + Ok(Json(json!({ "EquivalentDomains": equivalent_domains, "GlobalEquivalentDomains": globals,