diff options
author | Jesse Luehrs <doy@tozt.net> | 2024-01-01 15:55:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 15:55:16 -0500 |
commit | 21e70ce32bdab89adbb66b32c8b69d4b806e5d5f (patch) | |
tree | 71181d78a09928ba4f11b07f1000ecb32815a417 | |
parent | 0ba66bff866a15a40555c1340615173f4f54d733 (diff) | |
parent | 8bb2593143d064a03587f462199926b51e97deee (diff) | |
download | rbw-21e70ce32bdab89adbb66b32c8b69d4b806e5d5f.tar.gz rbw-21e70ce32bdab89adbb66b32c8b69d4b806e5d5f.zip |
Merge pull request #152 from Ironedde/fixing-eu-url
Fix bitwarden.eu URLs
-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) + } + } ) }) } |