mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
fix: 修复凭证导入可能导致的崩溃问题 (Fixes #47)
- 修复字符串切片可能在 UTF-8 边界 panic 的问题 - 修复 machine_id 切片可能越界的问题 - 添加更详细的日志记录以便调试 - 版本更新至 0.20.4
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "proxycast",
|
||||
"private": true,
|
||||
"version": "0.20.3",
|
||||
"version": "0.20.4",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Generated
+1
-1
@@ -3668,7 +3668,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proxycast"
|
||||
version = "0.20.3"
|
||||
version = "0.20.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arboard",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "proxycast"
|
||||
version = "0.20.3"
|
||||
version = "0.20.4"
|
||||
description = "AI API Proxy Desktop App"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -612,10 +612,21 @@ pub fn add_kiro_oauth_credential(
|
||||
creds_file_path: String,
|
||||
name: Option<String>,
|
||||
) -> Result<ProviderCredential, String> {
|
||||
// 复制并重命名文件到应用存储目录
|
||||
let stored_file_path = copy_and_rename_credential_file(&creds_file_path, "kiro")?;
|
||||
tracing::info!("[KIRO] 开始添加凭证,文件路径: {}", creds_file_path);
|
||||
|
||||
pool_service.0.add_credential(
|
||||
// 复制并重命名文件到应用存储目录
|
||||
let stored_file_path = match copy_and_rename_credential_file(&creds_file_path, "kiro") {
|
||||
Ok(path) => {
|
||||
tracing::info!("[KIRO] 凭证文件已复制到: {}", path);
|
||||
path
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("[KIRO] 复制凭证文件失败: {}", e);
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
|
||||
match pool_service.0.add_credential(
|
||||
&db,
|
||||
"kiro",
|
||||
CredentialData::KiroOAuth {
|
||||
@@ -624,7 +635,16 @@ pub fn add_kiro_oauth_credential(
|
||||
name,
|
||||
Some(true),
|
||||
None,
|
||||
)
|
||||
) {
|
||||
Ok(cred) => {
|
||||
tracing::info!("[KIRO] 凭证添加成功,UUID: {}", cred.uuid);
|
||||
Ok(cred)
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("[KIRO] 添加凭证到数据库失败: {}", e);
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 从 JSON 内容创建 Kiro 凭证文件并添加到凭证池
|
||||
@@ -789,10 +809,24 @@ pub fn add_kiro_from_json(
|
||||
json_content: String,
|
||||
name: Option<String>,
|
||||
) -> Result<ProviderCredential, String> {
|
||||
// 从 JSON 内容创建凭证文件
|
||||
let stored_file_path = create_kiro_credential_from_json(&json_content)?;
|
||||
tracing::info!(
|
||||
"[KIRO] 开始从 JSON 添加凭证,内容长度: {}",
|
||||
json_content.len()
|
||||
);
|
||||
|
||||
pool_service.0.add_credential(
|
||||
// 从 JSON 内容创建凭证文件
|
||||
let stored_file_path = match create_kiro_credential_from_json(&json_content) {
|
||||
Ok(path) => {
|
||||
tracing::info!("[KIRO] 凭证文件已创建: {}", path);
|
||||
path
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("[KIRO] 创建凭证文件失败: {}", e);
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
|
||||
match pool_service.0.add_credential(
|
||||
&db,
|
||||
"kiro",
|
||||
CredentialData::KiroOAuth {
|
||||
@@ -801,7 +835,16 @@ pub fn add_kiro_from_json(
|
||||
name,
|
||||
Some(true),
|
||||
None,
|
||||
)
|
||||
) {
|
||||
Ok(cred) => {
|
||||
tracing::info!("[KIRO] 凭证添加成功,UUID: {}", cred.uuid);
|
||||
Ok(cred)
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("[KIRO] 添加凭证到数据库失败: {}", e);
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 添加 Gemini OAuth 凭证(通过文件路径)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "ProxyCast",
|
||||
"version": "0.20.3",
|
||||
"version": "0.20.4",
|
||||
"identifier": "com.proxycast.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
Reference in New Issue
Block a user