diff options
author | Edvin Ã…kerfeldt <edvin.akerfeldt@hotmail.com> | 2023-12-14 09:21:57 +0100 |
---|---|---|
committer | Edvin Ã…kerfeldt <edvin.akerfeldt@hotmail.com> | 2023-12-21 20:04:01 +0100 |
commit | 8bb2593143d064a03587f462199926b51e97deee (patch) | |
tree | 1b054042600897d5ce204df0885713a31cfbb473 | |
parent | bb1791d14e64ad83fb57116a24eb913a4946afed (diff) | |
download | rbw-8bb2593143d064a03587f462199926b51e97deee.tar.gz rbw-8bb2593143d064a03587f462199926b51e97deee.zip |
Fix bitwarden.eu URLs
Bitwarden have introduced an eu instance of their service.
This needs to be reflected in the code by excluding the eu addresses
from URL formatting.
-rw-r--r-- | src/config.rs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs index 03a9641..557bfc0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -146,7 +146,14 @@ impl Config { pub fn base_url(&self) -> String { self.base_url.clone().map_or_else( || "https://api.bitwarden.com".to_string(), - |url| format!("{}/api", url.trim_end_matches('/')), + |url| { + let clean_url = format!("{}", url.trim_end_matches('/')); + if clean_url == "https://api.bitwarden.eu" { + clean_url + } else { + format!("{}/api", clean_url) + } + }, ) } @@ -155,7 +162,14 @@ impl Config { self.identity_url.clone().unwrap_or_else(|| { self.base_url.clone().map_or_else( || "https://identity.bitwarden.com".to_string(), - |url| format!("{}/identity", url.trim_end_matches('/')), + |url| { + let clean_url = format!("{}", url.trim_end_matches('/')); + if clean_url == "https://identity.bitwarden.eu" { + clean_url + } else { + format!("{}/identity", clean_url) + } + } ) }) } @@ -165,7 +179,14 @@ impl Config { self.notifications_url.clone().unwrap_or_else(|| { self.base_url.clone().map_or_else( || "https://notifications.bitwarden.com".to_string(), - |url| format!("{}/notifications", url.trim_end_matches('/')), + |url| { + let clean_url = format!("{}", url.trim_end_matches('/')); + if clean_url == "https://notifications.bitwarden.eu" { + clean_url + } else { + format!("{}/notifications", clean_url) + } + } ) }) } |