aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/constants.rs3
-rw-r--r--src-tauri/src/github/release_notes.rs4
-rw-r--r--src-tauri/src/lib.rs1
3 files changed, 6 insertions, 2 deletions
diff --git a/src-tauri/src/constants.rs b/src-tauri/src/constants.rs
new file mode 100644
index 00000000..9d7e117c
--- /dev/null
+++ b/src-tauri/src/constants.rs
@@ -0,0 +1,3 @@
+// This file stores various global constants values
+
+pub const APP_USER_AGENT: &str = "R2NorthstarTools/FlightCore";
diff --git a/src-tauri/src/github/release_notes.rs b/src-tauri/src/github/release_notes.rs
index a1d174fa..758f7ace 100644
--- a/src-tauri/src/github/release_notes.rs
+++ b/src-tauri/src/github/release_notes.rs
@@ -1,3 +1,4 @@
+use crate::constants::APP_USER_AGENT;
use serde::{Deserialize, Serialize};
use std::vec::Vec;
@@ -18,11 +19,10 @@ pub struct FlightCoreVersion {
async fn fetch_github_releases_api(url: &str) -> Result<String, String> {
println!("Fetching releases notes from GitHub API");
- let user_agent = "R2NorthstarTools/FlightCore";
let client = reqwest::Client::new();
let res = client
.get(url)
- .header(reqwest::header::USER_AGENT, user_agent)
+ .header(reqwest::header::USER_AGENT, APP_USER_AGENT)
.send()
.await
.unwrap()
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index f8ea6aba..f0ffa8de 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -4,6 +4,7 @@ use anyhow::{anyhow, Context, Result};
mod northstar;
+pub mod constants;
mod platform_specific;
#[cfg(target_os = "windows")]
use platform_specific::windows;