Use single LAUNCHER_USER_AGENT constant for all user agents

This commit is contained in:
Josiah Glosson committed 2025-07-15 20:25:37 -05:00
1 parent 1e934312a4
commit 80e0f84b62
5 files changed
+26 -16

No files matched your search

+11 -1
View File
@@ -116,7 +116,17 @@ fn main() {
#[cfg(feature = "updater")]
{
builder = builder.plugin(tauri_plugin_updater::Builder::new().build());
use tauri_plugin_http::reqwest::header::{HeaderValue, USER_AGENT};
use theseus::LAUNCHER_USER_AGENT;
builder = builder.plugin(
tauri_plugin_updater::Builder::new()
.header(
USER_AGENT,
HeaderValue::from_str(LAUNCHER_USER_AGENT).unwrap(),
)
.unwrap()
.build(),
);
}
builder = builder
+4 -5
View File
@@ -7,12 +7,11 @@ use tauri_plugin_http::reqwest;
use tauri_plugin_http::reqwest::ClientBuilder;
use tauri_plugin_updater::Error;
use tauri_plugin_updater::Update;
use theseus::{LoadingBarType, emit_loading, init_loading};
use theseus::{
LAUNCHER_USER_AGENT, LoadingBarType, emit_loading, init_loading,
};
use tokio::time::Instant;
const UPDATER_USER_AGENT: &str =
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
#[derive(Default)]
pub struct PendingUpdateData(pub Mutex<Option<(Arc<Update>, Vec<u8>)>>);
@@ -32,7 +31,7 @@ pub async fn get_update_size<R: Runtime>(
);
}
let mut request = ClientBuilder::new().user_agent(UPDATER_USER_AGENT);
let mut request = ClientBuilder::new().user_agent(LAUNCHER_USER_AGENT);
if let Some(timeout) = update.timeout {
request = request.timeout(timeout);
}