diff options
author | Philipp Kolberg <[email protected]> | 2024-01-01 08:44:02 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-01 15:44:02 +0100 |
commit | 98b2178c7d314a0c4f8d85bf4f5396c7704bc88d (patch) | |
tree | 623b5d7b421cf6df1084c97ba3f6e1672b6e901b /src/api/core/mod.rs | |
parent | 76a3f0f531ef0b28b1dc1aefe276a0863f7bbd6d (diff) | |
download | vaultwarden-98b2178c7d314a0c4f8d85bf4f5396c7704bc88d.tar.gz vaultwarden-98b2178c7d314a0c4f8d85bf4f5396c7704bc88d.zip |
Allow customizing the featureStates (#4168)
* Allow customizing the featureStates
Use a comma separated list of features to enable using the FEATURE_FLAGS env variable
* Move feature flag parsing to util
* Fix formatting
* Update supported feature flags
* Rename feature_flags to experimental_client_feature_flags
Additionally, use a caret (^) instead of an exclamation mark (!) to disable features
* Fix formatting issue.
* Add documentation to env template
* Remove functionality to disable feature flags
* Fix JSON key for feature states
* Convert error to warning when feature flag is unrecognized
* Simplify parsing of feature flags
* Fix default value of feature flags in env template
* Fix formatting
Diffstat (limited to 'src/api/core/mod.rs')
-rw-r--r-- | src/api/core/mod.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/api/core/mod.rs b/src/api/core/mod.rs index 3919d2a6..7712ea82 100644 --- a/src/api/core/mod.rs +++ b/src/api/core/mod.rs @@ -46,15 +46,14 @@ pub fn events_routes() -> Vec<Route> { // // Move this somewhere else // -use rocket::{serde::json::Json, Catcher, Route}; -use serde_json::Value; +use rocket::{serde::json::Json, serde::json::Value, Catcher, Route}; use crate::{ api::{JsonResult, JsonUpcase, Notify, UpdateType}, auth::Headers, db::DbConn, error::Error, - util::get_reqwest_client, + util::{get_reqwest_client, parse_experimental_client_feature_flags}, }; #[derive(Serialize, Deserialize, Debug)] @@ -192,6 +191,7 @@ fn version() -> Json<&'static str> { #[get("/config")] fn config() -> Json<Value> { let domain = crate::CONFIG.domain(); + let feature_states = parse_experimental_client_feature_flags(&crate::CONFIG.experimental_client_feature_flags()); Json(json!({ // Note: The clients use this version to handle backwards compatibility concerns // This means they expect a version that closely matches the Bitwarden server version @@ -212,13 +212,7 @@ fn config() -> Json<Value> { "notifications": format!("{domain}/notifications"), "sso": "", }, - "featureStates": { - // Any feature flags that we want the clients to use - // Can check the enabled ones at: - // https://vault.bitwarden.com/api/config - "fido2-vault-credentials": true, // Passkey support - "autofill-v2": false, // Disabled because it is causing issues https://github.com/dani-garcia/vaultwarden/discussions/4052 - }, + "featureStates": feature_states, "object": "config", })) } |