Skip to content

Commit

Permalink
Fix reporting of version number to remote API
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Apr 21, 2020
1 parent d19bb31 commit 024d51d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 3 additions & 4 deletions bot/src/api/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use anyhow::{bail, Error};
use bytes::Bytes;
use reqwest::{header, Client, Method, StatusCode, Url};

pub const USER_AGENT: &str = concat!("OxidizeBot/", version_str!());

/// Trait to deal with optional bodies.
///
/// Fix and replace once we get HRTB's or HRT's :cry:
Expand Down Expand Up @@ -160,10 +162,7 @@ impl RequestBuilder {
}
}

req = req.header(
header::USER_AGENT,
concat!("OxidizeBot/", env!("CARGO_PKG_VERSION")),
);
req = req.header(header::USER_AGENT, USER_AGENT);

req
};
Expand Down
9 changes: 8 additions & 1 deletion bot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ extern crate smallvec;

pub use async_injector as injector;

pub const VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/version.txt"));
/// Get the version number of the project.
macro_rules! version_str {
() => {
include_str!(concat!(env!("OUT_DIR"), "/version.txt"))
};
}

pub const VERSION: &str = version_str!();

#[macro_use]
mod macros;
Expand Down

0 comments on commit 024d51d

Please sign in to comment.