feat: add UA to webdav

This commit is contained in:
wonfen 2025-04-23 00:29:29 +08:00
parent a0b70f9c34
commit babc2c8f9b
2 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,7 @@
- 允许代理主机地址设置为非 127.0.0.1 对 WSL 代理友好 - 允许代理主机地址设置为非 127.0.0.1 对 WSL 代理友好
- 关闭系统代理时关闭已建立的网络连接 - 关闭系统代理时关闭已建立的网络连接
- 托盘显示当前轻量模式状态 - 托盘显示当前轻量模式状态
- Webdav 请求加入 UA
#### 优化了: #### 优化了:
- 系统代理 Bypass 设置 - 系统代理 Bypass 设置

View File

@ -15,6 +15,9 @@ use std::{
use tokio::time::timeout; use tokio::time::timeout;
use zip::write::SimpleFileOptions; use zip::write::SimpleFileOptions;
// 应用版本常量,来自 tauri.conf.json
const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
const TIMEOUT_UPLOAD: u64 = 300; // 上传超时 5 分钟 const TIMEOUT_UPLOAD: u64 = 300; // 上传超时 5 分钟
const TIMEOUT_DOWNLOAD: u64 = 300; // 下载超时 5 分钟 const TIMEOUT_DOWNLOAD: u64 = 300; // 下载超时 5 分钟
const TIMEOUT_LIST: u64 = 3; // 列表超时 30 秒 const TIMEOUT_LIST: u64 = 3; // 列表超时 30 秒
@ -105,6 +108,10 @@ impl WebDavClient {
reqwest::Client::builder() reqwest::Client::builder()
.danger_accept_invalid_certs(true) .danger_accept_invalid_certs(true)
.timeout(Duration::from_secs(op.timeout())) .timeout(Duration::from_secs(op.timeout()))
.user_agent(format!(
"clash-verge/{} ({} WebDAV-Client)",
APP_VERSION, OS
))
.build() .build()
.unwrap(), .unwrap(),
) )