aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-common
diff options
context:
space:
mode:
Diffstat (limited to 'atuin-common')
-rw-r--r--atuin-common/Cargo.toml3
-rw-r--r--atuin-common/src/api.rs11
2 files changed, 14 insertions, 0 deletions
diff --git a/atuin-common/Cargo.toml b/atuin-common/Cargo.toml
index 88c3022e..847cea96 100644
--- a/atuin-common/Cargo.toml
+++ b/atuin-common/Cargo.toml
@@ -20,6 +20,9 @@ rand = { workspace = true }
typed-builder = { workspace = true }
eyre = { workspace = true }
sqlx = { workspace = true }
+semver = { workspace = true }
+
+lazy_static = "1.4.0"
[dev-dependencies]
pretty_assertions = { workspace = true }
diff --git a/atuin-common/src/api.rs b/atuin-common/src/api.rs
index ddcc0b09..b608937f 100644
--- a/atuin-common/src/api.rs
+++ b/atuin-common/src/api.rs
@@ -1,7 +1,18 @@
+use lazy_static::lazy_static;
+use semver::Version;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use time::OffsetDateTime;
+// the usage of X- has been deprecated for quite along time, it turns out
+pub static ATUIN_HEADER_VERSION: &str = "Atuin-Version";
+pub static ATUIN_CARGO_VERSION: &str = env!("CARGO_PKG_VERSION");
+
+lazy_static! {
+ pub static ref ATUIN_VERSION: Version =
+ Version::parse(ATUIN_CARGO_VERSION).expect("failed to parse self semver");
+}
+
#[derive(Debug, Serialize, Deserialize)]
pub struct UserResponse {
pub username: String,