From 255a7bccb6c0a7a2cd4ef24a58599aedbfc91aab Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 2 Jul 2024 14:13:45 +0100 Subject: [PATCH] feat: allow advertising a fake version to clients (#2228) * feat: allow advertising a fake version to clients The server usually runs unstable Atuin, and is well monitored. But let's not advertised the unstable version to clients, as they will notify users there is an update available. * fix test build --- crates/atuin-server/src/handlers/mod.rs | 8 +++++++- crates/atuin-server/src/settings.rs | 7 +++++++ crates/atuin/tests/common/mod.rs | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/atuin-server/src/handlers/mod.rs b/crates/atuin-server/src/handlers/mod.rs index 50f82336..ce10f4b7 100644 --- a/crates/atuin-server/src/handlers/mod.rs +++ b/crates/atuin-server/src/handlers/mod.rs @@ -19,10 +19,16 @@ pub async fn index(state: State>) -> Json { pub tls: Tls, pub mail: Mail, + /// Advertise a version that is not what we are _actually_ running + /// Many clients compare their version with api.atuin.sh, and if they differ, notify the user + /// that an update is available. + /// Now that we take beta releases, we should be able to advertise a different version to avoid + /// notifying users when the server runs something that is not a stable release. + pub fake_version: Option, + #[serde(flatten)] pub db_settings: DbSettings, } diff --git a/crates/atuin/tests/common/mod.rs b/crates/atuin/tests/common/mod.rs index 84e3cea6..015098e9 100644 --- a/crates/atuin/tests/common/mod.rs +++ b/crates/atuin/tests/common/mod.rs @@ -39,6 +39,7 @@ pub async fn start_server(path: &str) -> (String, oneshot::Sender<()>, JoinHandl metrics: atuin_server::settings::Metrics::default(), tls: atuin_server::settings::Tls::default(), mail: atuin_server::settings::Mail::default(), + fake_version: None, }; let (shutdown_tx, shutdown_rx) = tokio::sync::oneshot::channel();