feat(http): add http plugin version in user agent sting (#1501)

* feat(http): add http plugin version in user agent sting

* Update build.rs
pull/1498/head
Amr Bashir 11 months ago committed by GitHub
parent 720b60400f
commit 28bc5c2e3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,7 +5,7 @@
use std::sync::atomic::{AtomicBool, Ordering};
use tauri::{
menu::{Menu, MenuItem},
tray::{ClickType, TrayIconBuilder},
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
Manager, Runtime, WebviewUrl, WebviewWindowBuilder,
};
@ -107,7 +107,12 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
_ => {}
})
.on_tray_icon_event(|tray, event| {
if event.click_type == ClickType::Left {
if let TrayIconEvent::Click {
button_state: MouseButtonState::Down,
button: MouseButton::Left,
..
} = event
{
let app = tray.app_handle();
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();

@ -19,6 +19,8 @@ use crate::{
Error, Http, Result,
};
const HTTP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
struct ReqwestResponse(reqwest::Response);
type CancelableResponseResult = Result<Result<reqwest::Response>>;
@ -221,7 +223,7 @@ pub async fn fetch<R: Runtime>(
}
if !headers.contains_key(header::USER_AGENT.as_str()) {
request = request.header(header::USER_AGENT, "tauri-plugin-http");
request = request.header(header::USER_AGENT, HTTP_USER_AGENT);
}
if cfg!(feature = "unsafe-headers")

@ -18,7 +18,7 @@ const COMMANDS: &[&str] = &[
"list_channels",
"delete_channel",
"create_channel",
"permission_state"
"permission_state",
];
fn main() {

Loading…
Cancel
Save