diff --git a/server/Cargo.toml b/server/Cargo.toml index b0a841893..65134510a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -99,6 +99,7 @@ static-files = "0.2" ureq = "2.6" vergen = { version = "8.1", features = ["build", "git", "cargo", "gitcl"] } zip = { version = "0.6", default_features = false, features = ["deflate"] } +url = "2.4.0" [dev-dependencies] maplit = "1.0" diff --git a/server/build.rs b/server/build.rs index cc60f6ed3..f1c1dc5b2 100644 --- a/server/build.rs +++ b/server/build.rs @@ -139,6 +139,17 @@ mod ui { file.write_all(checksum.as_bytes())?; file.flush()?; + if local_assets_path.is_none() { + // emit ui version for asset url + let url = url::Url::parse(url).expect("valid url"); + let ui_version = url + .path_segments() + .expect("has segemnts") + .find(|v| v.starts_with('v')) + .expect("version segement"); + println!("cargo:rustc-env=UI_VERSION={}", ui_version); + } + Ok(()) } } diff --git a/server/src/handlers/http/about.rs b/server/src/handlers/http/about.rs index 40a0e4d93..5ab6ccfba 100644 --- a/server/src/handlers/http/about.rs +++ b/server/src/handlers/http/about.rs @@ -44,9 +44,11 @@ pub async fn about() -> Json { let store = CONFIG.storage().get_endpoint(); let is_llm_active = &CONFIG.parseable.open_ai_key.is_some(); let llm_provider = is_llm_active.then_some("OpenAI"); + let ui_version = option_env!("UI_VERSION").unwrap_or("development"); Json(json!({ "version": current_version, + "uiVersion": ui_version, "commit": commit, "deploymentId": deployment_id, "updateAvailable": update_available,