From 915b9bb0e50e471a601edde707f5d3c083c2b8b4 Mon Sep 17 00:00:00 2001 From: Bat Date: Sat, 6 Oct 2018 18:33:10 +0100 Subject: [PATCH] Use env!("CARGO_PKG_VERSION") instead of hardcoding version when possible See https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates --- plume-cli/src/main.rs | 2 +- plume-common/src/activity_pub/request.rs | 2 +- src/routes/instance.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plume-cli/src/main.rs b/plume-cli/src/main.rs index 557e58be..8243f744 100644 --- a/plume-cli/src/main.rs +++ b/plume-cli/src/main.rs @@ -15,7 +15,7 @@ mod users; fn main() { let mut app = App::new("Plume CLI") .bin_name("plm") - .version("0.2.0") + .version(env!("CARGO_PKG_VERSION")) .about("Collection of tools to manage your Plume instance.") .subcommand(instance::command()) .subcommand(users::command()); diff --git a/plume-common/src/activity_pub/request.rs b/plume-common/src/activity_pub/request.rs index fa9313f9..79514824 100644 --- a/plume-common/src/activity_pub/request.rs +++ b/plume-common/src/activity_pub/request.rs @@ -9,7 +9,7 @@ use std::time::SystemTime; use activity_pub::ap_accept_header; use activity_pub::sign::Signer; -const USER_AGENT: &'static str = "Plume/0.2.0"; +const USER_AGENT: &'static str = concat!("Plume/", env!("CARGO_PKG_VERSION")); header! { (Signature, "Signature") => [String] diff --git a/src/routes/instance.rs b/src/routes/instance.rs index 7e50c813..4880c2f9 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -219,7 +219,7 @@ fn nodeinfo(conn: DbConn) -> Json { "version": "2.0", "software": { "name": "Plume", - "version": "0.2.0" + "version": env!("CARGO_PKG_VERSION") }, "protocols": ["activitypub"], "services": { @@ -244,7 +244,7 @@ fn about(user: Option, conn: DbConn) -> Template { "account": user.map(|u| u.to_json(&*conn)), "instance": Instance::get_local(&*conn), "admin": Instance::get_local(&*conn).map(|i| i.main_admin(&*conn).to_json(&*conn)), - "version": "0.2.0", + "version": env!("CARGO_PKG_VERSION"), "n_users": User::count_local(&*conn), "n_articles": Post::count_local(&*conn), "n_instances": Instance::count(&*conn) - 1