aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/core
diff options
context:
space:
mode:
authorHsiangNianian <i@jyunko.cn>2026-01-18 12:13:49 +0800
committerHsiangNianian <i@jyunko.cn>2026-01-18 12:13:49 +0800
commit723738e5308b0195ad715e0fa49f19db754753c6 (patch)
tree8236ac770e6b7e3980498e822b80e62463c0f6e1 /src-tauri/src/core
parent6d82ab2275130f3bafdb7ec664297eb700321526 (diff)
downloadDropOut-723738e5308b0195ad715e0fa49f19db754753c6.tar.gz
DropOut-723738e5308b0195ad715e0fa49f19db754753c6.zip
fix(auth): prevent infinite recursion in get_client()
The fallback in the reqwest client builder was calling get_client() recursively, which would cause a stack overflow if Client::builder() failed. Now uses reqwest::Client::new() as the fallback. Also fixed User-Agent to be platform-agnostic. Reviewed-by: Claude Opus 4.5
Diffstat (limited to 'src-tauri/src/core')
-rw-r--r--src-tauri/src/core/auth.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rs
index ac5904c..e1e1588 100644
--- a/src-tauri/src/core/auth.rs
+++ b/src-tauri/src/core/auth.rs
@@ -6,9 +6,9 @@ use uuid::Uuid;
// This is critical because Microsoft's WAF often blocks requests without a valid UA
fn get_client() -> reqwest::Client {
reqwest::Client::builder()
- .user_agent("DropOut/1.0 (Linux)")
+ .user_agent("DropOut/1.0")
.build()
- .unwrap_or_else(|_| get_client())
+ .unwrap_or_else(|_| reqwest::Client::new())
}
#[derive(Debug, Clone, Serialize, Deserialize)]