chore(deps): 全量升级依赖,适配 gpui-kit 0.7 与 ureq 3
- gpui-kit 0.6→0.7:main.rs 改用 gpui_kit::open_window 自动挂载 Root, 移除内容视图手动挂载的 dialog/sheet/notification 层 - ureq 2→3:Agent::config_builder 配置超时(global/connect/recv_response), 响应体改用 read_json / read_to_string / into_body().into_reader() - hmac 0.13 需显式导入 KeyInit;digest 0.11 的 Output 不再实现 LowerHex, sha256 转 hex 改为逐字节格式化,并补已知向量测试 - windows 0.62:SetWindowPos 插入位置参数改为 Option<HWND> - dirs 6→7、base64 0.22→0.23,其余锁内更新(tokio/sentry/rustls 等) - TLS 栈不变(rustls + webpki-roots),无 openssl/native-tls 混入 已验证:cargo check 零警告;35 测试通过;运行应用截图核验主界面、 新建连接对话框打开与关闭均正常
This commit is contained in:
@@ -3,20 +3,23 @@
|
||||
use super::*;
|
||||
|
||||
pub(super) fn agent() -> ureq::Agent {
|
||||
ureq::AgentBuilder::new()
|
||||
// 整体上限:防止慢速滴流的下载无限占用阻塞线程
|
||||
.timeout(std::time::Duration::from_secs(10 * 60))
|
||||
.timeout_connect(std::time::Duration::from_secs(HTTP_TIMEOUT_SECS))
|
||||
.timeout_read(std::time::Duration::from_secs(HTTP_TIMEOUT_SECS))
|
||||
.build()
|
||||
ureq::Agent::new_with_config(
|
||||
ureq::Agent::config_builder()
|
||||
// 整体上限:防止慢速滴流的下载无限占用阻塞线程
|
||||
.timeout_global(Some(std::time::Duration::from_secs(10 * 60)))
|
||||
.timeout_connect(Some(std::time::Duration::from_secs(HTTP_TIMEOUT_SECS)))
|
||||
.timeout_recv_response(Some(std::time::Duration::from_secs(HTTP_TIMEOUT_SECS)))
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) fn http_get_json(url: &str) -> Result<serde_json::Value, String> {
|
||||
let resp = agent()
|
||||
let mut body = agent()
|
||||
.get(url)
|
||||
.call()
|
||||
.map_err(|e| format!("请求失败: {e}"))?;
|
||||
resp.into_json::<serde_json::Value>()
|
||||
.map_err(|e| format!("请求失败: {e}"))?
|
||||
.into_body();
|
||||
body.read_json::<serde_json::Value>()
|
||||
.map_err(|e| format!("解析响应失败: {e}"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user