Browse Source

Remove functionality to disable feature flags

pull/4168/head
Philipp Kolberg 2 years ago
parent
commit
4507c118e7
No known key found for this signature in database GPG Key ID: 4C58CB0448FF9061
  1. 5
      .env.template
  2. 8
      src/config.rs
  3. 8
      src/util.rs

5
.env.template

@ -391,9 +391,8 @@
# AUTHENTICATOR_DISABLE_TIME_DRIFT=false
## Client Settings
## En- or disable experimental feature flags for clients.
## This is a comma-separated list of flags, e.g. "flag1,flag2,^flag3".
## To disable a feature prepend a caret (^) to the flag name.
## Enable experimental feature flags for clients.
## This is a comma-separated list of flags, e.g. "flag1,flag2,flag3".
##
## The following flags are available:
## - "autofill-overlay": Add an overlay menu to form fields for quick access to credentials.

8
src/config.rs

@ -547,10 +547,8 @@ make_config! {
/// TOTP codes of the previous and next 30 seconds will be invalid.
authenticator_disable_time_drift: bool, true, def, false;
/// Customize the enabled feature flags on the clients |> This is a comma separated list of feature flags to en-/disable.
/// Features are enabled by default which can be overridden by prefixing the feature with a `^`.
/// Autofill v2 is disabled by default because it is causing issues https://github.com/dani-garcia/vaultwarden/discussions/4052
experimental_client_feature_flags: String, false, def, "^autofill-v2,fido2-vault-credentials".to_string();
/// Customize the enabled feature flags on the clients |> This is a comma separated list of feature flags to enable.
experimental_client_feature_flags: String, false, def, "fido2-vault-credentials".to_string();
/// Require new device emails |> When a user logs in an email is required to be sent.
/// If sending the email fails the login attempt will fail.
@ -760,7 +758,7 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
&["autofill-overlay", "autofill-v2", "browser-fileless-import", "fido2-vault-credentials"];
for flag in parse_experimental_client_feature_flags(&cfg.experimental_client_feature_flags).keys() {
if !KNOWN_FLAGS.contains(&flag.as_str()) {
err!(format!("The experimental client feature flag {flag:?} is unrecognized. Please ensure the feature flag is spelled correctly, a caret (^) is used for disabling and that it is supported in this version."));
err!(format!("The experimental client feature flag {flag:?} is unrecognized. Please ensure the feature flag is spelled correctly and that it is supported in this version."));
}
}

8
src/util.rs

@ -756,13 +756,7 @@ pub fn parse_experimental_client_feature_flags(experimental_client_feature_flags
let mut feature_states: HashMap<String, bool> = HashMap::new();
for feature in features {
let is_enabled = !feature.starts_with('^');
let flag = if is_enabled {
feature
} else {
&feature[1..]
};
feature_states.insert(flag.to_string(), is_enabled);
feature_states.insert(feature.to_string(), true);
}
feature_states

Loading…
Cancel
Save