d2240e1163
* Allow server configured page size * Backwards compat via semver checks * Correct header name
15 lines
369 B
Rust
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))
|
|
}
|