atuin/atuin-server/src/utils.rs
Ellie Huxtable d2240e1163
Allow server configured page size (#994)
* Allow server configured page size

* Backwards compat via semver checks

* Correct header name
2023-05-21 15:21:51 +00:00

15 lines
369 B
Rust

use eyre::Result;
use semver::{Version, VersionReq};
pub fn client_version_min(user_agent: &str, req: &str) -> Result<bool> {
if user_agent.is_empty() {
return Ok(false);
}
let version = user_agent.replace("atuin/", "");
let req = VersionReq::parse(req)?;
let version = Version::parse(version.as_str())?;
Ok(req.matches(&version))
}