From fd4712accb319cd0084f7e97fea4d9d1299d8938 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Thu, 9 Feb 2023 08:27:39 +0100 Subject: feat: Add version number to user-agent (#173) * feat: Add version number to user-agent Uses a crate that allows for formatting at compile time. * fix: Add comment --- src-tauri/Cargo.lock | 27 +++++++++++++++++++++++++++ src-tauri/Cargo.toml | 2 ++ src-tauri/src/constants.rs | 5 ++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2c04ae71..266d40cc 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -92,6 +92,7 @@ dependencies = [ "anyhow", "async-recursion", "chrono", + "const_format", "game-scanner", "json5", "libthermite", @@ -460,6 +461,26 @@ dependencies = [ "memchr", ] +[[package]] +name = "const_format" +version = "0.2.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -4237,6 +4258,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "untrusted" version = "0.7.1" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d88b8231..693aad9a 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -46,6 +46,8 @@ game-scanner = "1.1.4" chrono = "0.4.23" # TypeScript bindings ts-rs = "6.1" +# const formatting +const_format = "0.2.30" [features] # by default Tauri runs in production mode diff --git a/src-tauri/src/constants.rs b/src-tauri/src/constants.rs index 4cc3c204..79c93f61 100644 --- a/src-tauri/src/constants.rs +++ b/src-tauri/src/constants.rs @@ -1,6 +1,9 @@ // This file stores various global constants values -pub const APP_USER_AGENT: &str = "R2NorthstarTools/FlightCore"; +use const_format::concatcp; + +// FlightCore user agent for web requests +pub const APP_USER_AGENT: &str = concatcp!("FlightCore/", env!("CARGO_PKG_VERSION")); // URL of the Northstar masterserver pub const MASTER_SERVER_URL: &str = "https://northstar.tf"; -- cgit v1.2.3